blob: 4c1d107b75db8129a7fe1b8bec7328ef01e37e1d [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<HTML
><HEAD
><TITLE
>Runtest</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
"><LINK
REL="HOME"
TITLE="DejaGnu"
HREF="book1.html"><LINK
REL="UP"
TITLE="Running Tests"
HREF="c401.html"><LINK
REL="PREVIOUS"
TITLE="Running Tests"
HREF="c401.html"><LINK
REL="NEXT"
TITLE="The files DejaGnu produces."
HREF="x755.html"></HEAD
><BODY
CLASS="SECT1"
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="c401.html"
ACCESSKEY="P"
>&#60;&#60;&#60; Previous</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Running Tests</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="x755.html"
ACCESSKEY="N"
>Next &#62;&#62;&#62;</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="RUNTEST"
></A
>Runtest</H1
><P
><B
CLASS="COMMAND"
>runtest</B
> is the executable test driver
for DejaGnu. You can specify two kinds of things on the
<B
CLASS="COMMAND"
>runtest</B
> command line: command line options,
and Tcl variables for the test scripts. The options are listed
alphabetically below.</P
><P
><B
CLASS="COMMAND"
>runtest</B
> returns an exit code of
<I
CLASS="EMPHASIS"
>1</I
> if any test has an unexpected result; otherwise
(if all tests pass or fail as expected) it returns <I
CLASS="EMPHASIS"
>0</I
>
as the exit code.</P
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="OUTPUTS"
></A
>Output States</H2
><P
><TT
CLASS="FILENAME"
>runtest</TT
> flags the outcome of each
test as one of these cases. <A
HREF="x134.html"
>A POSIX Conforming Test Framework</A
> for a
discussion of how POSIX specifies the meanings of these
cases.</P
><P
></P
><DIV
CLASS="VARIABLELIST"
><DL
><DT
>PASS</DT
><DD
><P
>The most desirable outcome: the test succeeded, and
was expected to succeed.</P
></DD
><DT
>XPASS</DT
><DD
><P
>A pleasant kind of failure: a test was expected to
fail, but succeeded. This may indicate progress; inspect the test
case to determine whether you should amend it to stop expecting
failure.</P
></DD
><DT
>FAIL</DT
><DD
><P
>A test failed, although it was expected to succeed.
This may indicate regress; inspect the test case and the failing
software to ocate the bug.</P
></DD
><DT
>XFAIL</DT
><DD
><P
>A test failed, but it was expected to fail. This
result indicates no change in a known bug. If a test fails because
the operating system where the test runs lacks some facility required
by the test, the outcome is <I
CLASS="EMPHASIS"
>UNSUPPORTED</I
>
instead.</P
></DD
><DT
>UNRESOLVED</DT
><DD
><P
>Output from a test requires manual inspection; the
testsuite could not automatically determine the outcome. For
example, your tests can report this outcome is when a test does not
complete as expected.</P
></DD
><DT
>UNTESTED</DT
><DD
><P
>A test case is not yet complete, and in particular
cannot yet produce a <I
CLASS="EMPHASIS"
>PASS</I
> or
<I
CLASS="EMPHASIS"
>FAIL</I
>. You can also use this outcome in dummy
``tests'' that note explicitly the absence of a real test case for a
particular property.</P
></DD
><DT
>UNSUPPORTED</DT
><DD
><P
>A test depends on a conditionally available feature
that does not exist (in the configured testing environment). For
example, you can use this outcome to report on a test case that does
not work on a particular target because its operating system support
does not include a required subroutine.</P
></DD
></DL
></DIV
><P
>runtest may also display the following messages:</P
><P
></P
><DIV
CLASS="VARIABLELIST"
><DL
><DT
>ERROR</DT
><DD
><P
>Indicates a major problem (detected by the test case
itself) in running the test. This is usually an unrecoverable error,
such as a missing file or loss of communication to the target. (POSIX
testsuites should not emit this message; use
<I
CLASS="EMPHASIS"
>UNSUPPORTED</I
>, <I
CLASS="EMPHASIS"
>UNTESTED</I
>, or
<I
CLASS="EMPHASIS"
>UNRESOLVED</I
> instead, as
appropriate.)</P
></DD
><DT
>WARNING</DT
><DD
><P
>Indicates a possible problem in running the
test. Usually warnings correspond to recoverable errors, or display
an important message about the following tests.</P
></DD
><DT
>NOTE</DT
><DD
><P
>An informational message about the test
case.</P
></DD
></DL
></DIV
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="INVOKING"
></A
>Invoking Runtest</H2
><P
>This is the full set of command line options that
<TT
CLASS="FILENAME"
>runtest</TT
> recognizes. Arguments may be
abbreviated to the shortest unique string.</P
><P
></P
><DIV
CLASS="VARIABLELIST"
><DL
><DT
><TT
CLASS="OPTION"
>--all</TT
> (-a)</DT
><DD
><P
>Display all test output. By default,
<I
CLASS="EMPHASIS"
>runtest</I
> shows only the output of tests that
produce unexpected results; that is, tests with status
<I
CLASS="EMPHASIS"
>FAIL</I
> (unexpected failure),
<I
CLASS="EMPHASIS"
>XPASS</I
> (unexpected success), or
<I
CLASS="EMPHASIS"
>ERROR</I
> (a severe error in the test case
itself). Specify <I
CLASS="EMPHASIS"
>--all</I
> to see output for tests
with status <I
CLASS="EMPHASIS"
>PASS</I
> (success, as expected)
<I
CLASS="EMPHASIS"
>XFAIL</I
> (failure, as expected), or
<I
CLASS="EMPHASIS"
>WARNING</I
> (minor error in the test case
itself).</P
></DD
><DT
><TT
CLASS="OPTION"
>--build [string]</TT
></DT
><DD
><P
><I
CLASS="EMPHASIS"
>string</I
> is a full configuration
``triple'' name as used by <B
CLASS="COMMAND"
>configure</B
>. This
is the type of machine DejaGnu and the tools to be tested are built
on. For a normal cross this is the same as the host, but for a
canadian cross, they are seperate.</P
></DD
><DT
><TT
CLASS="OPTION"
>--host [string]</TT
></DT
><DD
><P
><SPAN
CLASS="SYMBOL"
>string</SPAN
> is a full configuration
``triple'' name as used by <I
CLASS="EMPHASIS"
>configure</I
>. Use this
option to override the default string recorded by your
configuration's choice of host. This choice does not change how
anything is actually configured unless --build is also specified; it
affects <I
CLASS="EMPHASIS"
>only</I
> DejaGnu procedures that compare the
host string with particular values. The procedures
<I
CLASS="EMPHASIS"
>ishost</I
>, <I
CLASS="EMPHASIS"
>istarget</I
>,
<I
CLASS="EMPHASIS"
>isnative</I
>, and <I
CLASS="EMPHASIS"
>setup</I
>xfail}
are affected by <I
CLASS="EMPHASIS"
>--host</I
>. In this usage,
<I
CLASS="EMPHASIS"
>host</I
> refers to the machine that the tests are to
be run on, which may not be the same as the
<I
CLASS="EMPHASIS"
>build</I
> machine. If <I
CLASS="EMPHASIS"
>--build</I
>
is also specified, then <I
CLASS="EMPHASIS"
>--host</I
> refers to the
machine that the tests wil, be run on, not the machine DejaGnu is run
on.</P
></DD
><DT
><TT
CLASS="OPTION"
>--host_board [name]</TT
></DT
><DD
><P
>The host board to use.</P
></DD
><DT
><TT
CLASS="OPTION"
>--target [string]</TT
></DT
><DD
><P
>Use this option to override the default setting
(running native tests). <I
CLASS="EMPHASIS"
>string</I
> is a full
configuration ``triple'' name of the form
<I
CLASS="EMPHASIS"
>cpu-vendor-os</I
> as used by
<B
CLASS="COMMAND"
>configure</B
>. This option changes the
configuration <I
CLASS="EMPHASIS"
>runtest</I
> uses for the default tool
names, and other setup information.</P
></DD
><DT
><TT
CLASS="OPTION"
>--debug</TT
> (-de)</DT
><DD
><P
>Turns on the <I
CLASS="EMPHASIS"
>expect</I
> internal
debugging output. Debugging output is displayed as part of the
<I
CLASS="EMPHASIS"
>runtest</I
> output, and logged to a file called
<TT
CLASS="FILENAME"
>dbg.log</TT
>. The extra debugging output does
<I
CLASS="EMPHASIS"
>not</I
> appear on standard output, unless the
verbose level is greater than 2 (for instance, to see debug output
immediately, specify <I
CLASS="EMPHASIS"
>--debug</I
>-v -v}). The
debugging output shows all attempts at matching the test output of
the tool with the scripted patterns describing expected output. The
output generated with <I
CLASS="EMPHASIS"
>--strace</I
> also goes into
<TT
CLASS="FILENAME"
>dbg.log</TT
>.</P
></DD
><DT
><TT
CLASS="OPTION"
>--help</TT
> (-he)</DT
><DD
><P
>Prints out a short summary of the
<I
CLASS="EMPHASIS"
>runtest</I
> options, then exits (even if you also
specify other options).</P
></DD
><DT
><TT
CLASS="OPTION"
>--ignore [name(s)] </TT
></DT
><DD
><P
>The names of specific tests to
ignore.</P
></DD
><DT
><TT
CLASS="OPTION"
>--objdir [path]</TT
></DT
><DD
><P
>Use <I
CLASS="EMPHASIS"
>path</I
> as the top directory
containing any auxiliary compiled test code. This defaults to
<TT
CLASS="FILENAME"
>.</TT
>. Use this option to locate pre-compiled test
code. You can normally prepare any auxiliary files needed with
<I
CLASS="EMPHASIS"
>make</I
>.</P
></DD
><DT
><TT
CLASS="OPTION"
>--outdir [path]</TT
></DT
><DD
><P
>Write output logs in directory
<TT
CLASS="FILENAME"
>path</TT
>. The default is <I
CLASS="EMPHASIS"
>.},
the</I
> directory where you start
<I
CLASS="EMPHASIS"
>runtest</I
>. This option affects only the summary
and the detailed log files
<TT
CLASS="FILENAME"
>tool.sum</TT
> and
<TT
CLASS="FILENAME"
>tool.log</TT
>. The DejaGnu debug
log <TT
CLASS="FILENAME"
>dbg.log</TT
> always appears (when requested) in
the local directory.</P
></DD
><DT
><TT
CLASS="OPTION"
>--reboot [name]</TT
></DT
><DD
><P
>Reboot the target board when
<I
CLASS="EMPHASIS"
>runtest</I
> initializes. Usually, when running tests
on a separate target board, it is safer to reboot the target to be
certain of its state. However, when developing test scripts,
rebooting takes a lot of time.</P
></DD
><DT
><TT
CLASS="OPTION"
>--srcdir [path]</TT
></DT
><DD
><P
>Use <TT
CLASS="FILENAME"
>path</TT
> as the top directory
for test scripts to run. <I
CLASS="EMPHASIS"
>runtest</I
> looks in this
directory for any subdirectory whose name begins with the toolname
(specified with <I
CLASS="EMPHASIS"
>--tool</I
>). For instance, with
<I
CLASS="EMPHASIS"
>--tool</I
>gdb}, <I
CLASS="EMPHASIS"
>runtest</I
> uses
tests in subdirectories <TT
CLASS="FILENAME"
>gdb.*</TT
> (with the usual
shell-like filename expansion). If you do not use
<I
CLASS="EMPHASIS"
>--srcdir</I
>, <I
CLASS="EMPHASIS"
>runtest</I
> looks for
test directories under the current working
directory.</P
></DD
><DT
><TT
CLASS="OPTION"
>--strace [number]</TT
></DT
><DD
><P
>Turn on internal tracing for
<I
CLASS="EMPHASIS"
>expect</I
>, to n levels deep. By adjusting the
level, you can control the extent to which your output expands
multi-level Tcl statements. This allows you to ignore some levels of
<I
CLASS="EMPHASIS"
>case</I
> or <I
CLASS="EMPHASIS"
>if</I
> statements.
Each procedure call or control structure counts as one ``level''. The
output is recorded in the same file, <TT
CLASS="FILENAME"
>dbg.log</TT
>,
used for output from <I
CLASS="EMPHASIS"
>--debug</I
>.</P
></DD
><DT
><TT
CLASS="OPTION"
>--connect [program]</TT
></DT
><DD
><P
>Connect to a target testing environment as specified
by <I
CLASS="EMPHASIS"
>type</I
>, if the target is not the computer
running <I
CLASS="EMPHASIS"
>runtest</I
>. For example, use
<I
CLASS="EMPHASIS"
>--connect</I
> to change the program used to connect
to a ``bare board'' boot monitor. The choices for
<I
CLASS="EMPHASIS"
>type</I
> in the DejaGnu 1.4 distribution are
<I
CLASS="EMPHASIS"
>rlogin</I
>, <I
CLASS="EMPHASIS"
>telnet</I
>,
<I
CLASS="EMPHASIS"
>rsh</I
>, <I
CLASS="EMPHASIS"
>tip</I
>,
<I
CLASS="EMPHASIS"
>kermit</I
>, and <I
CLASS="EMPHASIS"
>mondfe</I
>.</P
><P
>The default for this option depends on the configuration most
convenient communication method available, but often other
alternatives work as well; you may find it useful to try alternative
connect methods if you suspect a communication problem with your
testing target.</P
></DD
><DT
><TT
CLASS="OPTION"
>--baud [number]</TT
></DT
><DD
><P
>Set the default baud rate to something other than
9600. (Some serial interface programs, like <I
CLASS="EMPHASIS"
>tip</I
>,
use a separate initialization file instead of this
value.)</P
></DD
><DT
><TT
CLASS="OPTION"
>--target_board [name(s)]</TT
></DT
><DD
><P
>The list of target boards to run tests
on.</P
></DD
><DT
><A
NAME="TOOL-OPT"
></A
><TT
CLASS="OPTION"
>--tool[name(s)]</TT
></DT
><DD
><P
>Specifies which testsuite to run, and what
initialization module to use. <TT
CLASS="OPTION"
>--tool</TT
> is used
<I
CLASS="EMPHASIS"
>only</I
> for these two purposes. It is
<I
CLASS="EMPHASIS"
>not</I
> used to name the executable program to
test. Executable tool names (and paths) are recorded in
<TT
CLASS="FILENAME"
>site.exp</TT
> and you can override them by specifying
Tcl variables on the command line.</P
><P
>For example, including "<TT
CLASS="OPTION"
>--tool</TT
> gcc" on the
<I
CLASS="EMPHASIS"
>runtest</I
> command line runs tests from all test
subdirectories whose names match <TT
CLASS="FILENAME"
>gcc.*</TT
>, and uses
one of the initialization modules named
<TT
CLASS="FILENAME"
>config/*-gcc.exp</TT
>. To specify the name of the
compiler (perhaps as an alternative path to what
<I
CLASS="EMPHASIS"
>runtest</I
> would use by default), use
<I
CLASS="EMPHASIS"
>GCC=binname</I
> on the <I
CLASS="EMPHASIS"
>runtest</I
>
command line.</P
></DD
><DT
><TT
CLASS="OPTION"
>--tool_exec [name]</TT
></DT
><DD
><P
>The path to the tool executable to
test.</P
></DD
><DT
><TT
CLASS="OPTION"
>--tool_opts [options]</TT
></DT
><DD
><P
>A list of additional options to pass to the
tool.</P
></DD
><DT
><TT
CLASS="OPTION"
>--verbose</TT
> (-v)</DT
><DD
><P
>Turns on more output. Repeating this option increases
the amount of output displayed. Level one (<I
CLASS="EMPHASIS"
>-v</I
>)
is simply test output. Level two (<I
CLASS="EMPHASIS"
>-v</I
>-v}) shows
messages on options, configuration, and process control. Verbose
messages appear in the detailed (<TT
CLASS="FILENAME"
>*.log</TT
>) log
file, but not in the summary (<TT
CLASS="FILENAME"
>*.sum</TT
>) log
file.</P
></DD
><DT
><TT
CLASS="OPTION"
>--version</TT
> (-V)</DT
><DD
><P
>Prints out the version numbers of DejaGnu,
<I
CLASS="EMPHASIS"
>expect</I
> and Tcl, and exits without running any
tests.</P
></DD
><DT
><TT
CLASS="OPTION"
>--D[0-1]</TT
></DT
><DD
><P
>Start the internal Tcl debugger. The Tcl debugger
supports breakpoints, single stepping, and other common debugging
activities. See the document "Debugger for Tcl Applications" by Don
Libes. (Distributed in PostScript form with
<I
CLASS="EMPHASIS"
>expect</I
> as the file
<TT
CLASS="FILENAME"
>expect/tcl-debug.ps.</TT
>. If you specify
<I
CLASS="EMPHASIS"
>-D1</I
>, the <I
CLASS="EMPHASIS"
>expect</I
> shell stops
at a breakpoint as soon as DejaGnu invokes it. If you specify
<I
CLASS="EMPHASIS"
>-D0</I
>, DejaGnu starts as usual, but you can enter
the debugger by sending an interrupt (e.g. by typing
<B
CLASS="KEYCAP"
>C</B
>-<B
CLASS="KEYCAP"
>c</B
>).
</P
></DD
><DT
><TT
CLASS="FILENAME"
>testfile</TT
>.exp[=arg(s)]</DT
><DD
><P
>Specify the names of testsuites to run. By default,
<I
CLASS="EMPHASIS"
>runtest</I
> runs all tests for the tool, but you can
restrict it to particular testsuites by giving the names of the
<I
CLASS="EMPHASIS"
>.exp expect</I
> scripts that control
them. <I
CLASS="EMPHASIS"
>testsuite</I
>.exp may not include path
information; use plain filenames.</P
></DD
><DT
><TT
CLASS="FILENAME"
>testfile</TT
>.exp="testfile1 ..."</DT
><DD
><P
>Specify a subset of tests in a suite to run. For
compiler or assembler tests, which often use a single
<I
CLASS="EMPHASIS"
>.exp</I
> script covering many different source
files, this option allows you to further restrict the tests by
listing particular source files to compile. Some tools even support
wildcards here. The wildcards supported depend upon the tool, but
typically they are <I
CLASS="EMPHASIS"
>?</I
>, <I
CLASS="EMPHASIS"
>*</I
>,
and <I
CLASS="EMPHASIS"
>[chars]</I
>.</P
></DD
><DT
><SPAN
CLASS="SYMBOL"
>tclvar</SPAN
>=value</DT
><DD
><P
>You can define Tcl variables for use by your test
scripts in the same style used with <I
CLASS="EMPHASIS"
>make</I
> for
environment variables. For example, <I
CLASS="EMPHASIS"
>runtest
GDB=gdb.old</I
> defines a variable called
<B
CLASS="COMMAND"
>GDB</B
>; when your scripts refer to
<SPAN
CLASS="SYMBOL"
>$GDB</SPAN
> in this run, they use the value
<I
CLASS="EMPHASIS"
>gdb.old</I
>.</P
><P
>The default Tcl variables used for most tools are defined in
the main DejaGnu <I
CLASS="EMPHASIS"
>Makefile</I
>; their values are
captured in the <TT
CLASS="FILENAME"
>site.exp</TT
> file.</P
></DD
></DL
></DIV
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="COMMON"
></A
>Common Options</H2
><P
>Typically, you don't need must to use any command-line options.
<TT
CLASS="OPTION"
>--tool</TT
> used is only required when there are more than
one testsuite in the same directory. The default options are in the
local site.exp file, created by "make site.exp".</P
><P
>For example, if the directory <TT
CLASS="FILENAME"
>gdb/testsuite</TT
>
contains a collection of DejaGnu tests for GDB, you can run them like
this:</P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="SCREEN"
> eg$ cd gdb/testsuite
eg$ runtest --tool gdb
</PRE
></TD
></TR
></TABLE
><P
>Test output follows, ending with:</P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="SCREEN"
> === gdb Summary ===
# of expected passes 508
# of expected failures 103
/usr/latest/bin/gdb version 4.14.4 -nx
</PRE
></TD
></TR
></TABLE
><P
>You can use the option <I
CLASS="EMPHASIS"
>--srcdir</I
> to point to
some other directory containing a collection of tests:</P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="SCREEN"
> eg$ runtest--srcdir /devo/gdb/testsuite
</PRE
></TD
></TR
></TABLE
><P
>By default, <B
CLASS="COMMAND"
>runtest</B
> prints only the
names of the tests it runs, output from any tests that have unexpected
results, and a summary showing how many tests passed and how many
failed. To display output from all tests (whether or not they behave
as expected), use the <I
CLASS="EMPHASIS"
>--all</I
> option. For more
verbose output about processes being run, communication, and so on, use
<I
CLASS="EMPHASIS"
>--verbose</I
>. To see even more output, use multiple
<I
CLASS="EMPHASIS"
>--verbose</I
> options. for a more detailed explanation
of each <B
CLASS="COMMAND"
>runtest</B
> option.</P
><P
>Test output goes into two files in your current directory:
summary output in <TT
CLASS="FILENAME"
>tool.sum</TT
>,
and detailed output in <TT
CLASS="FILENAME"
> tool.log</TT
>. (<I
CLASS="EMPHASIS"
>tool</I
>
refers to the collection of tests; for example, after a run with
<I
CLASS="EMPHASIS"
>--tool</I
> gdb, look for output files
<TT
CLASS="FILENAME"
>gdb.sum</TT
> and
<TT
CLASS="FILENAME"
>gdb.log</TT
>.)</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="c401.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="x755.html"
ACCESSKEY="N"
>Next &#62;&#62;&#62;</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Running Tests</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="c401.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>The files DejaGnu produces.</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>