## 4 Customizing DejaGnu ¶

The site configuration file, `site.exp`, captures configuration-dependent values and propagates them to the DejaGnu test environment using Tcl variables. This ties the DejaGnu test scripts into the `configure` and `make` programs. If this file is setup correctly, it is possible to execute a testsuite merely by typing `runtest`.

DejaGnu supports two `site.exp` files. The multiple instances of `site.exp` are loaded in a fixed order. The first file loaded is the local file `site.exp`, and then the optional global `site.exp` file as pointed to by the `DEJAGNU` environment variable.

There is an optional global `site.exp`, containing configuration values that apply to DejaGnu site-wide. `runtest` loads these values first. The global `site.exp` contains the default values for all targets and hosts supported by DejaGnu. This global file is identified by setting the environment variable `DEJAGNU` to the name of the file. If `DEJAGNU` is set, but the file cannot be located, an error will be raised and `runtest` will abort.

Any directory containing a configured testsuite also has a local `site.exp`, capturing configuration values specific to the tool being tested. Since `runtest` loads these values last, the individual test configuration can either rely on and use, or override, any of the global values from the global `site.exp` file.

You can usually generate or update the testsuite’s local `site.exp` by typing `make site.exp` in the testsuite directory, after the test suite is configured.

You can also have a file in your home directory called `.dejagnurc`. This gets loaded after the other config files. Usually this is used for personal stuff, like setting the `all_flag` so all the output gets printed, or your own verbosity levels. This file is usually restricted to setting command line options.

You can further override the default values in a user-editable section of any `site.exp`, or by setting variables on the `runtest` command line.