From: Iain Buclaw Date: Mon, 31 Aug 2020 17:27:15 +0000 (+0200) Subject: d: Only test with default permutation flags for runnable tests. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c285126cc0af8891a29e136be4b10ed27caef470;p=gcc.git d: Only test with default permutation flags for runnable tests. Unless the test explicitly requests, all compilable tests as well as fail_compilation tests will be ran without any extra flags. The C++ tests now are checked against shared D runtime library. gcc/testsuite/ChangeLog: * lib/gdc-utils.exp (gdc-convert-test): Handle LINK directive. Set PERMUTE_ARGS as DEFAULT_DFLAGS only for runnable tests. (gdc-do-test): Set default action of compilable tests to compile. Test SHARED_OPTION on runnable_cxx tests. --- diff --git a/gcc/testsuite/lib/gdc-utils.exp b/gcc/testsuite/lib/gdc-utils.exp index 37c1620f307..b1f90b8f92e 100644 --- a/gcc/testsuite/lib/gdc-utils.exp +++ b/gcc/testsuite/lib/gdc-utils.exp @@ -192,6 +192,7 @@ proc gdc-copy-extra { base extra } { # PERMUTE_ARGS: The set of arguments to permute in multiple compiler # invocations. An empty set means only one permutation # with no arguments. +# LINK: Enables linking. # TEST_OUTPUT: The output expected from the compilation. # POST_SCRIPT: Not handled. # REQUIRED_ARGS: Arguments to add to the compiler command line. @@ -203,12 +204,13 @@ proc gdc-convert-test { base test } { global PERMUTE_ARGS global GDC_EXECUTE_ARGS - set PERMUTE_ARGS $DEFAULT_DFLAGS + set PERMUTE_ARGS "" set GDC_EXECUTE_ARGS "" set extra_sources "" set extra_files "" set needs_phobos 0 + set saw_test_flags 0 upvar 1 compilable_do_what compilable_do_what set compilable_output_file_ext "" @@ -237,6 +239,10 @@ proc gdc-convert-test { base test } { # DISABLED is not handled. regsub -- {DISABLED.*$} $copy_line "" out_line + } elseif [regexp -- {LINK:} $copy_line] { + # LINK sets dg-do-what-default "link" + set compilable_do_what "link" + } elseif [regexp -- {POST_SCRIPT} $copy_line] { # POST_SCRIPT is not handled regsub -- {POST_SCRIPT.*$} $copy_line "" out_line @@ -246,14 +252,13 @@ proc gdc-convert-test { base test } { if { $args != "" } { error "gdc-convert-test: DFLAGS is not empty as expected" } - if { $PERMUTE_ARGS == $DEFAULT_DFLAGS } { - set PERMUTE_ARGS "" - } + set saw_test_flags 1 regsub -- {DFLAGS.*$} $copy_line "" out_line } elseif [regexp -- {PERMUTE_ARGS\s*:\s*(.*)} $copy_line match args] { # PERMUTE_ARGS is handled by gdc-do-test. set PERMUTE_ARGS [gdc-convert-args $args] + set saw_test_flags 1 regsub -- {PERMUTE_ARGS.*$} $copy_line "" out_line } elseif [regexp -- {EXECUTE_ARGS\s*:\s*(.*)} $copy_line match args] { @@ -339,6 +344,7 @@ proc gdc-convert-test { base test } { # Fail compilable are successful if an output is not generated. # Runnable must compile, link, and return 0 to be successful by default. switch $type { + runnable_cxx - runnable { if ![isnative] { puts $fdout "// { dg-final { output-exists } }" @@ -346,6 +352,11 @@ proc gdc-convert-test { base test } { if $needs_phobos { puts $fdout "// { dg-skip-if \"imports phobos\" { ! d_runtime_has_std_library } }" } + # Run runnable tests with all default permutations if not + # explicitly set in the test file. + if !$saw_test_flags { + set PERMUTE_ARGS $DEFAULT_DFLAGS + } } compilable { @@ -353,7 +364,6 @@ proc gdc-convert-test { base test } { # Compilable test may require checking another kind of output file. if { $compilable_output_file_ext != "" } { - set compilable_do_what "compile" # Check that file generation tests output the expected file. set genfile "[file rootname $name].$compilable_output_file_ext" puts $fdout "// { dg-final { if \[file exists $genfile\] \\{ } }" @@ -370,11 +380,6 @@ proc gdc-convert-test { base test } { } fail_compilation { - # Fail compilation tests only check for language errors from the - # front-end. No need to run all permutations of the default DFLAGS. - if { $PERMUTE_ARGS == $DEFAULT_DFLAGS } { - set PERMUTE_ARGS "" - } puts $fdout "// { dg-final { output-exists-not } }" } } @@ -451,11 +456,11 @@ proc gdc-do-test { testcases } { # Convert to DG test. set imports [format "-I%s/%s" $base $type] set cleanup_extra_files "" - set compilable_do_what "assemble" + set compilable_do_what "compile" # Include $testdir prefix so test names follow DejaGnu conventions. set filename "$testdir/[gdc-convert-test $base $type/$name.$ext]" - if { $type == "runnable" } { + if { $type == "runnable" || $type == "runnable_cxx" } { append PERMUTE_ARGS " $SHARED_OPTION" }