# Installing GCC: Testing

Before you install GCC, we encourage you to run the testsuites and to compare your results with results from a similar configuration that have been submitted to the gcc-testresults mailing list. Some of these archived results are linked from the build status lists at http://gcc.gnu.org/buildstat.html, although not everyone who reports a successful build runs the testsuites and submits the results. This step is optional and may require you to download additional software, but it can give you confidence in your new GCC installation or point out problems before you install and start using your new GCC.

First, you must have downloaded the testsuites. These are part of the full distribution, but if you downloaded the "core" compiler plus any front ends, you must download the testsuites separately.

Second, you must have the testing tools installed. This includes DejaGnu 1.4.1 or 1.4.3 and later, Tcl, and Expect; the DejaGnu site has links to these.

If the directories where `runtest` and `expect` were installed are not in the `PATH`, you may need to set the following environment variables appropriately, as in the following example (which assumes that DejaGnu has been installed under `/usr/local`):

              TCL_LIBRARY = /usr/local/share/tcl8.0
              DEJAGNULIBS = /usr/local/share/dejagnu

(On systems such as Cygwin, these paths are required to be actual paths, not mounts or links; presumably this is due to some lack of portability in the DejaGnu code.)

Finally, you can run the testsuite (which may take a long time):

              cd objdir; make -k check

This will test various components of GCC, such as compiler front ends and runtime libraries. While running the testsuite, DejaGnu might emit some harmless messages resembling `WARNING: Couldn't find the global config file.` or `WARNING: Couldn't find tool init file` that can be ignored.

### How can I run the test suite on selected tests?

In order to run sets of tests selectively, there are targets `make check-gcc` and `make check-g++` in the `gcc` subdirectory of the object directory. You can also just run `make check` in a subdirectory of the object directory.

A more selective way to just run all `gcc` execute tests in the testsuite is to use

             make check-gcc RUNTESTFLAGS="execute.exp other-options"

Likewise, in order to run only the `g++` "old-deja" tests in the testsuite with filenames matching `9805*`, you would use

             make check-g++ RUNTESTFLAGS="old-deja.exp=9805* other-options"

The `*.exp` files are located in the testsuite directories of the GCC source, the most important ones being `compile.exp`, `execute.exp`, `dg.exp` and `old-deja.exp`. To get a list of the possible `*.exp` files, pipe the output of `make check` into a file and look at the `Running ... .exp` lines.

The Java runtime tests can be executed via `make check` in the ``target`/libjava/testsuite` directory in the build tree.

### Additional testing for Java Class Libraries

The Mauve Project provides a suite of tests for the Java Class Libraries. This suite can be run as part of libgcj testing by placing the Mauve tree within the libjava testsuite at `libjava/testsuite/libjava.mauve/mauve`, or by specifying the location of that tree when invoking `make`, as in `make MAUVEDIR=~/mauve check`. Jacks is a free test suite that tests Java compiler front ends. This suite can be run as part of libgcj testing by placing the Jacks tree within the libjava testsuite at `libjava/testsuite/libjava.jacks/jacks`.

### How to interpret test results

The result of running the testsuite are various `*.sum` and `*.log` files in the testsuite subdirectories. The `*.log` files contain a detailed log of the compiler invocations and the corresponding results, the `*.sum` files summarize the results. These summaries contain status codes for all tests:

- PASS: the test passed as expected
- XPASS: the test unexpectedly passed
- FAIL: the test unexpectedly failed
- XFAIL: the test failed as expected
- UNSUPPORTED: the test is not supported on this platform
- ERROR: the testsuite detected an error
- WARNING: the testsuite detected a possible problem

It is normal for some tests to report unexpected failures. At the current time our testing harness does not allow fine grained control over whether or not a test is expected to fail. We expect to fix this problem in future releases.

### Submitting test results

If you want to report the results to the GCC project, use the `contrib/test_summary` shell script. Start it in the objdir with

             srcdir/contrib/test_summary -p your_commentary.txt \
                 -m gcc-testresults@gcc.gnu.org |sh

This script uses the `Mail` program to send the results, so make sure it is in your `PATH`. The file `your_commentary.txt` is prepended to the testsuite summary and should contain any special remarks you have on your results or your build environment. Please do not edit the testsuite result block or the subject line, as these messages may be automatically processed.

Return to the GCC Installation page