Go to the first, previous, next, last section, table of contents.

Setting runtest defaults

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.

DejaGnu supports more than one `site.exp' file. The multiple instances of `site.exp' are loaded in a fixed order built into DejaGnu (the more local last).

  1. There is a "master" `site.exp', capturing configuration values that apply to DejaGnu across the board, in each configuration-specific subdirectory of the DejaGnu library directory. runtest loads these values first. This master configuration file is created when DejaGnu is installed. See section Installing DejaGnu. The master `site.exp' can contain the default values for all targets supported by DejaGnu.
  2. You can also define another global configuration file, and identify it by setting the environment variable DEJAGNU to the name of the file. Anything in the file `$DEJAGNU' overrides the values in the installed master configuration file.
  3. Any directory containing a configured test suite also has a `site.exp', capturing configuration values specific to the tool under test. 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 "master" `site.exp'. You can usually generate or update the test-suite `site.exp' by typing `make site.exp' in the test suite directory, after the test suite is configured.

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.

All `site.exp' files have two sections, separated by comment text. 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

Do not edit this first section; if you do, your changes are replaced next time you run make. The first section ends with this line:

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

The first section is the part that 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. (You can also customize these values by using the `--site' option to configure.) In particular, this section contains the `Makefile' variables for host and target configuration data.

In the second section, you can override any default values (locally to DejaGnu) 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 test-suite 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.)

It is usually more convenient to keep these "manual overrides" in the `site.exp' local to each test directory, rather than in the "master" `site.exp' in the DejaGnu library.

To override the values captured in the first part of `site.exp' by configure and make, simply set your own value for any of these variables in the second part of `site.exp'. Set the variables using the Tcl set command; for example, to run tests on an experimental version of GCC, the second part of your `site.exp' might include:

set CC "/working/devo/gcc/xgcc"

Configuration dependent values

The default values depend on your configuration. The defaults shown are those built into the DejaGnu distribution, which will appear only if your configuration does not change them. (For example, in cross configurations, program names often reflect the target type.)

This example is taken from the template for the global configuration file installed as the master `site.exp'. You can use the same format (a Tcl case statement) for any DejaGnu configuration file.

#
# Set defaults for all known targets
#
case "$target_alias" in {
    { "native" } {
	set target_abbrev unix
	set connectmode ""
	set targetname  ""
	set netport     ""
	set serialport  ""
	set baud        ""
    }
    { "m68k-*bug-*" "m68k-mvme135-*" } {
        # Motorola MVME135 board running Bug monitor
	set target_abbrev bug
	set connectmode "tip"
	set targetname  "s8"
	set serialport  "/dev/ttyr8"
	set netport     "wharfrat:20008"
	set baud        "9600"
	set CFLAGS      "-Tmvme135.ld"
	set CXXFLAGS    "-Tmvme135.ld"
     }
}
$target_alias
The value of target_alias is set by configure. This DejaGnu configuration file uses it to choose the default values for a particular target machine.
m68k-*bug-*
m68k-mvme135-*
These are examples of configuration strings to be compared against `$target_alias'. The first of these strings matches the configuration named `m68k-abug-coff'.
target_abbrev
The abbreviation used to construct the tool initialization filename. This only exists because many systems have restrictions on how long a file name can be.
connectmode
The name of a Tcl procedure which manages connecting to the target board. See section Defaults for runtest options, for the list of meaningful values.
targetname
A string passed to the `$connectmode' procedure to identify a particular target machine. In this example, `s8' is an entry in /etc/remote, used by tip.
serialport
Which serial port to use, if `$connectmode' specifies a serial connection procedure.
netport
Which TCP port to use, if a target is available over an internet (for example, on a terminal server), rather than through a standard serial communications line.
baud
Speed (in bps) used to connect with a target via a serial line.
CFLAGS
The default list of options passed to the C compiler, whenever it is used in tests. The default value is `-g'.
CXXFLAGS
The default list of options passed to the C++ compiler, whenever it is used in tests. The default value is "-g".

The following variables, usually in the local `site.exp' (in test directories), extend the standard set of configuration variables. You should never redefine these; they permit runtest to determine its configuration at runtime. The examples shown below are from a Sun-4 native configuration.

host_triplet
The full configuration name of the host computer where DejaGnu runs; this is the default corresponding to the `--host' option to runtest. "sparc-sun-sunos4.1.1" describes a particular level of Sun4, for example.
target_triplet
The full configuration name of the target machine where the tests run; in a native configuration, the same value as `host_triplet'.

Defaults for runtest options

In the user editable second section of `site.exp', you can not only override the configuration variables captured in the first section, but also specify default values for all the runtest command line options. Save for `--debug', `--help', and `--version', each command line option has an associated Tcl variable. Use the Tcl set command to specify a new default value (as for the configuration variables). The following table describes the correspondence between command line options and variables you can set in `site.exp'. See section Using runtest, for explanations of the command-line options.


Go to the first, previous, next, last section, table of contents.