7.2.6 Commands for use in dg-final
The GCC testsuite defines the following directives to be used within
dg-final
.
7.2.6.1 Scan a particular file
scan-file
filename regexp [{ target/xfail
selector }]
- Passes if regexp matches text in filename.
scan-file-not
filename regexp [{ target/xfail
selector }]
- Passes if regexp does not match text in filename.
scan-module
module regexp [{ target/xfail
selector }]
- Passes if regexp matches in Fortran module module.
7.2.6.2 Scan the assembly output
scan-assembler
regex [{ target/xfail
selector }]
- Passes if regex matches text in the test's assembler output.
scan-assembler-not
regex [{ target/xfail
selector }]
- Passes if regex does not match text in the test's assembler output.
scan-assembler-times
regex num [{ target/xfail
selector }]
- Passes if regex is matched exactly num times in the test's
assembler output.
scan-assembler-dem
regex [{ target/xfail
selector }]
- Passes if regex matches text in the test's demangled assembler output.
scan-assembler-dem-not
regex [{ target/xfail
selector }]
- Passes if regex does not match text in the test's demangled assembler
output.
scan-hidden
symbol [{ target/xfail
selector }]
- Passes if symbol is defined as a hidden symbol in the test's
assembly output.
scan-not-hidden
symbol [{ target/xfail
selector }]
- Passes if symbol is not defined as a hidden symbol in the test's
assembly output.
7.2.6.3 Scan optimization dump files
These commands are available for kind of tree
, rtl
,
and ipa
.
scan-
kind-dump
regex suffix [{ target/xfail
selector }]
- Passes if regex matches text in the dump file with suffix suffix.
scan-
kind-dump-not
regex suffix [{ target/xfail
selector }]
- Passes if regex does not match text in the dump file with suffix
suffix.
scan-
kind-dump-times
regex num suffix [{ target/xfail
selector }]
- Passes if regex is found exactly num times in the dump file
with suffix suffix.
scan-
kind-dump-dem
regex suffix [{ target/xfail
selector }]
- Passes if regex matches demangled text in the dump file with
suffix suffix.
scan-
kind-dump-dem-not
regex suffix [{ target/xfail
selector }]
- Passes if regex does not match demangled text in the dump file with
suffix suffix.
7.2.6.4 Verify that an output files exists or not
output-exists [{ target/xfail
selector }]
- Passes if compiler output file exists.
output-exists-not [{ target/xfail
selector }]
- Passes if compiler output file does not exist.
7.2.6.5 Check for LTO tests
scan-symbol
regexp [{ target/xfail
selector }]
- Passes if the pattern is present in the final executable.
7.2.6.6 Checks for gcov tests
run-gcov
sourcefile- Check line counts in gcov tests.
run-gcov [branches] [calls] {
opts sourcefile }
- Check branch and/or call counts, in addition to line counts, in
gcov tests.
7.2.6.7 Clean up generated test files
cleanup-coverage-files
- Removes coverage data files generated for this test.
cleanup-ipa-dump
suffix- Removes IPA dump files generated for this test.
cleanup-modules "
list-of-extra-modules"
- Removes Fortran module files generated for this test, excluding the
module names listed in keep-modules.
Cleaning up module files is usually done automatically by the testsuite
by looking at the source files and removing the modules after the test
has been executed.
module MoD1
end module MoD1
module Mod2
end module Mod2
module moD3
end module moD3
module mod4
end module mod4
! { dg-final { cleanup-modules "mod1 mod2" } } ! redundant
! { dg-final { keep-modules "mod3 mod4" } }
keep-modules "
list-of-modules-not-to-delete"
- Whitespace separated list of module names that should not be deleted by
cleanup-modules.
If the list of modules is empty, all modules defined in this file are kept.
module maybe_unneeded
end module maybe_unneeded
module keep1
end module keep1
module keep2
end module keep2
! { dg-final { keep-modules "keep1 keep2" } } ! just keep these two
! { dg-final { keep-modules "" } } ! keep all
cleanup-profile-file
- Removes profiling files generated for this test.
cleanup-repo-files
- Removes files generated for this test for -frepo.
cleanup-rtl-dump
suffix- Removes RTL dump files generated for this test.
cleanup-saved-temps
- Removes files for the current test which were kept for -save-temps.
cleanup-tree-dump
suffix- Removes tree dump files matching suffix which were generated for
this test.