From 1821f97bb447dcfcb1fbdb780affbadc9ff03907 Mon Sep 17 00:00:00 2001 From: Iain Buclaw Date: Sat, 30 Mar 2019 22:10:12 +0000 Subject: [PATCH] testsuite/gdc.test: Merge upstream dmd 5dd3eccc3 The D2 testsuite script has been updated to handle EXTRA_SOURCES and EXTRA_FILES settings being split across multiple lines, which is how they appear in upstream. Reviewed-on: https://github.com/dlang/dmd/pull/9517 gcc/testsuite/ChangeLog: 2019-03-30 Iain Buclaw * gdc.test/gdc-test.exp (gdc-copy-extra): Append copied files to cleanup_extra_files. (dmd2dg): Copy additional files after test is processed. (gdc-do-test): Remove all copied files after test. From-SVN: r270038 --- gcc/d/dmd/MERGE | 2 +- gcc/testsuite/ChangeLog | 7 ++ gcc/testsuite/gdc.test/compilable/test6395.d | 3 +- gcc/testsuite/gdc.test/compilable/test7190.d | 5 +- gcc/testsuite/gdc.test/compilable/test9436.d | 1 - gcc/testsuite/gdc.test/compilable/testDIP37.d | 5 +- .../gdc.test/compilable/testDIP37_10302.d | 5 +- .../gdc.test/compilable/testDIP37_10354.d | 4 +- .../gdc.test/compilable/testDIP37_10421.d | 4 +- gcc/testsuite/gdc.test/gdc-test.exp | 70 ++++++++++++------- gcc/testsuite/gdc.test/runnable/cabi1.d | 2 +- .../gdc.test/runnable/cpp_abi_tests.d | 2 +- gcc/testsuite/gdc.test/runnable/cppa.d | 2 +- .../gdc.test/runnable/externmangle.d | 2 +- .../gdc.test/runnable/externmangle2.d | 2 +- gcc/testsuite/gdc.test/runnable/ice10086a.d | 3 +- gcc/testsuite/gdc.test/runnable/ice10086b.d | 3 +- gcc/testsuite/gdc.test/runnable/ice4481.d | 3 +- .../runnable/imports/std12010container.d | 1 - gcc/testsuite/gdc.test/runnable/link11069b.d | 4 +- gcc/testsuite/gdc.test/runnable/link12010.d | 3 +- gcc/testsuite/gdc.test/runnable/link2644.d | 4 +- gcc/testsuite/gdc.test/runnable/overload.d | 3 +- gcc/testsuite/gdc.test/runnable/test10736.d | 3 +- gcc/testsuite/gdc.test/runnable/test11863.d | 3 +- gcc/testsuite/gdc.test/runnable/test42.d | 6 +- 26 files changed, 103 insertions(+), 49 deletions(-) diff --git a/gcc/d/dmd/MERGE b/gcc/d/dmd/MERGE index ffad6cb524d..31ea106965b 100644 --- a/gcc/d/dmd/MERGE +++ b/gcc/d/dmd/MERGE @@ -1,4 +1,4 @@ -ab702e73e56aefb3b77b8f8f42da94bc22143eeb +5dd3eccc3b0758346f77bee3cdc3f6bd15de339b The first line of this file holds the git revision number of the last merge done from the dlang/dmd repository. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 390ae076ac8..8c46400a1f3 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2019-03-30 Iain Buclaw + + * gdc.test/gdc-test.exp (gdc-copy-extra): Append copied files to + cleanup_extra_files. + (dmd2dg): Copy additional files after test is translated. + (gdc-do-test): Remove all copied files after test. + 2019-03-30 Paul Thomas PR fortran/89841 diff --git a/gcc/testsuite/gdc.test/compilable/test6395.d b/gcc/testsuite/gdc.test/compilable/test6395.d index 95f1a7eae6e..a1bac8e48f1 100644 --- a/gcc/testsuite/gdc.test/compilable/test6395.d +++ b/gcc/testsuite/gdc.test/compilable/test6395.d @@ -1,5 +1,6 @@ -// REQUIRED_ARGS: -c -Icompilable/extra-files +// REQUIRED_ARGS: -Icompilable/extra-files // EXTRA_SOURCES: b6395.d +// EXTRA_FILES: extra-files/c6395.d // 6395 diff --git a/gcc/testsuite/gdc.test/compilable/test7190.d b/gcc/testsuite/gdc.test/compilable/test7190.d index 5143f55e772..45344f13b8f 100644 --- a/gcc/testsuite/gdc.test/compilable/test7190.d +++ b/gcc/testsuite/gdc.test/compilable/test7190.d @@ -1,6 +1,9 @@ // PERMUTE_ARGS: // REQUIRED_ARGS: -Icompilable/extra-files -// EXTRA_FILES: extra-files/example7190/controllers/HomeController.d extra-files/example7190/models/HomeModel.d extra-files/serenity7190/core/Controller.d extra-files/serenity7190/core/Model.d +// EXTRA_FILES: extra-files/example7190/controllers/HomeController.d +// EXTRA_FILES: extra-files/example7190/models/HomeModel.d +// EXTRA_FILES: extra-files/serenity7190/core/Controller.d +// EXTRA_FILES: extra-files/serenity7190/core/Model.d import example7190.controllers.HomeController; import example7190.models.HomeModel; diff --git a/gcc/testsuite/gdc.test/compilable/test9436.d b/gcc/testsuite/gdc.test/compilable/test9436.d index c80bdc59e82..2baee7c216b 100644 --- a/gcc/testsuite/gdc.test/compilable/test9436.d +++ b/gcc/testsuite/gdc.test/compilable/test9436.d @@ -1,4 +1,3 @@ -// REQUIRED_ARGS: -c // EXTRA_SOURCES: imports/test9436interp.d // this is a dummy module for test 9436. diff --git a/gcc/testsuite/gdc.test/compilable/testDIP37.d b/gcc/testsuite/gdc.test/compilable/testDIP37.d index a612365eaf4..7188758414c 100644 --- a/gcc/testsuite/gdc.test/compilable/testDIP37.d +++ b/gcc/testsuite/gdc.test/compilable/testDIP37.d @@ -1,6 +1,9 @@ // PERMUTE_ARGS: // REQUIRED_ARGS: -Icompilable/extra-files -// EXTRA_FILES: extra-files/pkgDIP37/datetime/package.d extra-files/pkgDIP37/datetime/common.d extra-files/pkgDIP37/test17629/package.di extra-files/pkgDIP37/test17629/common.di +// EXTRA_FILES: extra-files/pkgDIP37/datetime/package.d +// EXTRA_FILES: extra-files/pkgDIP37/datetime/common.d +// EXTRA_FILES: extra-files/pkgDIP37/test17629/package.di +// EXTRA_FILES: extra-files/pkgDIP37/test17629/common.di void test1() { diff --git a/gcc/testsuite/gdc.test/compilable/testDIP37_10302.d b/gcc/testsuite/gdc.test/compilable/testDIP37_10302.d index 7e76595f06f..3c4a409b709 100644 --- a/gcc/testsuite/gdc.test/compilable/testDIP37_10302.d +++ b/gcc/testsuite/gdc.test/compilable/testDIP37_10302.d @@ -1,6 +1,7 @@ // PERMUTE_ARGS: -// REQUIRED_ARGS: -c -Icompilable/extra-files -// EXTRA_SOURCES: extra-files/pkgDIP37_10302/liba.d extra-files/pkgDIP37_10302/libb.d +// REQUIRED_ARGS: -Icompilable/extra-files +// COMPILED_IMPORTS: extra-files/pkgDIP37_10302/liba.d +// COMPILED_IMPORTS: extra-files/pkgDIP37_10302/libb.d // EXTRA_FILES: extra-files/pkgDIP37_10302/package.d module test; diff --git a/gcc/testsuite/gdc.test/compilable/testDIP37_10354.d b/gcc/testsuite/gdc.test/compilable/testDIP37_10354.d index 2993fa94d39..f9adf86307c 100644 --- a/gcc/testsuite/gdc.test/compilable/testDIP37_10354.d +++ b/gcc/testsuite/gdc.test/compilable/testDIP37_10354.d @@ -1,6 +1,8 @@ // PERMUTE_ARGS: // REQUIRED_ARGS: -o- -Icompilable/extra-files -// EXTRA_FILES: extra-files/pkgDIP37_10354/mbar.d extra-files/pkgDIP37_10354/mfoo.d extra-files/pkgDIP37_10354/package.d +// EXTRA_FILES: extra-files/pkgDIP37_10354/mbar.d +// EXTRA_FILES: extra-files/pkgDIP37_10354/mfoo.d +// EXTRA_FILES: extra-files/pkgDIP37_10354/package.d module testDIP37_10354; import pkgDIP37_10354.mfoo; diff --git a/gcc/testsuite/gdc.test/compilable/testDIP37_10421.d b/gcc/testsuite/gdc.test/compilable/testDIP37_10421.d index 859347331b1..7da5bcf2d08 100644 --- a/gcc/testsuite/gdc.test/compilable/testDIP37_10421.d +++ b/gcc/testsuite/gdc.test/compilable/testDIP37_10421.d @@ -1,6 +1,8 @@ // PERMUTE_ARGS: // REQUIRED_ARGS: -Icompilable/extra-files -// COMPILED_IMPORTS: extra-files/pkgDIP37_10421/algo/package.d extra-files/pkgDIP37_10421/algo/mod.d extra-files/pkgDIP37_10421/except.d +// COMPILED_IMPORTS: extra-files/pkgDIP37_10421/algo/package.d +// COMPILED_IMPORTS: extra-files/pkgDIP37_10421/algo/mod.d +// COMPILED_IMPORTS: extra-files/pkgDIP37_10421/except.d module testDIP37_10421; import pkgDIP37_10421.algo; diff --git a/gcc/testsuite/gdc.test/gdc-test.exp b/gcc/testsuite/gdc.test/gdc-test.exp index 59abf74dc89..ab8a4a3cfbd 100644 --- a/gcc/testsuite/gdc.test/gdc-test.exp +++ b/gcc/testsuite/gdc.test/gdc-test.exp @@ -153,6 +153,10 @@ proc gdc-copy-extra { base extra } { close $fdin close $fdout + # Remove file once test is finished. + upvar 2 cleanup_extra_files cleanups + lappend cleanups $extra + return $extra } @@ -184,6 +188,9 @@ proc dmd2dg { base test } { set PERMUTE_ARGS $DEFAULT_DFLAGS set GDC_EXECUTE_ARGS "" + set extra_sources "" + set extra_files "" + # Split base, folder/file. set type [file dirname $test] set name [file tail $test] @@ -230,46 +237,57 @@ proc dmd2dg { base test } { regsub -- {REQUIRED_ARGS.*$} $copy_line $new_option out_line } elseif [regexp -- {EXTRA_SOURCES\s*:\s*(.*)} $copy_line match sources] { - # Copy all sources to the testsuite build directory. - foreach import $sources { - # print "Import: $base $type/$import" - gdc-copy-extra $base "$type/$import" + # EXTRA_SOURCES are appended to extra_sources list + foreach srcfile $sources { + lappend extra_sources $srcfile } - set new_option "{ dg-additional-sources \"$sources\" }" - regsub -- {EXTRA_SOURCES.*$} $copy_line $new_option out_line + regsub -- {EXTRA_SOURCES.*$} $copy_line "" out_line } elseif [regexp -- {EXTRA_CPP_SOURCES\s*:\s*(.*)} $copy_line match sources] { - # Copy all sources to the testsuite build directory. - foreach import $sources { - # print "Import: $base $type/$import" - gdc-copy-extra $base "$type/$import" + # EXTRA_CPP_SOURCES are appended to extra_sources list + foreach srcfile $sources { + # C++ sources are found in the extra-files directory. + lappend extra_sources "extra-files/$srcfile" } - set new_option "{ dg-additional-sources \"$sources\" }" - regsub -- {EXTRA_CPP_SOURCES.*$} $copy_line $new_option out_line + regsub -- {EXTRA_CPP_SOURCES.*$} $copy_line "" out_line } elseif [regexp -- {EXTRA_FILES\s*:\s*(.*)} $copy_line match files] { - # Copy all files to the testsuite build directory. - foreach import $files { - # print "Import: $base $type/$import" - gdc-copy-extra $base "$type/$import" + # EXTRA_FILES are appended to extra_files list + foreach file $files { + lappend extra_files $file } - set new_option "{ dg-additional-files \"$files\" }" - regsub -- {EXTRA_FILES.*$} $copy_line $new_option out_line + regsub -- {EXTRA_FILES.*$} $copy_line "" out_line } elseif [regexp -- {COMPILED_IMPORTS\s*:\s*(.*)} $copy_line match sources] { - # Copy all sources to the testsuite build directory. + # COMPILED_IMPORTS are appended to extra_sources list foreach import $sources { - # print "Import: $base $type/$import" - gdc-copy-extra $base "$type/$import" + lappend extra_sources $import } - set new_option "{ dg-additional-sources \"$sources\" }" - regsub -- {COMPILED_IMPORTS.*$} $copy_line $new_option out_line + regsub -- {COMPILED_IMPORTS.*$} $copy_line "" out_line } puts $fdout $out_line } + # Now that all extra sources and files have been collected, copy them all + # to the testsuite build directory. + if { [llength $extra_sources] > 0 } { + foreach srcfile $extra_sources { + gdc-copy-extra $base "$type/$srcfile" + } + set out_line "// { dg-additional-sources \"$extra_sources\" }" + puts $fdout $out_line + } + + if { [llength $extra_files] > 0 } { + foreach file $extra_files { + gdc-copy-extra $base "$type/$file" + } + set out_line "// { dg-additional-files \"$extra_files\" }" + puts $fdout $out_line + } + # Add specific options for test type # DMD's testsuite is extremely verbose, compiler messages from constructs @@ -387,6 +405,7 @@ proc gdc-do-test { } { # Convert to DG test. set imports [format "-I%s/%s" $base $dir] + set cleanup_extra_files "" # Include $subdir prefix so test names follow DejaGnu conventions. set filename "$subdir/[dmd2dg $base $dir/$name.$ext]" @@ -430,7 +449,10 @@ proc gdc-do-test { } { } } - # Cleanup + # Cleanup test directory. + foreach srcfile $cleanup_extra_files { + file delete $subdir/$srcfile + } file delete $filename } diff --git a/gcc/testsuite/gdc.test/runnable/cabi1.d b/gcc/testsuite/gdc.test/runnable/cabi1.d index b58e25ca5dc..3a914cd0e57 100644 --- a/gcc/testsuite/gdc.test/runnable/cabi1.d +++ b/gcc/testsuite/gdc.test/runnable/cabi1.d @@ -1,5 +1,5 @@ -// EXTRA_CPP_SOURCES: extra-files/cabi2.cpp +// EXTRA_CPP_SOURCES: cabi2.cpp import core.stdc.stdio; import core.stdc.config; diff --git a/gcc/testsuite/gdc.test/runnable/cpp_abi_tests.d b/gcc/testsuite/gdc.test/runnable/cpp_abi_tests.d index f0c0c097904..83e1cff10d9 100644 --- a/gcc/testsuite/gdc.test/runnable/cpp_abi_tests.d +++ b/gcc/testsuite/gdc.test/runnable/cpp_abi_tests.d @@ -1,4 +1,4 @@ -// EXTRA_CPP_SOURCES: extra-files/cpp_abi_tests.cpp +// EXTRA_CPP_SOURCES: cpp_abi_tests.cpp extern(C++) { diff --git a/gcc/testsuite/gdc.test/runnable/cppa.d b/gcc/testsuite/gdc.test/runnable/cppa.d index 6b2bafbe7bc..b9b4832991e 100644 --- a/gcc/testsuite/gdc.test/runnable/cppa.d +++ b/gcc/testsuite/gdc.test/runnable/cppa.d @@ -1,5 +1,5 @@ // PERMUTE_ARGS: -g -// EXTRA_CPP_SOURCES: extra-files/cppb.cpp +// EXTRA_CPP_SOURCES: cppb.cpp import core.stdc.stdio; import core.stdc.stdarg; diff --git a/gcc/testsuite/gdc.test/runnable/externmangle.d b/gcc/testsuite/gdc.test/runnable/externmangle.d index bf80adafe02..9099f94f2d0 100644 --- a/gcc/testsuite/gdc.test/runnable/externmangle.d +++ b/gcc/testsuite/gdc.test/runnable/externmangle.d @@ -1,4 +1,4 @@ -// EXTRA_CPP_SOURCES: extra-files/externmangle.cpp +// EXTRA_CPP_SOURCES: externmangle.cpp extern(C++): diff --git a/gcc/testsuite/gdc.test/runnable/externmangle2.d b/gcc/testsuite/gdc.test/runnable/externmangle2.d index 7d87fbd67f3..74beb2581f0 100644 --- a/gcc/testsuite/gdc.test/runnable/externmangle2.d +++ b/gcc/testsuite/gdc.test/runnable/externmangle2.d @@ -1,4 +1,4 @@ -// EXTRA_CPP_SOURCES: extra-files/externmangle2.cpp +// EXTRA_CPP_SOURCES: externmangle2.cpp version(Windows) { diff --git a/gcc/testsuite/gdc.test/runnable/ice10086a.d b/gcc/testsuite/gdc.test/runnable/ice10086a.d index c2f5ae6f729..31a5b568b50 100644 --- a/gcc/testsuite/gdc.test/runnable/ice10086a.d +++ b/gcc/testsuite/gdc.test/runnable/ice10086a.d @@ -1,4 +1,5 @@ -// EXTRA_SOURCES: imports/ice10086x.d imports/ice10086y.d +// EXTRA_SOURCES: imports/ice10086x.d +// EXTRA_SOURCES: imports/ice10086y.d import imports.ice10086x; import imports.ice10086y; diff --git a/gcc/testsuite/gdc.test/runnable/ice10086b.d b/gcc/testsuite/gdc.test/runnable/ice10086b.d index 0dc64f84c16..abb6f78a4ac 100644 --- a/gcc/testsuite/gdc.test/runnable/ice10086b.d +++ b/gcc/testsuite/gdc.test/runnable/ice10086b.d @@ -1,4 +1,5 @@ -// EXTRA_SOURCES: imports/ice10086y.d imports/ice10086x.d +// EXTRA_SOURCES: imports/ice10086y.d +// EXTRA_SOURCES: imports/ice10086x.d import imports.ice10086y; import imports.ice10086x; diff --git a/gcc/testsuite/gdc.test/runnable/ice4481.d b/gcc/testsuite/gdc.test/runnable/ice4481.d index 638d1518f60..e1467963ee7 100644 --- a/gcc/testsuite/gdc.test/runnable/ice4481.d +++ b/gcc/testsuite/gdc.test/runnable/ice4481.d @@ -1,4 +1,5 @@ -// EXTRA_SOURCES: imports/ice4481a.d imports/ice4481b.d +// EXTRA_SOURCES: imports/ice4481a.d +// EXTRA_SOURCES: imports/ice4481b.d import imports.ice4481a; import imports.ice4481b; diff --git a/gcc/testsuite/gdc.test/runnable/imports/std12010container.d b/gcc/testsuite/gdc.test/runnable/imports/std12010container.d index a2288059927..1fe8aff14a9 100644 --- a/gcc/testsuite/gdc.test/runnable/imports/std12010container.d +++ b/gcc/testsuite/gdc.test/runnable/imports/std12010container.d @@ -1,4 +1,3 @@ -module imports.std12010container; struct Array(T) { private struct Payload diff --git a/gcc/testsuite/gdc.test/runnable/link11069b.d b/gcc/testsuite/gdc.test/runnable/link11069b.d index a6253504f98..658f46eb51b 100644 --- a/gcc/testsuite/gdc.test/runnable/link11069b.d +++ b/gcc/testsuite/gdc.test/runnable/link11069b.d @@ -1,5 +1,7 @@ // COMPILE_SEPARATELY -// EXTRA_SOURCES: imports/link11069x.d imports/link11069y.d imports/link11069z.d +// EXTRA_SOURCES: imports/link11069x.d +// EXTRA_SOURCES: imports/link11069y.d +// EXTRA_SOURCES: imports/link11069z.d import imports.link11069y; import imports.link11069z; diff --git a/gcc/testsuite/gdc.test/runnable/link12010.d b/gcc/testsuite/gdc.test/runnable/link12010.d index 41fa719f799..49c4eb184b1 100644 --- a/gcc/testsuite/gdc.test/runnable/link12010.d +++ b/gcc/testsuite/gdc.test/runnable/link12010.d @@ -1,5 +1,6 @@ // COMPILE_SEPARATELY -// EXTRA_SOURCES: imports/a12010.d imports/std12010container.d +// EXTRA_SOURCES: imports/a12010.d +// EXTRA_FILES: imports/std12010container.d // REQUIRED_ARGS: -release // -release is necessary to avoid __assert. diff --git a/gcc/testsuite/gdc.test/runnable/link2644.d b/gcc/testsuite/gdc.test/runnable/link2644.d index bf656f7ef81..f38b8cab8c2 100644 --- a/gcc/testsuite/gdc.test/runnable/link2644.d +++ b/gcc/testsuite/gdc.test/runnable/link2644.d @@ -1,5 +1,7 @@ // PERMUTE_ARGS: -version=X -inline -release -g -O -// EXTRA_SOURCES: imports/link2644a.d imports/link2644b.d imports/link2644c.d +// EXTRA_SOURCES: imports/link2644a.d +// EXTRA_SOURCES: imports/link2644b.d +// EXTRA_SOURCES: imports/link2644c.d // COMPILE_SEPARATELY: module link2644; diff --git a/gcc/testsuite/gdc.test/runnable/overload.d b/gcc/testsuite/gdc.test/runnable/overload.d index 73354281df4..f8fa7d5cdda 100644 --- a/gcc/testsuite/gdc.test/runnable/overload.d +++ b/gcc/testsuite/gdc.test/runnable/overload.d @@ -1,4 +1,5 @@ -// EXTRA_SOURCES: imports/ovs1528a.d imports/ovs1528b.d imports/template_ovs1.d imports/template_ovs2.d imports/template_ovs3.d +// EXTRA_SOURCES: imports/ovs1528a.d imports/ovs1528b.d +// EXTRA_SOURCES: imports/template_ovs1.d imports/template_ovs2.d imports/template_ovs3.d import imports.template_ovs1; import imports.template_ovs2; diff --git a/gcc/testsuite/gdc.test/runnable/test10736.d b/gcc/testsuite/gdc.test/runnable/test10736.d index 373b536129b..55b6f539887 100644 --- a/gcc/testsuite/gdc.test/runnable/test10736.d +++ b/gcc/testsuite/gdc.test/runnable/test10736.d @@ -1,4 +1,5 @@ -// EXTRA_SOURCES: imports/test10736a.d imports/test10736b.d +// EXTRA_SOURCES: imports/test10736a.d +// EXTRA_SOURCES: imports/test10736b.d import imports.test10736a; import imports.test10736b; diff --git a/gcc/testsuite/gdc.test/runnable/test11863.d b/gcc/testsuite/gdc.test/runnable/test11863.d index f42ac45d348..c1285b3bef7 100644 --- a/gcc/testsuite/gdc.test/runnable/test11863.d +++ b/gcc/testsuite/gdc.test/runnable/test11863.d @@ -1,5 +1,6 @@ // COMPILE_SEPARATELY -// EXTRA_SOURCES: imports/std11863conv.d imports/std11863format.d +// EXTRA_SOURCES: imports/std11863conv.d +// EXTRA_FILES: imports/std11863format.d import imports.std11863conv; diff --git a/gcc/testsuite/gdc.test/runnable/test42.d b/gcc/testsuite/gdc.test/runnable/test42.d index b9619c992ff..87ee7a8e73a 100644 --- a/gcc/testsuite/gdc.test/runnable/test42.d +++ b/gcc/testsuite/gdc.test/runnable/test42.d @@ -5676,7 +5676,11 @@ void testreal_to_ulong() real adjust = 1.0L/real.epsilon; u = r2ulong(adjust); //writefln("%s %s", adjust, u); - static if(real.mant_dig == 64) + static if(real.mant_dig == 113) + assert(u == 18446744073709551615UL); + else static if(real.mant_dig == 106) + assert(u == 18446744073709551615UL); + else static if(real.mant_dig == 64) assert(u == 9223372036854775808UL); else static if(real.mant_dig == 53) assert(u == 4503599627370496UL); -- 2.30.2