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
This commit is contained in:
parent
b8559e810f
commit
54f397919a
2 changed files with 29 additions and 4 deletions
|
@ -1,3 +1,10 @@
|
|||
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>
|
||||
|
||||
PR fortran/88206
|
||||
|
|
|
@ -27,7 +27,10 @@ proc gdc-convert-args { args } {
|
|||
|
||||
foreach arg [split [lindex $args 0] " "] {
|
||||
# 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"
|
||||
|
||||
} elseif { [regexp -- {^-J([\w+/-]+)} $arg pattern path] } {
|
||||
|
@ -183,6 +186,7 @@ proc dmd2dg { base test } {
|
|||
|
||||
# Split base, folder/file.
|
||||
set type [file dirname $test]
|
||||
set name [file tail $test]
|
||||
|
||||
# print "Filename: $base - $test"
|
||||
|
||||
|
@ -279,7 +283,7 @@ proc dmd2dg { base test } {
|
|||
# Compilable files are successful if an output is generated.
|
||||
# Fail compilable are successful if an output is not generated.
|
||||
# Runnable must compile, link, and return 0 to be successful by default.
|
||||
switch [file dirname $test] {
|
||||
switch $type {
|
||||
runnable {
|
||||
if ![isnative] {
|
||||
set out_line "// { dg-final { output-exists } }"
|
||||
|
@ -290,6 +294,16 @@ proc dmd2dg { base test } {
|
|||
compilable {
|
||||
set out_line "// { dg-final { output-exists } }"
|
||||
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 {
|
||||
|
@ -389,8 +403,12 @@ proc gdc-do-test { } {
|
|||
compilable {
|
||||
for { set i 0 } { $i<[llength $options] } { incr i } {
|
||||
set flags [lindex $options $i]
|
||||
#set dg-do-what-default "compile"
|
||||
set dg-do-what-default "assemble"
|
||||
# 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"
|
||||
}
|
||||
gdc-dg-runtest $filename $flags $imports
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue