Commit 54f39791 by Iain Buclaw Committed by Iain Buclaw

Generate and scan documentation output in Ddoc tests.

The tests in gdc.test/compilable/ddoc*.d don't require the module to be
compiled all the way down to object code.  Instead, only compile the
test sources with -fdoc, and scan the generated html content.

gcc/testsuite/ChangeLog:

	PR d/88039
	* gdc.test/gdc-test.exp (gdc-convert-args): Handle -D.
	(dmd2dg): Check generated html in ddoc tests.
	(gdc-do-test): Set dg-do-what-default to compile for ddoc tests.

From-SVN: r266933
parent b8559e81
2018-12-09 Iain Buclaw <ibuclaw@gdcproject.org>
PR d/88039
* gdc.test/gdc-test.exp (gdc-convert-args): Handle -D.
(dmd2dg): Check generated html in ddoc tests.
(gdc-do-test): Set dg-do-what-default to compile for ddoc tests.
2018-12-09 Steven G. Kargl <kargl@gcc.gnu.org> 2018-12-09 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/88206 PR fortran/88206
......
...@@ -27,7 +27,10 @@ proc gdc-convert-args { args } { ...@@ -27,7 +27,10 @@ proc gdc-convert-args { args } {
foreach arg [split [lindex $args 0] " "] { foreach arg [split [lindex $args 0] " "] {
# List of switches kept in ASCII collated order. # List of switches kept in ASCII collated order.
if { [regexp -- {^-I([\w+/-]+)} $arg pattern path] } { if [string match "-D" $arg] {
lappend out "-fdoc"
} elseif { [regexp -- {^-I([\w+/-]+)} $arg pattern path] } {
lappend out "-I$path" lappend out "-I$path"
} elseif { [regexp -- {^-J([\w+/-]+)} $arg pattern path] } { } elseif { [regexp -- {^-J([\w+/-]+)} $arg pattern path] } {
...@@ -183,6 +186,7 @@ proc dmd2dg { base test } { ...@@ -183,6 +186,7 @@ proc dmd2dg { base test } {
# Split base, folder/file. # Split base, folder/file.
set type [file dirname $test] set type [file dirname $test]
set name [file tail $test]
# print "Filename: $base - $test" # print "Filename: $base - $test"
...@@ -279,7 +283,7 @@ proc dmd2dg { base test } { ...@@ -279,7 +283,7 @@ proc dmd2dg { base test } {
# Compilable files are successful if an output is generated. # Compilable files are successful if an output is generated.
# Fail compilable are successful if an output is not generated. # Fail compilable are successful if an output is not generated.
# Runnable must compile, link, and return 0 to be successful by default. # Runnable must compile, link, and return 0 to be successful by default.
switch [file dirname $test] { switch $type {
runnable { runnable {
if ![isnative] { if ![isnative] {
set out_line "// { dg-final { output-exists } }" set out_line "// { dg-final { output-exists } }"
...@@ -290,6 +294,16 @@ proc dmd2dg { base test } { ...@@ -290,6 +294,16 @@ proc dmd2dg { base test } {
compilable { compilable {
set out_line "// { dg-final { output-exists } }" set out_line "// { dg-final { output-exists } }"
puts $fdout $out_line puts $fdout $out_line
# Check that Ddoc tests also generate a html file.
if [regexp -- "ddoc.*" $name] {
set ddocfile "[file rootname $name].html"
set out_line "// { dg-final { scan-file $ddocfile \"Generated by Ddoc from $test\" } }"
puts $fdout $out_line
# Cleanup extra generated files.
set out_line "// { dg-final { file delete $ddocfile } }"
puts $fdout $out_line
}
} }
fail_compilation { fail_compilation {
...@@ -389,8 +403,12 @@ proc gdc-do-test { } { ...@@ -389,8 +403,12 @@ proc gdc-do-test { } {
compilable { compilable {
for { set i 0 } { $i<[llength $options] } { incr i } { for { set i 0 } { $i<[llength $options] } { incr i } {
set flags [lindex $options $i] set flags [lindex $options $i]
#set dg-do-what-default "compile" # Compilable test may require checking another kind of output file.
if [regexp -- "ddoc.*" $name] {
set dg-do-what-default "compile"
} else {
set dg-do-what-default "assemble" set dg-do-what-default "assemble"
}
gdc-dg-runtest $filename $flags $imports gdc-dg-runtest $filename $flags $imports
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment