# 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.
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 ""
# 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
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] {
# 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 } }"
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 {
# 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\] \\{ } }"
}
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 } }"
}
}
# 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"
}