C Language Testsuites#
GCC contains the following C language testsuites, in the
gcc/testsuite directory:
gcc.dgThis contains tests of particular features of the C compiler, using the more modern
dgharness. Correctness tests for various compiler features should go here if possible.Magic comments determine whether the file is preprocessed, compiled, linked or run. In these tests, error and warning message texts are compared against expected texts or regular expressions given in comments. These tests are run with the options
-ansi -pedanticunless other options are given in the test. Except as noted below they are not run with multiple optimization options.gcc.dg/compatThis subdirectory contains tests for binary compatibility using
lib/compat.exp, which in turn uses the language-independent support (see Support for testing binary compatibility).gcc.dg/cppThis subdirectory contains tests of the preprocessor.
gcc.dg/debugThis subdirectory contains tests for debug formats. Tests in this subdirectory are run for each debug format that the compiler supports.
gcc.dg/formatThis subdirectory contains tests of the
-Wformatformat checking. Tests in this directory are run with and without-DWIDE.gcc.dg/noncompileThis subdirectory contains tests of code that should not compile and does not need any special compilation options. They are run with multiple optimization options, since sometimes invalid code crashes the compiler with optimization.
gcc.dg/specialTodo
describe this
gcc.c-tortureThis contains particular code fragments which have historically broken easily. These tests are run with multiple optimization options, so tests for features which only break at some optimization levels belong here. This also contains tests to check that certain optimizations occur. It might be worthwhile to separate the correctness tests cleanly from the code quality tests, but it hasn’t been done yet.
gcc.c-torture/compatTodo
describe this
This directory should probably not be used for new tests.
gcc.c-torture/compileThis testsuite contains test cases that should compile, but do not need to link or run. These test cases are compiled with several different combinations of optimization options. All warnings are disabled for these test cases, so this directory is not suitable if you wish to test for the presence or absence of compiler warnings. While special options can be set, and tests disabled on specific platforms, by the use of
.xfiles, mostly these test cases should not contain platform dependencies.Todo
discuss how defines such as
STACK_SIZEare usedgcc.c-torture/executeThis testsuite contains test cases that should compile, link and run; otherwise the same comments as for
gcc.c-torture/compileapply.gcc.c-torture/execute/ieeeThis contains tests which are specific to IEEE floating point.
gcc.c-torture/unsortedTodo
describe this
This directory should probably not be used for new tests.
gcc.misc-testsThis directory contains C tests that require special handling. Some of these tests have individual expect files, and others share special-purpose expect files:
bprob*.cTest
-fbranch-probabilitiesusinggcc.misc-tests/bprob.exp, which in turn uses the generic, language-independent framework (see Support for testing profile-directed optimizations).gcov*.cTest gcov output using
gcov.exp, which in turn uses the language-independent support (see Support for testing gcov).i386-pf-*.cTest i386-specific support for data prefetch using
i386-prefetch.exp.
gcc.test-framework
dg-*.cTest the testsuite itself using
gcc.test-framework/test-framework.exp.
Todo
merge in testsuite/README.gcc and discuss the format of
test cases and magic comments more.