Final Actions - GNU Compiler Collection (GCC) Internals
Description: GNU Compiler Collection (GCC) Internals

Previous: Require Support, Up: Test Directives

#### 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`
  Removes Fortran module files generated for this test.
`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.