diff options
author | Iain Buclaw <ibuclaw@gdcproject.org> | 2018-12-09 19:55:54 +0000 |
---|---|---|
committer | Iain Buclaw <ibuclaw@gcc.gnu.org> | 2018-12-09 19:55:54 +0000 |
commit | 54f397919ae47f9c2433be93fcc14288899beb8c (patch) | |
tree | dd018089cc652dc3988c715c571821c88940ca3e | |
parent | b8559e810f5912bba9fba39c005f3fe2c1de09d9 (diff) | |
download | gcc-54f397919ae47f9c2433be93fcc14288899beb8c.zip gcc-54f397919ae47f9c2433be93fcc14288899beb8c.tar.gz gcc-54f397919ae47f9c2433be93fcc14288899beb8c.tar.bz2 |
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
-rw-r--r-- | gcc/testsuite/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/testsuite/gdc.test/gdc-test.exp | 26 |
2 files changed, 29 insertions, 4 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index aac29ff..043c5ea 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -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 diff --git a/gcc/testsuite/gdc.test/gdc-test.exp b/gcc/testsuite/gdc.test/gdc-test.exp index 246ac85..7dd97d3 100644 --- a/gcc/testsuite/gdc.test/gdc-test.exp +++ b/gcc/testsuite/gdc.test/gdc-test.exp @@ -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 } } |