### 4.2 Local configuration file ¶

It is usually more convenient to keep these manual overrides in the `site.exp` local to each test directory, rather than in the global `site.exp` in the installed DejaGnu library. This file is mostly for supplying tool specific info that is required by the testsuite.

All local `site.exp` files have two sections, separated by comments. The first section is generated by `make`. It is essentially a collection of Tcl variable definitions based on `Makefile` environment variables. Since they are generated by `make`, they contain the values as specified by `configure`. In particular, this section contains the `Makefile` variables for host and target configuration data. Do not edit this first section; if you do, your changes will be overwritten the next time you run `make`. The first section starts with:

    ## these variables are automatically generated by make ##
    # Do not edit here. If you wish to override these values
    # add them to the last section

In the second section, you can override any default values for all the variables. The second section can also contain your preferred defaults for all the command line options to `runtest`. This allows you to easily customize `runtest` for your preferences in each configured testsuite tree, so that you need not type options repeatedly on the command line. The second section may also be empty if you do not wish to override any defaults.

The first section ends with this line

    ## All variables above are generated by configure. Do Not Edit ##

You can make any changes under this line. If you wish to redefine a variable in the top section, then just put a duplicate value in this second section. Usually the values defined in this configuration file are related to the configuration of the test run. This is the ideal place to set the variables `host_triplet`, `build_triplet`, `target_triplet`. All other variables are tool dependent, i.e., for testing a compiler, the value for `CC` might be set to a freshly built binary, as opposed to one in the user’s path.

Here’s an example local site.exp file, as used for GCC/G++ testing.

Local Configuration File

    ## these variables are automatically generated by make ##
    # Do not edit here. If you wish to override these values
    # add them to the last section
    set rootme "/build/devo-builds/i686-pc-linux-gnu/gcc"
    set host_triplet i686-pc-linux-gnu
    set build_triplet i686-pc-linux-gnu
    set target_triplet i686-pc-linux-gnu
    set target_alias i686-pc-linux-gnu
    set CFLAGS ""
    set CXXFLAGS "-isystem /build/devo-builds/i686-pc-linux-gnu/gcc/../libio -isystem $srcdir/../libg++/src -isystem $srcdir/../libio -isystem $srcdir/../libstdc++ -isystem $srcdir/../libstdc++/stl -L/build/devo-builds/i686-pc-linux-gnu/gcc/../libg++ -L/build/devo-builds/i686-pc-linux-gnu/gcc/../libstdc++"
    append LDFLAGS " -L/build/devo-builds/i686-pc-linux-gnu/gcc/../ld"
    set tmpdir /build/devo-builds/i686-pc-linux-gnu/gcc/testsuite
    set srcdir "${srcdir}/testsuite"
    ## All variables above are generated by configure. Do Not Edit ##

This file defines the required fields for a local configuration file, namely the three system triplets, and the srcdir. It also defines several other Tcl variables that are used exclusively by the GCC testsuite. For most test cases, the CXXFLAGS and LDFLAGS are supplied by DejaGnu itself for cross testing, but to test a compiler, GCC needs to manipulate these itself.

The local `site.exp` may also set Tcl variables such as `test_timeout` which can control the amount of time (in seconds) to wait for a remote test to complete. If not specified, `test_timeout` defaults to 300 seconds.