blob: b01232aa58651bb3fb4dbd0b92ca3284c5cb650b [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<HTML
><HEAD
><TITLE
>Customizing DejaGnu</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
"><LINK
REL="HOME"
TITLE="DejaGnu"
HREF="book1.html"><LINK
REL="PREVIOUS"
TITLE="The files DejaGnu produces."
HREF="x755.html"><LINK
REL="NEXT"
TITLE="Global Config File"
HREF="x916.html"></HEAD
><BODY
CLASS="CHAPTER"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>DejaGnu: The GNU Testing Framework</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="x755.html"
ACCESSKEY="P"
>&#60;&#60;&#60; Previous</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="x916.html"
ACCESSKEY="N"
>Next &#62;&#62;&#62;</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="CHAPTER"
><H1
><A
NAME="CUSTOMIZING"
></A
>Customizing DejaGnu</H1
><P
>The site configuration file, <TT
CLASS="FILENAME"
>site.exp</TT
>,
captures configuration-dependent values and propagates them to the
DejaGnu test environment using Tcl variables. This ties the
DejaGnu test scripts into the <B
CLASS="COMMAND"
>configure</B
> and
<B
CLASS="COMMAND"
>make</B
> programs. If this file is setup correctly,
it is possible to execute a testsuite merely by typing
<B
CLASS="COMMAND"
>runtest</B
>.</P
><P
>DejaGnu supports two <TT
CLASS="FILENAME"
>site.exp</TT
>
files. The multiple instances of <TT
CLASS="FILENAME"
>site.exp</TT
> are
loaded in a fixed order built into DejaGnu. The first file loaded
is the local file <TT
CLASS="FILENAME"
>site.exp</TT
>, and then the
optional global <TT
CLASS="FILENAME"
>site.exp</TT
> file as
pointed to by the <SPAN
CLASS="SYMBOL"
>DEJAGNU</SPAN
> environment
variable.</P
><P
>There is an optional <I
CLASS="EMPHASIS"
>master</I
>
<TT
CLASS="FILENAME"
>site.exp</TT
>, capturing configuration values that
apply to DejaGnu across the board, in each configuration-specific
subdirectory of the DejaGnu library directory.
<B
CLASS="COMMAND"
>runtest</B
> loads these values first. The master
<TT
CLASS="FILENAME"
>site.exp</TT
> contains the default values for all
targets and hosts supported by DejaGnu. This master file is
identified by setting the environment variable
<SPAN
CLASS="SYMBOL"
>DEJAGNU</SPAN
> to the name of the file. This is also
refered to as the ``global'' config file.</P
><P
>Any directory containing a configured testsuite also has a
local <TT
CLASS="FILENAME"
>site.exp</TT
>, capturing configuration values
specific to the tool under test. Since <B
CLASS="COMMAND"
>runtest</B
>
loads these values last, the individual test configuration can
either rely on and use, or override, any of the global values from
the global <TT
CLASS="FILENAME"
>site.exp</TT
> file.</P
><P
>You can usually generate or update the testsuite's local
<TT
CLASS="FILENAME"
>site.exp</TT
> by typing <B
CLASS="COMMAND"
>make
site.exp</B
> in the testsuite directory, after the test
suite is configured.</P
><P
>You can also have a file in your home directory called
<TT
CLASS="FILENAME"
>.dejagnurc</TT
>. This gets loaded first before the
other config files. Usually this is used for personal stuff, like
setting the <SPAN
CLASS="SYMBOL"
>all_flag</SPAN
> so all the output gets
printed, or your own verbosity levels. This file is usually
restricted to setting command line options.</P
><P
>You can further override the default values in a
user-editable section of any <TT
CLASS="FILENAME"
>site.exp</TT
>, or by
setting variables on the <B
CLASS="COMMAND"
>runtest</B
> command
line.</P
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="LOCAL"
></A
>Local Config File</H1
><P
>It is usually more convenient to keep these <I
CLASS="EMPHASIS"
>manual
overrides</I
> in the <TT
CLASS="FILENAME"
>site.exp</TT
>
local to each test directory, rather than in the global
<TT
CLASS="FILENAME"
>site.exp</TT
> in the installed DejaGnu
library. This file is mostly for supplying tool specific info
that is required by the testsuite.</P
><P
>All local <TT
CLASS="FILENAME"
>site.exp</TT
> files have
two sections, separated by comment text. The first section is
the part that is generated by <B
CLASS="COMMAND"
>make</B
>. It is
essentially a collection of Tcl variable definitions based on
<TT
CLASS="FILENAME"
>Makefile</TT
> environment variables. Since they
are generated by <B
CLASS="COMMAND"
>make</B
>, they contain the
values as specified by <B
CLASS="COMMAND"
>configure</B
>. (You can
also customize these values by using the <TT
CLASS="OPTION"
>--site</TT
>
option to <B
CLASS="COMMAND"
>configure</B
>.) In particular, this
section contains the <TT
CLASS="FILENAME"
>Makefile</TT
>
variables for host and target configuration data. Do not edit
this first section; if you do, your changes are replaced next
time you run <B
CLASS="COMMAND"
>make</B
>.</P
><DIV
CLASS="EXAMPLE"
><A
NAME="AEN896"
></A
><P
><B
>Example 1. The first section starts with</B
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="PROGRAMLISTING"
> ## these variables are automatically generated by make ##
# Do not edit here. If you wish to override these values
# add them to the last section
</PRE
></TD
></TR
></TABLE
></DIV
><P
>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 <B
CLASS="COMMAND"
>runtest</B
>. This allows you to
easily customize <B
CLASS="COMMAND"
>runtest</B
> 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.)</P
><DIV
CLASS="EXAMPLE"
><A
NAME="AEN902"
></A
><P
><B
>Example 2. The first section ends with this line</B
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="PROGRAMLISTING"
> ## All variables above are generated by configure. Do Not Edit ##
</PRE
></TD
></TR
></TABLE
></DIV
><P
>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 config file are related to the configuration of
the test run. This is the ideal place to set the variables
<SPAN
CLASS="SYMBOL"
>host_triplet</SPAN
>, <SPAN
CLASS="SYMBOL"
>build_triplet</SPAN
>,
<SPAN
CLASS="SYMBOL"
>target_triplet</SPAN
>. All other variables are tool
dependant, i.e., for testing a compiler, the value for
<SPAN
CLASS="SYMBOL"
>CC</SPAN
> might be set to a freshly built binary, as
opposed to one in the user's path.</P
><P
>Here's an example local site.exp file, as used for
<SPAN
CLASS="PRODUCTNAME"
>GCC/G++</SPAN
> testing.</P
><DIV
CLASS="EXAMPLE"
><A
NAME="AEN912"
></A
><P
><B
>Example 3. Local Config File</B
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="PROGRAMLISTING"
> ## 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/i586-pc-linux-gnulibc1/gcc"
set host_triplet i586-pc-linux-gnulibc1
set build_triplet i586-pc-linux-gnulibc1
set target_triplet i586-pc-linux-gnulibc1
set target_alias i586-pc-linux-gnulibc1
set CFLAGS ""
set CXXFLAGS "-isystem /build/devo-builds/i586-pc-linux-gnulibc1/gcc/../libio -isystem $srcdir/../libg++/src -isystem $srcdir/../libio -isystem $srcdir/../libstdc++ -isystem $srcdir/../libstdc++/stl -L/build/devo-builds/i586-pc-linux-gnulibc1/gcc/../libg++ -L/build/devo-builds/i586-pc-linux-gnulibc1/gcc/../libstdc++"
append LDFLAGS " -L/build/devo-builds/i586-pc-linux-gnulibc1/gcc/../ld"
set tmpdir /build/devo-builds/i586-pc-linux-gnulibc1/gcc/testsuite
set srcdir "${srcdir}/testsuite"
## All variables above are generated by configure. Do Not Edit ##
</PRE
></TD
></TR
></TABLE
></DIV
><P
>This file defines the required fields for a local config
file, namely the three config triplets, and the srcdir. It also
defines several other Tcl variables that are used exclusivly 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.</P
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="x755.html"
ACCESSKEY="P"
>&#60;&#60;&#60; Previous</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="book1.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="x916.html"
ACCESSKEY="N"
>Next &#62;&#62;&#62;</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>The files DejaGnu produces.</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Global Config File</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>