From 7017c2a06836be28bdbc2b4135f19fa122fee8fd Mon Sep 17 00:00:00 2001 From: Jacob Bachmeyer Date: Thu, 24 Jan 2019 14:27:26 +1100 Subject: * doc/dejagnu.texi: Refill paragraphs and normalize inter-sentence spacing so the Emacs move-by-sentence commands work correctly. Signed-off-by: Ben Elliston --- ChangeLog | 5 + doc/dejagnu.texi | 1947 +++++++++++++++++++++++++++--------------------------- 2 files changed, 992 insertions(+), 960 deletions(-) diff --git a/ChangeLog b/ChangeLog index ee1ab44..aae62a7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2019-01-24 Jacob Bachmeyer + + * doc/dejagnu.texi: Refill paragraphs and normalize inter-sentence + spacing so the Emacs move-by-sentence commands work correctly. + 2019-01-23 Ben Elliston * doc/dejagnu.texi: Replace "config file" with "configuration diff --git a/doc/dejagnu.texi b/doc/dejagnu.texi index 6b07ac8..92383b2 100644 --- a/doc/dejagnu.texi +++ b/doc/dejagnu.texi @@ -16,8 +16,8 @@ Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover -Texts. A copy of the license is included in the section entitled ``GNU -Free Documentation License''. +Texts. A copy of the license is included in the section entitled +``GNU Free Documentation License''. @c man end @end copying @@ -137,18 +137,18 @@ Indices @section What is DejaGnu? DejaGnu is a framework for testing other programs, providing a single -front-end for all tests. You can think of it as a library of Tcl -procedures to help with writing a test harness. A @emph{test harness} is -the infrastructure that is created to test a specific program or -tool. Each program can have multiple testsuites, all supported by a -single test harness. DejaGnu is written in Expect, which in turn uses -Tcl, the Tool command language. There is more information on Tcl at the -@uref{http://www.tcl.tk,Tcl/Tk web site} and the +front-end for all tests. You can think of it as a library of Tcl +procedures to help with writing a test harness. A @emph{test harness} +is the infrastructure that is created to test a specific program or +tool. Each program can have multiple testsuites, all supported by a +single test harness. DejaGnu is written in Expect, which in turn uses +Tcl, the Tool command language. There is more information on Tcl at +the @uref{http://www.tcl.tk,Tcl/Tk web site} and the @uref{http://expect.nist.gov,Expect web site}. Julia Menapace first coined the term @emph{DejaGnu} to describe an -earlier testing framework she wrote at Cygnus Support for testing -GDB. When we replaced it with the Expect-based framework, it was like +earlier testing framework she wrote at Cygnus Support for testing GDB. +When we replaced it with the Expect-based framework, it was like DejaGnu all over again. More importantly, it was also named after my daughter, Deja Snow Savoye, who was a toddler during DejaGnu's beginnings. @@ -163,31 +163,31 @@ write tests for any program, with either batch-oriented, or interactive programs. @item -DejaGnu provides a layer of abstraction which allows you to write tests -that are portable to any host or target where a program must be -tested. For instance, a test for @code{GDB} can run from any supported -host system on any supported target system. DejaGnu runs tests on many -single board computers, whose operating software ranges from a simple -boot monitor to a real-time OS. +DejaGnu provides a layer of abstraction which allows you to write +tests that are portable to any host or target where a program must be +tested. For instance, a test for @code{GDB} can run from any +supported host system on any supported target system. DejaGnu runs +tests on many single board computers, whose operating software ranges +from a simple boot monitor to a real-time OS. @item -All tests have the same output format. This makes it easy to integrate -testing into other software development processes. DejaGnu's output is -designed to be parsed by other filtering script and it is also human -readable. +All tests have the same output format. This makes it easy to +integrate testing into other software development processes. +DejaGnu's output is designed to be parsed by other filtering script +and it is also human readable. @item Using Tcl and Expect, it's easy to create wrappers for existing -testsuites. By incorporating existing tests under DejaGnu, it's easier -to have a single set of report analyse programs.. +testsuites. By incorporating existing tests under DejaGnu, it's +easier to have a single set of report analyse programs.. @end itemize Running tests requires two things: the testing framework and the -testsuites themselves. Tests are usually written in Expect using Tcl, +testsuites themselves. Tests are usually written in Expect using Tcl, but you can also use a Tcl script to run a testsuite that is not based -on Expect. Expect script filenames conventionally use @file{.exp} as a -suffix. For example, the main implementation of the DejaGnu test driver -is in the file @file{runtest.exp}. +on Expect. Expect script filenames conventionally use @file{.exp} as +a suffix. For example, the main implementation of the DejaGnu test +driver is in the file @file{runtest.exp}. @node Release Notes, Design goals, What is DejaGnu?, Introduction @section New in this release @@ -202,45 +202,45 @@ Support for target communication via SSH has been added. @item A large number of very old config and baseboard files have been - removed. If you need to resurrect these, you can get them from - version 1.5.3. If you can show that a board is still in use, it can - be put back in the distribution. +removed. If you need to resurrect these, you can get them from +version 1.5.3. If you can show that a board is still in use, it can +be put back in the distribution. @item -The @command{--status} command line option is now the default. This - means that any error in the testsuite Tcl scripts will cause runtest - to abort with exit status code 2. The @command{--status} option has - been removed from the documentation, but will continue to be accepted - for backward compatibility. +The @command{--status} command line option is now the default. This +means that any error in the testsuite Tcl scripts will cause runtest +to abort with exit status code 2. The @command{--status} option has +been removed from the documentation, but will continue to be accepted +for backward compatibility. @item -@command{runtest} now exits with exit code 0 if the testsuite "passed", - 1 if something unexpected happened (eg, FAIL, XPASS or UNRESOLVED), - and 2 if an exception is raised by the Tcl interpreter. +@command{runtest} now exits with exit code 0 if the testsuite +"passed", 1 if something unexpected happened (eg, FAIL, XPASS or +UNRESOLVED), and 2 if an exception is raised by the Tcl interpreter. @item -@command{runtest} now exits with the standard exit codes of programs that - are terminated by the SIGINT, SIGTERM and SIGQUIT signals. +@command{runtest} now exits with the standard exit codes of programs +that are terminated by the SIGINT, SIGTERM and SIGQUIT signals. @item -The user-visible utility procedures @code{absolute}, @code{psource} and - @code{slay} have been removed. If a testsuite uses any of these - procedures, a copy of the procedure should be made and placed in the - lib directory of the testsuite. +The user-visible utility procedures @code{absolute}, @code{psource} +and @code{slay} have been removed. If a testsuite uses any of these +procedures, a copy of the procedure should be made and placed in the +lib directory of the testsuite. @item Support was added for testing the D compiler. @item -@file{~/.dejagnurc} is now loaded last, not first. This allows the user - to have the ability to override anything in their environment (even - the @file{site.exp} file specified by @code{$DEJAGNU}). +@file{~/.dejagnurc} is now loaded last, not first. This allows the +user to have the ability to override anything in their environment +(even the @file{site.exp} file specified by @code{$DEJAGNU}). @item The user-visible utility procedure @code{unsetenv} is - @strong{deprecated} and will be removed in the next release. If a - testsuite uses this procedure, a copy should be made and placed in - the lib directory of the testsuite. +@strong{deprecated} and will be removed in the next release. If a +testsuite uses this procedure, a copy should be made and placed in the +lib directory of the testsuite. @end enumerate @@ -249,8 +249,9 @@ The user-visible utility procedure @code{unsetenv} is @cindex design goals DejaGnu grew out of the internal needs of Cygnus Solutions (formerly -Cygnus Support). Cygnus maintained and enhanced a variety of free -programs in many different environments and needed a testing tool that: +Cygnus Support). Cygnus maintained and enhanced a variety of free +programs in many different environments and needed a testing tool +that: @itemize @@ -274,56 +275,57 @@ permitted testing of batch-oriented programs like @code{GCC}. @end itemize Some of the requirements proved challenging. For example, interactive -programs do not lend themselves very well to automated testing. But all -the requirements are important. For instance, it is imperative to make -sure that @code{GDB} works as well when cross-debugging as it does in a -native configuration. +programs do not lend themselves very well to automated testing. But +all the requirements are important. For instance, it is imperative to +make sure that @code{GDB} works as well when cross-debugging as it +does in a native configuration. Probably the greatest challenge was testing in a cross-development -environment. Most cross-development environments are customized by each -developer. Even when buying packaged boards from vendors there are many -differences. The communication interfaces vary from a serial line to -Ethernet. DejaGnu was designed with a modular communication setup, so -that each kind of communication can be added as required and supported -thereafter. Once a communication procedure is written, any test can use -it. Currently DejaGnu can use @code{ssh}, @code{rsh}, @code{rlogin}, -@code{telnet}, @code{tip}, and @code{kermit} for remote communications. +environment. Most cross-development environments are customized by +each developer. Even when buying packaged boards from vendors there +are many differences. The communication interfaces vary from a serial +line to Ethernet. DejaGnu was designed with a modular communication +setup, so that each kind of communication can be added as required and +supported thereafter. Once a communication procedure is written, any +test can use it. Currently DejaGnu can use @code{ssh}, @code{rsh}, +@code{rlogin}, @code{telnet}, @code{tip}, and @code{kermit} for remote +communications. @node A POSIX Conforming Test Framework, Installation, Design goals, Introduction @section A POSIX compliant test framework @cindex POSIX compliant test framework @cindex POSIX 1003.3 -DejaGnu conforms to the POSIX 1003.3 standard for test frameworks. Rob -Savoye was a member of that committee. +DejaGnu conforms to the POSIX 1003.3 standard for test frameworks. +Rob Savoye was a member of that committee. -POSIX standard 1003.3 defines what a testing framework needs to provide -to create a POSIX compliant testsuite. This standard is primarily -oriented to checking POSIX conformance, but its requirements also -support testing of features not related to POSIX conformance. POSIX -1003.3 does not specify a particular testing framework, but at this time -there is only one other POSIX conforming test framework. TET was created -by Unisoft for a consortium comprised of X/Open, Unix International and -the Open Software Foundation. +POSIX standard 1003.3 defines what a testing framework needs to +provide to create a POSIX compliant testsuite. This standard is +primarily oriented to checking POSIX conformance, but its requirements +also support testing of features not related to POSIX conformance. +POSIX 1003.3 does not specify a particular testing framework, but at +this time there is only one other POSIX conforming test framework. +TET was created by Unisoft for a consortium comprised of X/Open, Unix +International and the Open Software Foundation. @cindex assertions The POSIX documentation refers to @dfn{assertions}. An assertion is a description of behavior. For example, if a standard says ``The sun shall shine'', a corresponding assertion might be ``The sun is -shining.'' A test based on this assertion would pass or fail depending -on whether it is day or night. It is important to note that the -standard being tested is never 1003.3; the standard being tested is some -other standard, for which the assertions were written. +shining.'' A test based on this assertion would pass or fail +depending on whether it is day or night. It is important to note that +the standard being tested is never 1003.3; the standard being tested +is some other standard, for which the assertions were written. As there is no testsuite to verify that testing frameworks are POSIX 1003.3 compliant, this is done by repeatedly reading the standard and -experimenting. One of the main things POSIX 1003.3 does specify is the -set of allowed output messages and their definitions. Four messages are -supported for a required feature of POSIX conforming systems and a fifth -for a conditional feature. DejaGnu supports all five output messages. -In this sense a testsuite that uses exactly these messages can be -considered POSIX compliant. These definitions specify the output of a -test case: +experimenting. One of the main things POSIX 1003.3 does specify is +the set of allowed output messages and their definitions. Four +messages are supported for a required feature of POSIX conforming +systems and a fifth for a conditional feature. DejaGnu supports all +five output messages. In this sense a testsuite that uses exactly +these messages can be considered POSIX compliant. These definitions +specify the output of a test case: @table @asis @@ -334,7 +336,7 @@ true. @item FAIL A test has not succeeded -- the assertion is false. The @emph{FAIL} message is based on this test case only. Other messages are used to -indicate a failure of the framework. As with @emph{PASS}, POSIX tests +indicate a failure of the framework. As with @emph{PASS}, POSIX tests must return @emph{FAIL} rather than @emph{XFAIL} even if a failure was expected. @@ -342,27 +344,27 @@ expected. POSIX 1003.3 does not incorporate the notion of expected failures, so @emph{PASS}, instead of @emph{XPASS}, must also be returned for test cases which were expected to fail and did not. This means that -@emph{PASS} is in some sense more ambiguous than if @emph{XPASS} is also -used. +@emph{PASS} is in some sense more ambiguous than if @emph{XPASS} is +also used. @item UNRESOLVED A test produced indeterminate results. Usually, this means the test -executed in an unexpected fashion. This outcome requires a human to go -over results to determine if the test should have passed or failed. -This message is also used for any test that requires human intervention -because it is beyond the abilities of the testing framework. Any -unresolved test should resolved to @emph{PASS} or @emph{FAIL} before a -test run can be considered finished. +executed in an unexpected fashion. This outcome requires a human to +go over results to determine if the test should have passed or failed. +This message is also used for any test that requires human +intervention because it is beyond the abilities of the testing +framework. Any unresolved test should resolved to @emph{PASS} or +@emph{FAIL} before a test run can be considered finished. -Note that for POSIX, each assertion must produce a test result code. If -the test isn't actually run, it must produce @emph{UNRESOLVED} rather -than just leaving that test out of the output. This means that you have -to be careful when writing tests to not carelessly use Tcl commands like -@emph{return}---if you alter the flow of control of the Tcl code you -must insure that every test still produces some result code. +Note that for POSIX, each assertion must produce a test result code. +If the test isn't actually run, it must produce @emph{UNRESOLVED} +rather than just leaving that test out of the output. This means that +you have to be careful when writing tests to not carelessly use Tcl +commands like @emph{return}---if you alter the flow of control of the +Tcl code you must insure that every test still produces some result +code. -Here are some of the ways a test may wind up -@emph{UNRESOLVED}: +Here are some of the ways a test may wind up @emph{UNRESOLVED}: @end table @itemize @@ -371,12 +373,12 @@ Here are some of the ways a test may wind up Execution of a test is interrupted. @item -A test does not produce a clear result. This is usually because there +A test does not produce a clear result. This is usually because there was an @emph{ERROR} from DejaGnu while processing the test, or because -there were three or more @emph{WARNING} messages. Any @emph{WARNING} or -@emph{ERROR} messages can invalidate the output of the test. This -usually requires a human to examine the output to determine what really -happened -- and to improve the test case. +there were three or more @emph{WARNING} messages. Any @emph{WARNING} +or @emph{ERROR} messages can invalidate the output of the test. This +usually requires a human to examine the output to determine what +really happened -- and to improve the test case. @item A test depends on a previous test, which has failed. @@ -397,11 +399,11 @@ test case yet. @item UNSUPPORTED There is no support for the tested case. This may mean that a conditional feature of an operating system, or of a compiler, is not -implemented. DejaGnu also uses this message when a testing environment -(often a ``bare board'' target) lacks basic support for compiling or -running the test case. For example, a test for the system subroutine -@emph{gethostname} would never work on a target board running only a -boot monitor. +implemented. DejaGnu also uses this message when a testing +environment (often a ``bare board'' target) lacks basic support for +compiling or running the test case. For example, a test for the +system subroutine @emph{gethostname} would never work on a target +board running only a boot monitor. @end table DejaGnu uses the same output procedures to produce these messages for @@ -421,23 +423,23 @@ with many other GNU packages, as DejaGnu consists of interpreted code only. Save for its own small testsuite, the DejaGnu distribution does not -include any testsuites. Testsuites for the various GNU development tools -are included with those packages. After configuring the top-level -DejaGnu directory, unpack and configure the test directories for the -tools you want to test; then, in each test directory, run @emph{make -check} to build auxiliary programs required by some of the tests, and -run the test suites. +include any testsuites. Testsuites for the various GNU development +tools are included with those packages. After configuring the +top-level DejaGnu directory, unpack and configure the test directories +for the tools you want to test; then, in each test directory, run +@emph{make check} to build auxiliary programs required by some of the +tests, and run the test suites. @node Running tests, Running other DejaGnu commands, Introduction, Top @chapter Running tests -There are two ways to execute a testsuite. The most common way is when -there is existing support in the @file{Makefile} of the tool being -tested. This usually consists of a @emph{check} target. The other way is -to execute the @code{runtest} program directly. To run @code{runtest} -directly from the command line requires either all of the correct -command line options, or a @ref{Local configuration file} must be set up -correctly. +There are two ways to execute a testsuite. The most common way is +when there is existing support in the @file{Makefile} of the tool +being tested. This usually consists of a @emph{check} target. The +other way is to execute the @code{runtest} program directly. To run +@code{runtest} directly from the command line requires either all of +the correct command line options, or a @ref{Local configuration file} +must be set up correctly. @menu * Running 'make check': Make Check. @@ -448,35 +450,34 @@ correctly. @node Make Check, Runtest, , Running tests @section Running 'make check' -To run tests from an existing collection, first use @code{configure} as -usual to set up the build directory. Then type @code{make check}. If -the @emph{check} target exists, it usually saves you some trouble. For -instance, it can set up any auxiliary programs or other files needed by -the tests. The most common file the @emph{check} target depends on is -the @file{site.exp} file. The @file{site.exp} contains various variables -that DejaGnu uses to determine the configuration of the program being -tested. +To run tests from an existing collection, first use @code{configure} +as usual to set up the build directory. Then type @code{make check}. +If the @emph{check} target exists, it usually saves you some trouble. +For instance, it can set up any auxiliary programs or other files +needed by the tests. The most common file the @emph{check} target +depends on is the @file{site.exp} file. The @file{site.exp} contains +various variables that DejaGnu uses to determine the configuration of +the program being tested. Once you have run @emph{make check} to build any auxiliary files, you -can invoke the test driver @code{runtest} directly to repeat the tests. -You will also have to execute @code{runtest} directly for test +can invoke the test driver @code{runtest} directly to repeat the +tests. You will also have to execute @code{runtest} directly for test collections with no @emph{check} target in the @file{Makefile}. GNU Automake has built-in support for DejaGnu. To add DejaGnu support to your generated @file{Makefile.in}, just add the keyword -@code{dejagnu} to the AUTOMAKE_OPTIONS variable in -@file{Makefile.am}. This will ensure that the generated -@file{Makefile.in} has a @code{check} target that invokes DejaGnu -correctly. +@code{dejagnu} to the AUTOMAKE_OPTIONS variable in @file{Makefile.am}. +This will ensure that the generated @file{Makefile.in} has a +@code{check} target that invokes DejaGnu correctly. @node Runtest, Output Files, Make Check, Running tests @section Running runtest @pindex runtest -@code{runtest} is the test driver for DejaGnu. You can specify two kinds -of things on the @code{runtest} command line: command line options, and -Tcl variables that are passed to the test scripts. The options are -listed alphabetically below. +@code{runtest} is the test driver for DejaGnu. You can specify two +kinds of things on the @code{runtest} command line: command line +options, and Tcl variables that are passed to the test scripts. The +options are listed alphabetically below. @code{runtest} returns one of the following exit codes: @@ -499,9 +500,9 @@ if Expect encountered any error in the test scripts. @subsection Output States @cindex output states -@file{runtest} flags the outcome of each test as one of these cases. See -@ref{A POSIX Conforming Test Framework} for a discussion of how POSIX -specifies the meanings of these cases. +@file{runtest} flags the outcome of each test as one of these cases. +See @ref{A POSIX Conforming Test Framework} for a discussion of how +POSIX specifies the meanings of these cases. @table @asis @@ -511,7 +512,7 @@ succeed. @item XPASS A pleasant kind of failure: a test was expected to fail, but -succeeded. This may indicate progress; inspect the test case to +succeeded. This may indicate progress; inspect the test case to determine whether you should amend it to stop expecting failure. @item FAIL @@ -527,21 +528,21 @@ outcome is @emph{UNSUPPORTED} instead. @item UNRESOLVED 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. +automatically determine the outcome. For example, your tests can +report this outcome is when a test does not complete as expected. @item UNTESTED -A test case is not yet complete, and in particular cannot yet produce a -@emph{PASS} or @emph{FAIL}. You can also use this outcome in dummy +A test case is not yet complete, and in particular cannot yet produce +a @emph{PASS} or @emph{FAIL}. You can also use this outcome in dummy ``tests'' that note explicitly the absence of a real test case for a particular property. @item UNSUPPORTED -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. +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. @end table @code{runtest} may also display the following messages: @@ -549,16 +550,16 @@ subroutine. @table @asis @item ERROR -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 @emph{UNSUPPORTED}, @emph{UNTESTED}, or -@emph{UNRESOLVED} instead, as appropriate. +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 @emph{UNSUPPORTED}, @emph{UNTESTED}, +or @emph{UNRESOLVED} instead, as appropriate. @item WARNING -Indicates a possible problem in running the test. Usually warnings -correspond to recoverable errors, or display an important message about -the following tests. +Indicates a possible problem in running the test. Usually warnings +correspond to recoverable errors, or display an important message +about the following tests. @item NOTE An informational message about the test case. @@ -569,42 +570,44 @@ An informational message about the test case. @cindex runtest, invoking This is the full set of command line options that @code{runtest} -recognizes. Option names may be abbreviated to the shortest unique +recognizes. Option names may be abbreviated to the shortest unique string. @table @asis @item @code{-a}, @code{--all} -Display all test output. By default, @emph{runtest} shows only the +Display all test output. By default, @emph{runtest} shows only the output of tests that produce unexpected results; that is, tests with status @emph{FAIL} (unexpected failure), @emph{XPASS} (unexpected -success), or @emph{ERROR} (a severe error in the test case -itself). Specify @code{--all} to see output for tests with status -@emph{PASS} (success, as expected) @emph{XFAIL} (failure, as expected), -or @emph{WARNING} (minor error in the test case itself). +success), or @emph{ERROR} (a severe error in the test case itself). +Specify @code{--all} to see output for tests with status @emph{PASS} +(success, as expected) @emph{XFAIL} (failure, as expected), or +@emph{WARNING} (minor error in the test case itself). @item @code{--build [triplet]} @emph{triplet} is a system triplet of the form -@emph{cpu-manufacturer-os}. This is the type of machine DejaGnu and the -tools to be tested are built on. For a normal cross environment this is -the same as the host, but for a Canadian cross, they are different. +@emph{cpu-manufacturer-os}. This is the type of machine DejaGnu and +the tools to be tested are built on. For a normal cross environment +this is the same as the host, but for a Canadian cross, they are +different. @item @code{-D0}, @code{-D1} -Start the internal Tcl debugger. The Tcl debugger supports breakpoints, -single stepping, and other common debugging activities. See the document -@uref{http://expect.sourceforge.net/doc/tcl-debug.ps, Debugger for Tcl -Applications} by Don Libes. If you specify @emph{-D1}, the @emph{expect} -shell stops at a breakpoint as soon as DejaGnu invokes it. If you -specify @emph{-D0}, DejaGnu starts as usual, but you can enter the -debugger by sending an interrupt (e.g. by typing @key{Ctrl}-@key{c}). +Start the internal Tcl debugger. The Tcl debugger supports +breakpoints, single stepping, and other common debugging activities. +See the document @uref{http://expect.sourceforge.net/doc/tcl-debug.ps, +Debugger for Tcl Applications} by Don Libes. If you specify +@emph{-D1}, the @emph{expect} shell stops at a breakpoint as soon as +DejaGnu invokes it. If you specify @emph{-D0}, DejaGnu starts as +usual, but you can enter the debugger by sending an interrupt (e.g. by +typing @key{Ctrl}-@key{c}). @item @code{--debug} -Turns on the Expect internal debugging output. Debugging output is +Turns on the Expect internal debugging output. Debugging output is displayed as part of the @emph{runtest} output, and logged to a file -called @file{dbg.log}. The extra debugging output does @emph{not} appear -on standard output, unless the verbose level is greater than 2 (for -instance, to see debug output immediately, specify @code{--debug -v --v}). The debugging output shows all attempts at matching the test +called @file{dbg.log}. The extra debugging output does @emph{not} +appear on standard output, unless the verbose level is greater than 2 +(for instance, to see debug output immediately, specify @code{--debug +-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 @code{--strace} also goes into @file{dbg.log}. @@ -622,18 +625,18 @@ Prints out a short summary of the @emph{runtest} options, then exits (even if you specify other options). @item @code{--host [triplet]} -@emph{triplet} is a system triplet of the form @emph{cpu-manufactuer-os}. -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 @emph{only} DejaGnu procedures that compare the host string with -particular values. The procedures @emph{ishost}, @emph{istarget}, -@emph{isnative}, and @emph{setup_xfail} are affected by -@code{--host}. In this usage, @emph{host} refers to the machine that the -tests are to be run on, which may not be the same as the @emph{build} -machine. If @code{--build} is also specified, then @code{--host} refers -to the machine that the tests will be run on, not the machine DejaGnu is -run on. +@emph{triplet} is a system triplet of the form +@emph{cpu-manufactuer-os}. 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 @emph{only} DejaGnu procedures that compare +the host string with particular values. The procedures @emph{ishost}, +@emph{istarget}, @emph{isnative}, and @emph{setup_xfail} are affected +by @code{--host}. In this usage, @emph{host} refers to the machine +that the tests are to be run on, which may not be the same as the +@emph{build} machine. If @code{--build} is also specified, then +@code{--host} refers to the machine that the tests will be run on, not +the machine DejaGnu is run on. @item @code{--host_board [name]} The host board to use. @@ -644,57 +647,57 @@ The name(s) of specific tests to ignore. @item @code{--local_init [name]} Use @emph{name} as the testsuite local init file instead of @file{site.exp} in the current directory and in @emph{objdir}. The -default is, of course, @file{site.exp}. Note that this option accepts a -relative file name, so a file in a subdirectory may be used. +default is, of course, @file{site.exp}. Note that this option accepts +a relative file name, so a file in a subdirectory may be used. @item @code{--log_dialog} -Emit Expect output to stdout. The Expect output is usually only written -to the @file{.log} file. By enabling this option, they are also printed -to standard output. +Emit Expect output to stdout. The Expect output is usually only +written to the @file{.log} file. By enabling this option, they are +also printed to standard output. @item @code{--mail [address(es)]} Send test results to one or more email addresses. @item @code{--objdir [path]} Use @emph{path} as the top directory containing any auxiliary compiled -test code. The default is '.'. Use this option to locate pre-compiled -test code. You can normally prepare any auxiliary files needed with -@emph{make}. +test code. The default is '.'. Use this option to locate +pre-compiled test code. You can normally prepare any auxiliary files +needed with @emph{make}. @item @code{--outdir [path]} Write log files in directory @file{path}. The default is '.', the -directory where you start @emph{runtest}. This option affects only the -summary (@file{.sum}) and the detailed log files (@file{.log}). The -DejaGnu debug log @file{dbg.log} always appears (when requested) in the -local directory. +directory where you start @emph{runtest}. This option affects only +the summary (@file{.sum}) and the detailed log files (@file{.log}). +The DejaGnu debug log @file{dbg.log} always appears (when requested) +in the local directory. @item @code{--reboot [name]} -Reboot the target board when @code{runtest} starts. 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 -can take a lot of time. +Reboot the target board when @code{runtest} starts. 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 can take a lot of time. @item @code{--srcdir [path]} -Use @file{path} as the top directory for test scripts to -run. @emph{runtest} looks in this directory for any subdirectory whose -name begins with the toolname (specified with @code{--tool}). For +Use @file{path} as the top directory for test scripts to run. +@emph{runtest} looks in this directory for any subdirectory whose name +begins with the toolname (specified with @code{--tool}). For instance, with @code{--tool gdb}, @emph{runtest} uses tests in subdirectories @file{gdb.*} (with the usual shell-like filename -expansion). If you do not use @code{--srcdir}, @emph{runtest} looks for -test directories under the current working directory. +expansion). If you do not use @code{--srcdir}, @emph{runtest} looks +for test directories under the current working directory. @item @code{--strace [n]} -Turn on internal tracing for @emph{expect}, to n levels deep. By +Turn on internal tracing for @emph{expect}, 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 @emph{case} or @emph{if} statements. Each procedure call or -control structure counts as one ``level''. The output is recorded in the -same file, @file{dbg.log}, used for output from @code{--debug}. +control structure counts as one ``level''. The output is recorded in +the same file, @file{dbg.log}, used for output from @code{--debug}. @item @code{--target [triplet]} -Use this option to override the default setting (native -testing). @emph{triplet} is a system triplet of the form -@emph{cpu-manufacturer-os}. This option changes the configuration +Use this option to override the default setting (native testing). +@emph{triplet} is a system triplet of the form +@emph{cpu-manufacturer-os}. This option changes the configuration @code{runtest} uses for the default tool names, and other setup information. @@ -703,17 +706,17 @@ The list of target boards to run tests on. @item @code{--tool [name(s)]} Specifies which testsuite to run, and what initialization module to -use. @code{--tool} is used @emph{only} for these two purposes. It is -@emph{not} used to name the executable program to test. Executable tool -names (and paths) are recorded in @file{site.exp} and you can override -them by specifying Tcl variables on the command line. - -For example, including @code{--tool} gcc on the command line runs tests -from all test subdirectories whose names match @file{gcc.*}, and uses -one of the initialization modules named @file{config/*-gcc.exp}. To -specify the name of the compiler (perhaps as an alternative path to what -@emph{runtest} would use by default), use @emph{GCC=path-to-gcc} on the -@emph{runtest} command line. +use. @code{--tool} is used @emph{only} for these two purposes. It is +@emph{not} used to name the executable program to test. Executable +tool names (and paths) are recorded in @file{site.exp} and you can +override them by specifying Tcl variables on the command line. + +For example, including @code{--tool} gcc on the command line runs +tests from all test subdirectories whose names match @file{gcc.*}, and +uses one of the initialization modules named @file{config/*-gcc.exp}. +To specify the name of the compiler (perhaps as an alternative path to +what @emph{runtest} would use by default), use @emph{GCC=path-to-gcc} +on the @emph{runtest} command line. @item @code{--tool_exec [name]} The path to the tool executable to test. @@ -722,34 +725,35 @@ The path to the tool executable to test. A list of additional options to pass to the tool. @item @code{-v}, @code{--verbose} -Turns on more output. Repeating this option increases the amount of -output displayed. Level one (@emph{-v}) is simply test output. Level two -(@emph{-v -v}) shows messages on options, configuration, and process -control. Verbose messages appear in the detailed (@file{*.log}) log -file, but not in the summary (@file{*.sum}) log file. +Turns on more output. Repeating this option increases the amount of +output displayed. Level one (@emph{-v}) is simply test output. Level +two (@emph{-v -v}) shows messages on options, configuration, and +process control. Verbose messages appear in the detailed +(@file{*.log}) log file, but not in the summary (@file{*.sum}) log +file. @item @code{-V}, @code{--version} Prints out the version numbers of DejaGnu, Expect, and Tcl. @item @code{-x}, @code{--xml} -Generate XML output. The output file is named after the tool with an +Generate XML output. The output file is named after the tool with an .xml extension. @item @file{testfile}.exp[=arg(s)] -Specify the names of testsuites to run. By default, @emph{runtest} runs -all tests for the tool, but you can restrict it to particular testsuites -by giving the names of the @emph{.exp} scripts that control -them. @emph{testsuite}.exp cannot include directory names, only plain +Specify the names of testsuites to run. By default, @emph{runtest} +runs all tests for the tool, but you can restrict it to particular +testsuites by giving the names of the @emph{.exp} scripts that control +them. @emph{testsuite}.exp cannot include directory names, only plain filenames. -@code{arg(s)} specifies a subset of test cases to run. For compiler or -assembler tests, which often use a single @emph{.exp} script covering -many different test case files, this option allows you to further -restrict the tests by listing particular test cases. For larger -testsuites such as that included in GCC, this can save a lot of -time. Some tools support wildcards here, but this varies from tool to -tool. Typically the wildcards @emph{?}, @emph{*}, and @emph{[chars]} are -recognized. +@code{arg(s)} specifies a subset of test cases to run. For compiler +or assembler tests, which often use a single @emph{.exp} script +covering many different test case files, this option allows you to +further restrict the tests by listing particular test cases. For +larger testsuites such as that included in GCC, this can save a lot of +time. Some tools support wildcards here, but this varies from tool to +tool. Typically the wildcards @emph{?}, @emph{*}, and @emph{[chars]} +are recognized. @item @code{tclvar}=value You can define Tcl variables for use by your test scripts in the same @@ -769,11 +773,11 @@ DejaGnu @emph{Makefile}; their values are captured in the Typically, you don't need to use any command line options. The @code{--tool} option is only required when there is more than one -testsuite in the same directory. The default options are in the local +testsuite in the same directory. The default options are in the local @file{site.exp} file, created by @code{make site.exp}. -For example, if the directory @file{gdb/testsuite} contains a collection -of DejaGnu tests for GDB, you can run them like this: +For example, if the directory @file{gdb/testsuite} contains a +collection of DejaGnu tests for GDB, you can run them like this: @example $ cd gdb/testsuite @@ -790,8 +794,8 @@ The test output follows, then ends with: /usr/latest/bin/gdb version 4.14.4 -nx @end example -You can use the option @code{--srcdir} to point to some other directory -containing a collection of tests: +You can use the option @code{--srcdir} to point to some other +directory containing a collection of tests: @example $ runtest --srcdir /devo/gdb/testsuite @@ -802,9 +806,10 @@ 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 @code{-a} (all) option. For more verbose output about processes being -run, communication, and so on, use @code{-v} (verbose). To see even more -output, use multiple @code{-v} options. See @ref{Invoking runtest} for -a more detailed explanation of each @code{runtest} option. +run, communication, and so on, use @code{-v} (verbose). To see even +more output, use multiple @code{-v} options. See @ref{Invoking +runtest} for a more detailed explanation of each @code{runtest} +option. @node Output Files, , Runtest, Running tests @section Output files @@ -812,8 +817,8 @@ a more detailed explanation of each @code{runtest} option. DejaGnu always writes two kinds of output files. Summary output is written to the @file{.sum} file, and detailed output is written to the @file{.log} file. The tool name determines the prefix for these -files. For example, after running with @code{--tool gdb}, the output -files will be called @file{gdb.sum} and @file{gdb.log}. For +files. For example, after running with @code{--tool gdb}, the output +files will be called @file{gdb.sum} and @file{gdb.log}. For troubleshooting, a debug log file that logs the operation of Expect is available. Each of these will be described in turn. @@ -827,24 +832,24 @@ available. Each of these will be described in turn. @subsection Summary log file @cindex output file, summary log -DejaGnu always produces a summary (@file{.sum}) output file. This -summary lists the names of all test files run. For each test file, one -line of output from each @code{pass} command (showing status @emph{PASS} -or @emph{XPASS}) or @code{fail} command (status @emph{FAIL} or -@emph{XFAIL}), trailing summary statistics that count passing and -failing tests (expected and unexpected), the full pathname of the tool -tested, and the version number of the tool. All possible outcomes, and -all errors, are always reflected in the summary output file, regardless -of whether or not you specify @code{--all}. +DejaGnu always produces a summary (@file{.sum}) output file. This +summary lists the names of all test files run. For each test file, +one line of output from each @code{pass} command (showing status +@emph{PASS} or @emph{XPASS}) or @code{fail} command (status +@emph{FAIL} or @emph{XFAIL}), trailing summary statistics that count +passing and failing tests (expected and unexpected), the full pathname +of the tool tested, and the version number of the tool. All possible +outcomes, and all errors, are always reflected in the summary output +file, regardless of whether or not you specify @code{--all}. If any of your tests use the procedures @code{unresolved}, @code{unsupported}, or @code{untested}, the summary output also tabulates the corresponding outcomes. -For example, after running @code{runtest --tool binutils} a summary log -file will be written to @file{binutils.sum}. Normally, DejaGnu writes -this file in your current working directory. Use the @code{--outdir} -option to select a different output directory. +For example, after running @code{runtest --tool binutils} a summary +log file will be written to @file{binutils.sum}. Normally, DejaGnu +writes this file in your current working directory. Use the +@code{--outdir} option to select a different output directory. @strong{Sample summary log} @@ -877,12 +882,12 @@ XFAIL: mips-ecoff (ecoff-bigmips) "ptype v_signed_char" signed C types @subsection Detailed log file @cindex output file, detailed log -DejaGnu also saves a detailed log file (@file{.log}), showing any output -generated by test cases as well as the summary output. For example, -after running @code{runtest --tool binutils}, a detailed log file will -be written to @file{binutils.log}. Normally, DejaGnu writes this file in -your current working directory. Use the @code{--outdir} option to select -a different output directory. +DejaGnu also saves a detailed log file (@file{.log}), showing any +output generated by test cases as well as the summary output. For +example, after running @code{runtest --tool binutils}, a detailed log +file will be written to @file{binutils.log}. Normally, DejaGnu writes +this file in your current working directory. Use the @code{--outdir} +option to select a different output directory. @strong{Sample detailed log for g++ tests} @@ -926,10 +931,10 @@ FAIL: segment violation @cindex output file, debug log The @code{runtest} option @code{--debug} creates a file showing the -output from Expect in debugging mode. The @file{dbg.log} file is created -in the current directory. The log file shows the string sent to the -tool being tested by each @code{send} command and the pattern it -compares with the tool output by each @code{expect} command. +output from Expect in debugging mode. The @file{dbg.log} file is +created in the current directory. The log file shows the string sent +to the tool being tested by each @code{send} command and the pattern +it compares with the tool output by each @code{expect} command. The log messages begin with a message of the form: @@ -939,13 +944,13 @@ expect: does @{tool output@} (spawn_id n) @end example For every unsuccessful match, Expect issues a @emph{no} after this -message. If other patterns are specified for the same Expect command, +message. If other patterns are specified for the same Expect command, they are reflected also, but without the first part of the message (@emph{expect... match pattern}). When Expect finds a match, the log for the successful match ends with -@emph{yes}, followed by a record of the Expect variables set to describe -a successful match. +@emph{yes}, followed by a record of the Expect variables set to +describe a successful match. @strong{Example debug log file for a GDB test} @@ -978,41 +983,42 @@ PASS: 70 0 breakpoint line number in file @end example -This example exhibits three properties of Expect and DejaGnu that might -be surprising at first glance: +This example exhibits three properties of Expect and DejaGnu that +might be surprising at first glance: @itemize @item -Empty output for the first attempted match. The first set of attempted -matches shown ran against the output @emph{@{@}} --- that is, no -output. Expect begins attempting to match the patterns supplied -immediately; often, the first pass is against incomplete output (or -completely before all output, as in this case). +Empty output for the first attempted match. The first set of +attempted matches shown ran against the output @emph{@{@}} --- that +is, no output. Expect begins attempting to match the patterns +supplied immediately; often, the first pass is against incomplete +output (or completely before all output, as in this case). @item -Interspersed tool output. The beginning of the log entry for the second -attempted match may be hard to spot: this is because the prompt +Interspersed tool output. The beginning of the log entry for the +second attempted match may be hard to spot: this is because the prompt @emph{@{(gdb) @}} appears on the same line, just before the @emph{expect:} that marks the beginning of the log entry. @item -Fail-safe patterns. Many of the patterns tested are fail-safe patterns -provided by GDB testing utilities, to reduce possible indeterminacy. It -is useful to anticipate potential variations caused by extreme system -conditions (GDB might issue the message @emph{virtual memory exhausted} -in rare circumstances), or by changes in the tested program -(@emph{Undefined command} is the likeliest outcome if the name of a -tested command changes). - -The pattern @emph{@{return@}} is a particularly interesting fail-safe to -notice; it checks for an unexpected @key{RET} prompt. This may happen, -for example, if the tested tool can filter output through a pager. +Fail-safe patterns. Many of the patterns tested are fail-safe +patterns provided by GDB testing utilities, to reduce possible +indeterminacy. It is useful to anticipate potential variations caused +by extreme system conditions (GDB might issue the message +@emph{virtual memory exhausted} in rare circumstances), or by changes +in the tested program (@emph{Undefined command} is the likeliest +outcome if the name of a tested command changes). + +The pattern @emph{@{return@}} is a particularly interesting fail-safe +to notice; it checks for an unexpected @key{RET} prompt. This may +happen, for example, if the tested tool can filter output through a +pager. These fail-safe patterns (like the debugging log itself) are primarily -useful while developing test scripts. Use the @code{error} procedure to -make the actions for fail-safe patterns produce messages starting with -@emph{ERROR} on standard output, and in the detailed log file. +useful while developing test scripts. Use the @code{error} procedure +to make the actions for fail-safe patterns produce messages starting +with @emph{ERROR} on standard output, and in the detailed log file. @end itemize @@ -1080,8 +1086,8 @@ are unique and which would be ambiguous to the invoked command. Print a help message instead of running a command. @item @code{-V}, @code{--version} -Print a version banner for the launcher itself including the -version of DejaGnu. Any command given is ignored. +Print a version banner for the launcher itself including the version +of DejaGnu. Any command given is ignored. @item @code{-v}, @code{--verbose} Emit additional output describing the inner workings of the @@ -1090,7 +1096,8 @@ invoked command. @end table -All arguments after the command name are passed to the invoked command. +All arguments after the command name are passed to the invoked +command. @node Invoking dejagnu help, Invoking dejagnu report card, Invoking dejagnu, Running other DejaGnu commands @section Invoking @command{dejagnu help} @@ -1133,7 +1140,8 @@ produces. @end example The @option{--verbose} option causes additional output describing the -inner workings of the @command{dejagnu report card} command to be produced. +inner workings of the @command{dejagnu report card} command to be +produced. Aside from options, the command may include a list of tools or files. Names ending in @samp{.sum} are used as-is. Names ending in @@ -1162,22 +1170,22 @@ errors, tags @samp{!W!} or @samp{!E!} are added at the end of the row. The site configuration file, @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 @code{configure} and @code{make} programs. If this file is -setup correctly, it is possible to execute a testsuite merely by typing -@code{runtest}. +into the @code{configure} and @code{make} programs. If this file is +setup correctly, it is possible to execute a testsuite merely by +typing @code{runtest}. -DejaGnu supports two @file{site.exp} files. The multiple instances of -@file{site.exp} are loaded in a fixed order. The first file loaded is +DejaGnu supports two @file{site.exp} files. The multiple instances of +@file{site.exp} are loaded in a fixed order. The first file loaded is the local file @file{site.exp}, and then the optional global @file{site.exp} file as pointed to by the @code{DEJAGNU} environment variable. There is an optional global @file{site.exp}, containing configuration values that apply to DejaGnu site-wide. @code{runtest} loads these -values first. The global @file{site.exp} contains the default values for -all targets and hosts supported by DejaGnu. This global file is +values first. The global @file{site.exp} contains the default values +for all targets and hosts supported by DejaGnu. This global file is identified by setting the environment variable @code{DEJAGNU} to the -name of the file. If @code{DEJAGNU} is set, but the file cannot be +name of the file. If @code{DEJAGNU} is set, but the file cannot be located, an error will be raised and @code{runtest} will abort. Any directory containing a configured testsuite also has a local @@ -1186,15 +1194,16 @@ being tested. Since @code{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 @file{site.exp} file. -You can usually generate or update the testsuite's local @file{site.exp} -by typing @code{make site.exp} in the testsuite directory, after the -test suite is configured. +You can usually generate or update the testsuite's local +@file{site.exp} by typing @code{make site.exp} in the testsuite +directory, after the test suite is configured. You can also have a file in your home directory called -@file{.dejagnurc}. This gets loaded after the other config -files. Usually this is used for personal stuff, like setting the +@file{.dejagnurc}. This gets loaded after the other config files. +Usually this is used for personal stuff, like setting the @code{all_flag} so all the output gets printed, or your own verbosity -levels. This file is usually restricted to setting command line options. +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 @file{site.exp}, or by setting variables on the @code{runtest} @@ -1213,15 +1222,15 @@ command line. @cindex configuration file, global The global configuration file is where all the target specific -configuration variables for a site are set. For example, a centralized -testing lab where multiple developers have to share an embedded -development board. There are settings for both remote hosts and remote -targets. Below is an example of a global configuration file for a -Canadian cross environment. A Canadian cross is a toolchain that is -built on, runs on, and targets three different system triplets (for -example, building a Solaris-hosted MIPS R4000 toolchain on a GNU/Linux -system). This example is based on a configuration once used at -Cygnus. +configuration variables for a site are set. For example, a +centralized testing lab where multiple developers have to share an +embedded development board. There are settings for both remote hosts +and remote targets. Below is an example of a global configuration +file for a Canadian cross environment. A Canadian cross is a +toolchain that is built on, runs on, and targets three different +system triplets (for example, building a Solaris-hosted MIPS R4000 +toolchain on a GNU/Linux system). This example is based on a +configuration once used at Cygnus. @strong{Example global configuration file} @@ -1248,25 +1257,25 @@ switch -glob -- $target_triplet @{ @} @end example -In this case, we have support for several cross compilers, that all run -on this host. To run DejaGnu tests on tools hosted on operating systems -that do not run Expect, DejaGnu can be run on the build machine and -connect to the remote host to run all the tests. As you can see, all -one does is set the variable @code{target_list} to the list of targets -and options to test. +In this case, we have support for several cross compilers, that all +run on this host. To run DejaGnu tests on tools hosted on operating +systems that do not run Expect, DejaGnu can be run on the build +machine and connect to the remote host to run all the tests. As you +can see, all one does is set the variable @code{target_list} to the +list of targets and options to test. In this example, simple cases like @emph{sparc64-elf} only require -setting the name of the single board configuration file. The +setting the name of the single board configuration file. The @emph{mips-elf} target is more complicated and sets the list to three -target boards. @emph{mips-sim} is a symbolic name for a simulator +target boards. @emph{mips-sim} is a symbolic name for a simulator ``board'' and @emph{wilma} and @emph{barney} are symbolic names for -physical boards. Symbolic names are covered in the @ref{Adding a new -board} section. The more complicated example is the entry for -@emph{mips-lsi-elf}. This one runs the tests with multiple iterations +physical boards. Symbolic names are covered in the @ref{Adding a new +board} section. The more complicated example is the entry for +@emph{mips-lsi-elf}. This one runs the tests with multiple iterations using all possible combinations of the @code{--soft-float} and the @code{--el} (little endian) options. The braced string includes an initial comma so that the set of combinations includes no options at -all. Needless to say, this last target example is mostly specific to +all. Needless to say, this last target example is mostly specific to compiler testing. @node Local configuration file, Board configuration file, Global configuration file, Customizing DejaGnu @@ -1275,18 +1284,18 @@ compiler testing. It is usually more convenient to keep these @emph{manual overrides} in the @file{site.exp} local to each test directory, rather than in the -global @file{site.exp} in the installed DejaGnu library. This file is +global @file{site.exp} in the installed DejaGnu library. This file is mostly for supplying tool specific info that is required by the testsuite. All local @file{site.exp} files have two sections, separated by -comments. The first section is generated by @code{make}. It is +comments. The first section is generated by @code{make}. It is essentially a collection of Tcl variable definitions based on -@file{Makefile} environment variables. Since they are generated by +@file{Makefile} environment variables. Since they are generated by @code{make}, they contain the values as specified by @code{configure}. In particular, this section contains the @file{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 +host and target configuration data. Do not edit this first section; +if you do, your changes will be overwritten the next time you run @code{make}. The first section starts with: @example @@ -1296,12 +1305,12 @@ you do, your changes will be overwritten the next time you run @end example 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 @code{runtest}. This allows you to -easily customize @code{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. +variables. The second section can also contain your preferred +defaults for all the command line options to @code{runtest}. This +allows you to easily customize @code{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. @strong{The first section ends with this line} @@ -1309,14 +1318,14 @@ to override any defaults. ## All variables above are generated by configure. Do Not Edit ## @end example -You can make any changes under this line. If you wish to redefine a +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 +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 @code{host_triplet}, @code{build_triplet}, -@code{target_triplet}. All other variables are tool dependent, i.e., for -testing a compiler, the value for @code{CC} might be set to a freshly -built binary, as opposed to one in the user's path. +@code{target_triplet}. All other variables are tool dependent, i.e., +for testing a compiler, the value for @code{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. @@ -1340,16 +1349,16 @@ set srcdir "$@{srcdir@}/testsuite" @end example This file defines the required fields for a local configuration file, -namely the three system triplets, and the srcdir. It also defines +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. +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. @vindex test_timeout The local @file{site.exp} may also set Tcl variables such as -@code{test_timeout} which can control the amount of time (in seconds) to -wait for a remote test to complete. If not specified, +@code{test_timeout} which can control the amount of time (in seconds) +to wait for a remote test to complete. If not specified, @code{test_timeout} defaults to 300 seconds. @node Board configuration file, Remote host testing, Local configuration file, Customizing DejaGnu @@ -1357,20 +1366,20 @@ wait for a remote test to complete. If not specified, @cindex configuration file, board The board configuration file is where board-specific configuration -details are stored. A board configuration file contains all the -higher-level configuration settings. There is a rough inheritance -scheme, where it is possible to derive a new board description file from -an existing one. There are also collections of custom procedures for -common environments. For more information on adding a new board config -file, see @ref{Adding a new board}. - -An example board configuration file for a GNU simulator is as -follows. @code{set_board_info} is a procedure that sets the field name -to the specified value. The procedures mentioned in brackets are -@emph{helper procedures}. These are used to find parts of a toolchain +details are stored. A board configuration file contains all the +higher-level configuration settings. There is a rough inheritance +scheme, where it is possible to derive a new board description file +from an existing one. There are also collections of custom procedures +for common environments. For more information on adding a new board +config file, see @ref{Adding a new board}. + +An example board configuration file for a GNU simulator is as follows. +@code{set_board_info} is a procedure that sets the field name to the +specified value. The procedures mentioned in brackets are +@emph{helper procedures}. These are used to find parts of a toolchain required to build an executable image that may reside in various -locations. This is mostly of use when the startup code, the standard C -libraries, or the toolchain itself is part of your build tree. +locations. This is mostly of use when the startup code, the standard +C libraries, or the toolchain itself is part of your build tree. @strong{Example file} @example @@ -1412,18 +1421,18 @@ There are five helper procedures used in this example: @itemize @item -@code{find_gcc} looks for a copy of the GNU compiler in your build tree, -or it uses the one in your path. This will also return the proper -transformed name for a cross compiler if you whole build tree is -configured for one. +@code{find_gcc} looks for a copy of the GNU compiler in your build +tree, or it uses the one in your path. This will also return the +proper transformed name for a cross compiler if you whole build tree +is configured for one. @item @code{libgloss_include_flags} returns the flags to compile using @ref{Libgloss, libgloss}, the GNU board support package (BSP). @item -@code{libgloss_link_flags} returns the flags to link an executable using -@ref{Libgloss, libgloss}. +@code{libgloss_link_flags} returns the flags to link an executable +using @ref{Libgloss, libgloss}. @item @code{newlib_include_flags} returns the flags to compile using @@ -1440,40 +1449,40 @@ library for embedded systems comprising of non-GPL'd code @section Remote host testing @cindex testing on remote hosts -DejaGnu also supports running the tests on a remote host. To set this -up, the remote host needs an FTP server, and a telnet server. Currently -foreign operating systems used as remote hosts are VxWorks, VRTX, -DOS/Windows 3.1, MacOS and Windows. +DejaGnu also supports running the tests on a remote host. To set this +up, the remote host needs an FTP server, and a telnet server. +Currently foreign operating systems used as remote hosts are VxWorks, +VRTX, DOS/Windows 3.1, MacOS and Windows. The recommended source for a Windows-based FTP server is to get IIS (either IIS 1 or Personal Web Server) from @uref{http://www.microsoft.com,http://www.microsoft.com}. When you -install it, make sure you install the FTP server - it's not selected by -default. Go into the IIS manager and change the FTP server so that it -does not allow anonymous FTP. Set the home directory to the root -directory (i.e. c:\) of a suitable drive. Allow writing via FTP. +install it, make sure you install the FTP server - it's not selected +by default. Go into the IIS manager and change the FTP server so that +it does not allow anonymous FTP. Set the home directory to the root +directory (i.e. c:\) of a suitable drive. Allow writing via FTP. It will create an account like IUSR_FOOBAR where foobar is the name of -your machine. Go into the user editor and give that account a password -that you don't mind hanging around in the clear (i.e. not the same as -your admin or personal passwords). Also, add it to all the various -permission groups. +your machine. Go into the user editor and give that account a +password that you don't mind hanging around in the clear (i.e. not the +same as your admin or personal passwords). Also, add it to all the +various permission groups. -You'll also need a telnet server. For Windows, go to the +You'll also need a telnet server. For Windows, go to the @uref{http://ataman.com,Ataman} web site, pick up the Ataman Remote -Logon Services for Windows, and install it. You can get started on the -eval period anyway. Add IUSR_FOOBAR to the list of allowed users, set -the HOME directory to be the same as the FTP default directory. Change -the Mode prompt to simple. +Logon Services for Windows, and install it. You can get started on +the eval period anyway. Add IUSR_FOOBAR to the list of allowed users, +set the HOME directory to be the same as the FTP default directory. +Change the Mode prompt to simple. -Now you need to pick a directory name to do all the testing in. For the -sake of this example, we'll call it piggy (i.e. c:\piggy). Create this -directory. +Now you need to pick a directory name to do all the testing in. For +the sake of this example, we'll call it piggy (i.e. c:\piggy). Create +this directory. -You'll need a Unix machine. Create a directory for the scripts you'll -need. For this example, we'll use /usr/local/swamp/testing. You'll need -to have a source tree somewhere, say /usr/src/devo. Now, copy some files -from releng's area in SV to your machine: +You'll need a Unix machine. Create a directory for the scripts you'll +need. For this example, we'll use /usr/local/swamp/testing. You'll +need to have a source tree somewhere, say /usr/src/devo. Now, copy +some files from releng's area in SV to your machine: @strong{Remote host setup} @@ -1486,9 +1495,9 @@ scp darkstar.welcomehome.org:/dejagnu/boards/useless98r2.exp boards/foobar.exp export DEJAGNU=/usr/local/swamp/testing/site.exp @end example -You must edit the boards/foobar.exp file to reflect your machine; change -the hostname (foobar.com), username (iusr_foobar), password, and -ftp_directory (c:/piggy) to match what you selected. +You must edit the boards/foobar.exp file to reflect your machine; +change the hostname (foobar.com), username (iusr_foobar), password, +and ftp_directory (c:/piggy) to match what you selected. Edit the global @file{ site.exp} to reflect your boards directory: @@ -1498,9 +1507,9 @@ Edit the global @file{ site.exp} to reflect your boards directory: lappend boards_dir "/usr/local/swamp/testing/boards" @end example -Now run MkTestDir, which is in the contrib directory. The first +Now run MkTestDir, which is in the contrib directory. The first parameter is the toolchain prefix, the second is the location of your -devo tree. If you are testing a cross compiler (ex: you have +devo tree. If you are testing a cross compiler (ex: you have sh-hms-gcc.exe in your PATH on the PC), do something like this: @strong{Setup Cross Remote Testing} @@ -1519,11 +1528,11 @@ PATH on the PC), do this: @end example To test the setup, @code{ftp} to your PC using the username -(iusr_foobar) and password you selected. CD to the test -directory. Upload a file to the PC. Now telnet to your PC using the same -username and password. CD to the test directory. Make sure the file is -there. Type "set" and/or "gcc -v" (or sh-hms-gcc -v) and make sure the -default PATH contains the installation you want to test. +(iusr_foobar) and password you selected. CD to the test directory. +Upload a file to the PC. Now telnet to your PC using the same +username and password. CD to the test directory. Make sure the file +is there. Type "set" and/or "gcc -v" (or sh-hms-gcc -v) and make sure +the default PATH contains the installation you want to test. @strong{Run Test Remotely} @@ -1532,8 +1541,8 @@ cd /usr/local/swamp/testing make -k -w check RUNTESTFLAGS="--host_board foobar --target_board foobar -v -v" > check.out 2>&1 @end example -To run a specific test, use a command like this (for this example, you'd -run this from the gcc directory that MkTestDir created): +To run a specific test, use a command like this (for this example, +you'd run this from the gcc directory that MkTestDir created): @strong{Run a Test Remotely} @@ -1542,8 +1551,8 @@ make check RUNTESTFLAGS="--host_board sloth --target_board sloth -v compile.exp= @end example Note: if you are testing a cross-compiler, put in the correct target -board. You'll also have to download more .exp files and modify them for -your local configuration. The -v's are optional. +board. You'll also have to download more .exp files and modify them +for your local configuration. The -v's are optional. @node Configuration file values, , Remote host testing, Customizing DejaGnu @section Configuration file values @@ -1551,9 +1560,9 @@ your local configuration. The -v's are optional. @vindex target_info DejaGnu uses a Tcl associative array to hold all the info for each -machine. In the case of a Canadian cross, this means host information as -well as target information. The named array is called -@code{target_info}, and it has two indices. The following fields are +machine. In the case of a Canadian cross, this means host information +as well as target information. The named array is called +@code{target_info}, and it has two indices. The following fields are part of the array. @menu @@ -1644,11 +1653,11 @@ Option@tab Tcl variable@tab Description @node User configuration file, , Command line option variables, Configuration file values @subsection Per-user configuration file (.dejagnurc) -The per-user configuration file is named @file{.dejagnurc} in the user's -home directory. It is used to customize the behaviour of @code{runtest} -for each user -- typically the user's preference for log verbosity, and -for storing any experimental Tcl procedures. An example -@file{~/.dejagnurc} file looks like: +The per-user configuration file is named @file{.dejagnurc} in the +user's home directory. It is used to customize the behaviour of +@code{runtest} for each user -- typically the user's preference for +log verbosity, and for storing any experimental Tcl procedures. An +example @file{~/.dejagnurc} file looks like: @strong{Example .dejagnurc} @@ -1659,9 +1668,10 @@ set RSH /usr/local/sbin/ssh @end example Here @code{all_flag} is set so that I see all the test cases that PASS -along with the ones that FAIL. I also set @code{RLOGIN} to the BSD -(non-Kerberos) version. I also set @code{RSH} to the SSH secure shell, -as rsh is mostly used to test Unix machines within a local network. +along with the ones that FAIL. I also set @code{RLOGIN} to the BSD +(non-Kerberos) version. I also set @code{RSH} to the SSH secure +shell, as rsh is mostly used to test Unix machines within a local +network. @node Extending DejaGnu, Unit testing, Customizing DejaGnu, Top @chapter Extending DejaGnu @@ -1688,38 +1698,38 @@ tools, new targets and new boards. @cindex adding, testsuite The testsuite for a new package should always be located in the source -directory of that package. DejaGnu requires this directory to be named -@file{testsuite}. Under this directory, the test cases go in various -subdirectories whose name begins with the tool name. The organization of -the various testsuite subdirectories is up to you. For a tool named -@code{gdb}, for instance, each subdirectory containing tests must start -with @samp{gdb.}. +directory of that package. DejaGnu requires this directory to be +named @file{testsuite}. Under this directory, the test cases go in +various subdirectories whose name begins with the tool name. The +organization of the various testsuite subdirectories is up to you. +For a tool named @code{gdb}, for instance, each subdirectory +containing tests must start with @samp{gdb.}. @node Adding a new tool, Adding a new target, Adding a new testsuite, Extending DejaGnu @section Adding a new tool In general, the best way to learn how to write code, or even prose, is -to read something similar. This principle applies to test cases and to -testsuites. Unfortunately, well-established testsuites have a way of -developing their own conventions: as test writers become more +to read something similar. This principle applies to test cases and +to testsuites. Unfortunately, well-established testsuites have a way +of developing their own conventions: as test writers become more experienced with DejaGnu and with Tcl, they accumulate more utilities, and take advantage of more and more features of Expect and Tcl in general. Inspecting such established testsuites may make the prospect of creating an entirely new testsuite appear overwhelming. Nevertheless, it is straightforward to start a new testsuite. -To help orient you further in this task, here is an outline of the steps -to begin building a testsuite for a program example. +To help orient you further in this task, here is an outline of the +steps to begin building a testsuite for a program example. -Create or select a directory to contain your new collection of -tests. Change into that directory (shown here as @file{testsuite}): +Create or select a directory to contain your new collection of tests. +Change into that directory (shown here as @file{testsuite}): Create a @file{configure.in} file in this directory, to control configuration-dependent choices for your tests. So far as DejaGnu is concerned, the important thing is to set a value for the variable @code{target_abbrev}; this value is the link to the init file you will -write soon. (For simplicity, we assume the environment is Unix, and use -@emph{unix} as the value.) +write soon. (For simplicity, we assume the environment is Unix, and +use @emph{unix} as the value.) What else is needed in @file{configure.in} depends on the requirements of your tool, your intended test environments, and which configure @@ -1728,22 +1738,22 @@ with GNU Autoconf. @subsection Sample Makefile.in Fragment -Create @file{Makefile.in} (if using Autoconf), or @file{Makefile.am} (if -using Automake), the source file used by configure to build your -@file{Makefile}. If you are using GNU Automake.just add the keyword +Create @file{Makefile.in} (if using Autoconf), or @file{Makefile.am} +(if using Automake), the source file used by configure to build your +@file{Makefile}. If you are using GNU Automake.just add the keyword @emph{dejagnu} to the @emph{AUTOMAKE_OPTIONS} variable in your -@file{Makefile.am} file. This will add all the @file{Makefile} support -needed to run DejaGnu, and support the @ref{Make Check, make check} -target. - -You also need to include two targets important to DejaGnu: @emph{check}, -to run the tests, and @emph{site.exp}, to set up the Tcl copies of -configuration-dependent values. This is called the @ref{Local -configuration file} The @emph{check} target must invoke the +@file{Makefile.am} file. This will add all the @file{Makefile} +support needed to run DejaGnu, and support the @ref{Make Check, make +check} target. + +You also need to include two targets important to DejaGnu: +@emph{check}, to run the tests, and @emph{site.exp}, to set up the Tcl +copies of configuration-dependent values. This is called the +@ref{Local configuration file} The @emph{check} target must invoke the @code{runtest} program to run the tests. The @emph{site.exp} target should usually set up (among other things) -the @emph{$tool} variable for the name of your program. If the local +the @emph{$tool} variable for the name of your program. If the local @file{site.exp} file is setup correctly, it is possible to execute the tests by merely typing @code{runtest} on the command line. @@ -1796,14 +1806,15 @@ site.exp: ./config.status Makefile @subsection Simple tool init file for batch programs -Create a directory (under @file{testsuite}) called @file{config}. Make a -tool init file in this directory. Its name must start with the +Create a directory (under @file{testsuite}) called @file{config}. +Make a tool init file in this directory. Its name must start with the @code{target_abbrev} value, or be named @file{default.exp} so call it -@file{config/unix.exp} for our Unix based example. This is the file that -contains the target-dependent procedures. Fortunately, on a native Unix -system, most of them do not have to do very much in order for -@code{runtest} to run. If the program being tested is not interactive, -you can get away with this minimal @file{unix.exp} to begin with: +@file{config/unix.exp} for our Unix based example. This is the file +that contains the target-dependent procedures. Fortunately, on a +native Unix system, most of them do not have to do very much in order +for @code{runtest} to run. If the program being tested is not +interactive, you can get away with this minimal @file{unix.exp} to +begin with: @example proc myprog_exit @{@} @{@} @@ -1833,11 +1844,11 @@ myprog_start @end example Create a directory whose name begins with your tool's name, to contain -tests. For example, if the tool name is @emph{example}, then the +tests. For example, if the tool name is @emph{example}, then the directories all need to start with @samp{example.}. Create a sample -test file ending in @file{.exp}. You can name the file -@file{first-try.exp}. To begin with, just write one line of Tcl code to -issue a message: +test file ending in @file{.exp}. You can name the file +@file{first-try.exp}. To begin with, just write one line of Tcl code +to issue a message: @example send_user "Testing: one, two...\n" @@ -1846,7 +1857,7 @@ send_user "Testing: one, two...\n" @subsection Testing A New Tool Config Back in the @file{testsuite} (top level) directory, run -@code{configure}. Typically you do this while in the build directory. +@code{configure}. Typically you do this while in the build directory. You are now ready to type @code{make check} or @code{runtest}. You should see something like this: @@ -1864,30 +1875,31 @@ Testing: one, two... There is no output in the summary, because so far the example does not call any of the procedures that report a test outcome. -Write some real tests. For an interactive tool, you should probably -write a real exit routine in fairly short order. In any case, you should -also write a real version routine soon. +Write some real tests. For an interactive tool, you should probably +write a real exit routine in fairly short order. In any case, you +should also write a real version routine soon. @node Adding a new target, Adding a new board, Adding a new tool, Extending DejaGnu @section Adding a new target @cindex adding, target -DejaGnu has some additional requirements for target support, beyond the -general-purpose provisions of a @code{configure} script. DejaGnu must -actively communicate with the target, rather than simply generating or -managing code for the target architecture. Therefore, each tool -requires an initialization module for each target. For new targets, you -must supply a few Tcl procedures to adapt DejaGnu to the target. +DejaGnu has some additional requirements for target support, beyond +the general-purpose provisions of a @code{configure} script. DejaGnu +must actively communicate with the target, rather than simply +generating or managing code for the target architecture. Therefore, +each tool requires an initialization module for each target. For new +targets, you must supply a few Tcl procedures to adapt DejaGnu to the +target. -Usually the best way to write a new initialization module is to edit an -existing initialization module; some trial and error will be -required. If necessary, you can use the @code{--debug} option to see +Usually the best way to write a new initialization module is to edit +an existing initialization module; some trial and error will be +required. If necessary, you can use the @code{--debug} option to see what is really going on. When you code an initialization module, be generous in printing information using the @code{verbose} procedure. In cross-development -environments, most of the work is in getting the communications -right. Code for communicating via TCP/IP networks or serial lines is +environments, most of the work is in getting the communications right. +Code for communicating via TCP/IP networks or serial lines is available in a DejaGnu library files such as @file{lib/telnet.exp}. If you suspect a communication problem, try running the connection @@ -1898,33 +1910,35 @@ together with other command-line options and arguments; or you can run the command @code{interpreter} from any Expect procedure. Use @code{return} to get back to the calling procedure (if any), or @code{return -tcl} to make the calling procedure itself return to its -caller; use @code{exit} or end-of-file to leave Expect altogether.) Run -the program whose name is recorded in @code{$connectmode}, with the -arguments in @code{$targetname}, to establish a connection. You should -at least be able to get a prompt from any target that is physically -connected. +caller; use @code{exit} or end-of-file to leave Expect altogether.) +Run the program whose name is recorded in @code{$connectmode}, with +the arguments in @code{$targetname}, to establish a connection. You +should at least be able to get a prompt from any target that is +physically connected. @node Adding a new board, Board file values, Adding a new target, Extending DejaGnu @section Adding a new board @cindex adding, board Adding a new board consists of creating a new board configuration -file. Examples are in @file{dejagnu/baseboards}. Usually to make a new -board file, it's easiest to copy an existing one. It is also possible to -have your file be based on a @emph{baseboard} file with only one or two -changes needed. Typically, this can be as simple as just changing the -linker script. Once the new baseboard file is done, add it to the -@code{boards_DATA} list in the @file{dejagnu/baseboards/Makefile.am}, -and regenerate the Makefile.in using automake. Then just rebuild and -install DejaGnu. You can test it by: +file. Examples are in @file{dejagnu/baseboards}. Usually to make a +new board file, it's easiest to copy an existing one. It is also +possible to have your file be based on a @emph{baseboard} file with +only one or two changes needed. Typically, this can be as simple as +just changing the linker script. Once the new baseboard file is done, +add it to the @code{boards_DATA} list in the +@file{dejagnu/baseboards/Makefile.am}, and regenerate the Makefile.in +using automake. Then just rebuild and install DejaGnu. You can test +it by: There is a crude inheritance scheme going on with board files, so you -can include one board file into another, The two main procedures used to -do this are @code{load_generic_config} and -@code{load_base_board_description}. The generic configuration file -contains other procedures used for a certain class of target. The board -description file is where the board specific settings go. Commonly there -are similar target environments with just different processors. +can include one board file into another, The two main procedures used +to do this are @code{load_generic_config} and +@code{load_base_board_description}. The generic configuration file +contains other procedures used for a certain class of target. The +board description file is where the board specific settings go. +Commonly there are similar target environments with just different +processors. @strong{Testing a New Board Configuration File} @@ -1932,13 +1946,13 @@ are similar target environments with just different processors. make check RUNTESTFLAGS="--target_board=newboardfile". @end example -Here's an example of a board configuration file. There are several -@emph{helper procedures} used in this example. A helper procedure is one -that look for a tool of files in commonly installed locations. These are -mostly used when testing in the build tree, because the executables to -be tested are in the same tree as the new DejaGnu files. The helper -procedures are the ones in brackets, which indicates a Tcl procedure -call. +Here's an example of a board configuration file. There are several +@emph{helper procedures} used in this example. A helper procedure is +one that look for a tool of files in commonly installed locations. +These are mostly used when testing in the build tree, because the +executables to be tested are in the same tree as the new DejaGnu +files. The helper procedures are the ones in brackets, which +indicates a Tcl procedure call. @strong{Example Board Configuration File} @@ -1978,11 +1992,11 @@ set_board_info gdb,cannot_call_functions 1 @node Board file values, Writing a test case, Adding a new board, Extending DejaGnu @section Board configuration file values -The following fields are in the @code{board_info} array. These are set -by the @code{set_board_info} procedure (or @code{add_board_info} -procedure for appending to lists). Both procedures take a field name and -a value for the field (or is added to the field), respectively. Some -common board info fields are shown below. +The following fields are in the @code{board_info} array. These are +set by the @code{set_board_info} procedure (or @code{add_board_info} +procedure for appending to lists). Both procedures take a field name +and a value for the field (or is added to the field), respectively. +Some common board info fields are shown below. @multitable @columnfractions 0.2 0.2 0.6 @item @@ -2025,9 +2039,9 @@ remotedir@tab @code{/tmp/runtest.[pid]}@tab Directory on the remote target in wh These fields are used by the GCC and GDB tests, and are mostly only useful to somewhat trying to debug a new board file for one of these -tools. Many of these are used only by a few testcases, and their purpose -is esoteric. These are listed with sample values as a guide to better -guessing if you need to change any of these. +tools. Many of these are used only by a few testcases, and their +purpose is esoteric. These are listed with sample values as a guide +to better guessing if you need to change any of these. @strong{Board Info Fields For GCC & GDB} @@ -2102,39 +2116,39 @@ target_install@tab @{sh-hms@}@tab @section Writing a test case @cindex Writing a test case -The easiest way to prepare a new test case is to base it on an existing -one for a similar situation. There are two major categories of tests: -batch-oriented and interactive. Batch-oriented tests are usually easier -to write. - -The GCC tests are a good example of batch-oriented tests. All GCC tests -consist primarily of a call to a single common procedure, since all the -tests either have no output, or only have a few warning messages when -successfully compiled. Any non-warning output constitutes a test -failure. All the C code needed is kept in the test directory. The test -driver, written in Tcl, need only get a listing of all the C files in -the directory, and compile them all using a generic procedure. This -procedure and a few others supporting for these tests are kept in the -library module @file{lib/c-torture.exp} of the GCC testsuite. Most tests -of this kind use very few Expect features, and are coded almost purely -in Tcl. +The easiest way to prepare a new test case is to base it on an +existing one for a similar situation. There are two major categories +of tests: batch-oriented and interactive. Batch-oriented tests are +usually easier to write. + +The GCC tests are a good example of batch-oriented tests. All GCC +tests consist primarily of a call to a single common procedure, since +all the tests either have no output, or only have a few warning +messages when successfully compiled. Any non-warning output +constitutes a test failure. All the C code needed is kept in the test +directory. The test driver, written in Tcl, need only get a listing +of all the C files in the directory, and compile them all using a +generic procedure. This procedure and a few others supporting for +these tests are kept in the library module @file{lib/c-torture.exp} of +the GCC testsuite. Most tests of this kind use very few Expect +features, and are coded almost purely in Tcl. Writing the complete suite of C tests, then, consisted of these steps: @itemize @item -Copying all the C code into the test directory. These tests were based -on the C-torture test created by Torbjorn Granlund (on behalf of the -Free Software Foundation) for GCC development. +Copying all the C code into the test directory. These tests were +based on the C-torture test created by Torbjorn Granlund (on behalf of +the Free Software Foundation) for GCC development. @item Writing (and debugging) the generic Tcl procedures for compilation. @item -Writing the simple test driver: its main task is to search the directory -(using the Tcl procedure @emph{glob} for filename expansion with -wildcards) and call a Tcl procedure with each filename. It also checks -for a few errors from the testing procedure. +Writing the simple test driver: its main task is to search the +directory (using the Tcl procedure @emph{glob} for filename expansion +with wildcards) and call a Tcl procedure with each filename. It also +checks for a few errors from the testing procedure. @end itemize Testing interactive programs is intrinsically more complex. Tests for @@ -2147,7 +2161,7 @@ DejaGnu, the GDB distribution already included a wide-ranging testing procedure. This procedure was very robust, and had already undergone much more debugging and error checking than many recent DejaGnu test cases. Accordingly, the best approach was simply to encapsulate the -existing GDB tests, for reporting purposes. Thereafter, new GDB tests +existing GDB tests, for reporting purposes. Thereafter, new GDB tests built up a family of Tcl procedures specialized for GDB testing. @subsection Hints on writing a test case @@ -2155,22 +2169,23 @@ built up a family of Tcl procedures specialized for GDB testing. @cindex test cases, writing It is safest to write patterns that match all the output generated by -the tested program; this is called closure. If a pattern does not match -the entire output, any output that remains will be examined by the next -@code{expect} command. In this situation, the precise boundary that -determines which @code{expect} command sees what is very sensitive to -timing between the Expect task and the task running the tested tool. As -a result, the test may sometimes appear to work, but is likely to have -unpredictable results. (This problem is particularly likely for -interactive tools, but can also affect batch tools---especially for -tests that take a long time to finish.) The best way to ensure closure -is to use the @code{-re} option for the @code{expect} command to write -the pattern as a full regular expressions; then you can match the end of -output using a @emph{$}. It is also a good idea to write patterns that -match all available output by using @emph{.*\} after the text of -interest; this will also match any intervening blank lines. Sometimes -an alternative is to match end of line using @emph{\r} or @emph{\n}, but -this is usually too dependent on terminal settings. +the tested program; this is called closure. If a pattern does not +match the entire output, any output that remains will be examined by +the next @code{expect} command. In this situation, the precise +boundary that determines which @code{expect} command sees what is very +sensitive to timing between the Expect task and the task running the +tested tool. As a result, the test may sometimes appear to work, but +is likely to have unpredictable results. (This problem is +particularly likely for interactive tools, but can also affect batch +tools---especially for tests that take a long time to finish.) The +best way to ensure closure is to use the @code{-re} option for the +@code{expect} command to write the pattern as a full regular +expressions; then you can match the end of output using a @emph{$}. +It is also a good idea to write patterns that match all available +output by using @emph{.*\} after the text of interest; this will also +match any intervening blank lines. Sometimes an alternative is to +match end of line using @emph{\r} or @emph{\n}, but this is usually +too dependent on terminal settings. Always escape punctuation, such as @emph{(} or @emph{"}, in your patterns; for example, write @emph{\(}. If you forget to escape @@ -2197,8 +2212,8 @@ make that pattern fail to match. To preserve basic sanity, I also recommended that no test ever pass if there was any kind of problem in the test case. To take an extreme case, tests that pass even when the tool will not spawn are -misleading. Ideally, a test in this sort of situation should not fail -either. Instead, print an error message by calling one of the DejaGnu +misleading. Ideally, a test in this sort of situation should not fail +either. Instead, print an error message by calling one of the DejaGnu procedures @code{error} or @code{warning}. @subsubheading Priority of Expect patterns @@ -2285,54 +2300,54 @@ These are the kinds of debugging information available from DejaGnu: @itemize @item -Output controlled by test scripts themselves, explicitly allowed for by -the test author. This kind of debugging output appears in the detailed -output recorded in the DejaGnu log file. To do the same for new tests, -use the @code{verbose} procedure (which in turn uses the Tcl variable -@samp{verbose}) to control how much output to generate. This will make -it easier for other people running the test to debug it if necessary. -If @samp{verbose} is zero, there should be no output other than the -output from the framework (eg. FAIL). Then, to whatever extent is -appropriate for the particular test, allow successively higher values of -@samp{verbose} to generate more information. Be kind to other -programmers who use your tests -- provide plenty of debugging -information. +Output controlled by test scripts themselves, explicitly allowed for +by the test author. This kind of debugging output appears in the +detailed output recorded in the DejaGnu log file. To do the same for +new tests, use the @code{verbose} procedure (which in turn uses the +Tcl variable @samp{verbose}) to control how much output to generate. +This will make it easier for other people running the test to debug it +if necessary. If @samp{verbose} is zero, there should be no output +other than the output from the framework (eg. FAIL). Then, to +whatever extent is appropriate for the particular test, allow +successively higher values of @samp{verbose} to generate more +information. Be kind to other programmers who use your tests -- +provide plenty of debugging information. @item -Output from the internal debugging functions of Tcl and Expect. There is -a command line options for each; both forms of debugging output are +Output from the internal debugging functions of Tcl and Expect. There +is a command line options for each; both forms of debugging output are recorded in the file @file{dbg.log} in the current directory. -Use @code{--debug} for information from Expect. It logs how Expect -attempts to match the tool output with the patterns specified. This can -be very helpful while developing test scripts, since it shows precisely -the characters received. Iterating between the latest attempt at a new -test script and the corresponding @file{dbg.log} can allow you to create -the final patterns by ``cut and paste''. This is sometimes the best way -to write a test case. +Use @code{--debug} for information from Expect. It logs how Expect +attempts to match the tool output with the patterns specified. This +can be very helpful while developing test scripts, since it shows +precisely the characters received. Iterating between the latest +attempt at a new test script and the corresponding @file{dbg.log} can +allow you to create the final patterns by ``cut and paste''. This is +sometimes the best way to write a test case. @item -Use @code{--strace} to see more detail from Tcl. This logs how Tcl -procedure definitions are expanded as they execute. The trace level +Use @code{--strace} to see more detail from Tcl. This logs how Tcl +procedure definitions are expanded as they execute. The trace level argument controls the depth of definitions expanded. @item If the value of @samp{verbose} is 3 or greater (@code{runtest -v -v -v}), DejaGnu activates the Expect command @code{log_user}. This -command prints all Expect actions to standard output, to the @file{.log} -file and, if @code{--debug} is given, to @file{dbg.log}. +command prints all Expect actions to standard output, to the +@file{.log} file and, if @code{--debug} is given, to @file{dbg.log}. @end itemize @node Adding a test case to a testsuite, Test case variables, Debugging a test case, Extending DejaGnu @section Adding a test case to a testsuite @cindex test cases, adding -There are two slightly different ways to add a test case. One is to add -the test case to an existing directory. The other is to create a new -directory to hold your test. The existing test directories represent -several styles of testing, all of which are slightly different. Examine -the testsuite subdirectories for the tool of interest to see which -approach is most suitable. +There are two slightly different ways to add a test case. One is to +add the test case to an existing directory. The other is to create a +new directory to hold your test. The existing test directories +represent several styles of testing, all of which are slightly +different. Examine the testsuite subdirectories for the tool of +interest to see which approach is most suitable. Adding a GCC test may be very simple: just add the source file to any test directory beginning with @file{gcc.} and it will be tested on the @@ -2342,9 +2357,9 @@ Adding a test by creating a new directory involves: @enumerate @item -Create the new directory. All subdirectory names begin with the name of -the tool to test; e.g. G++ tests might be in a directory called -@file{g++.other}. There can be multiple testsuite subdirectories with +Create the new directory. All subdirectory names begin with the name +of the tool to test; e.g. G++ tests might be in a directory called +@file{g++.other}. There can be multiple testsuite subdirectories with the same tool name prefix. @item @@ -2355,8 +2370,8 @@ Add the new test case to the directory, as above. @section Test case special variables There are special variables that contain other information from -DejaGnu. Your test cases can inspect these variables, as well as the -variables saved in @file{site.exp}. These variables should never be +DejaGnu. Your test cases can inspect these variables, as well as the +variables saved in @file{site.exp}. These variables should never be changed. @table @code @@ -2377,21 +2392,21 @@ The subdirectory for the current test case. @item $exec_output @vindex exec_output -This is the output from a @code{$@{tool@}_load} command. This only -applies to tools like GCC and GAS which produce an object file that must -in turn be executed to complete a test. +This is the output from a @code{$@{tool@}_load} command. This only +applies to tools like GCC and GAS which produce an object file that +must in turn be executed to complete a test. @item $comp_output @vindex comp_output This is the output from a @code{$@{tool@}_start} command. This is -conventionally used for batch-oriented programs, like GCC and GAS, that -may produce interesting output (warnings, errors) without further +conventionally used for batch-oriented programs, like GCC and GAS, +that may produce interesting output (warnings, errors) without further interaction. @item $expect_out(buffer) @vindex expect_out(buffer) -The output from the last command. This is an internal variable set by -Expect. More information can be found in the Expect manual. +The output from the last command. This is an internal variable set by +Expect. More information can be found in the Expect manual. @end table @node Unit testing, Built-in Procedures, Extending DejaGnu, Top @@ -2409,37 +2424,37 @@ Expect. More information can be found in the Expect manual. @cindex unit testing Most regression testing as done by DejaGnu is system testing: the -complete application is tested all at once. Unit testing is for testing -single files, or small libraries. In this case, each file is linked with -a test case in C or C++, and each function or class and method is tested -in turn, with the test case having to check private data or global -variables to see if the function or method worked. +complete application is tested all at once. Unit testing is for +testing single files, or small libraries. In this case, each file is +linked with a test case in C or C++, and each function or class and +method is tested in turn, with the test case having to check private +data or global variables to see if the function or method worked. This works particularly well for testing APIs and at level where it is easier to debug them, than by needing to trace through the entire -application. Also if there is a specification for the API to be tested, -the testcase can also function as a compliance test. +application. Also if there is a specification for the API to be +tested, the testcase can also function as a compliance test. @node The dejagnu_h header file, C unit testing API, What is unit testing?, Unit testing @section The dejagnu.h header file @cindex dejagnu.h header DejaGnu uses a single header file, @file{dejagnu.h} to assist in unit -testing. As this file also produces its one test state output, it can be -run stand-alone, which is very useful for testing on embedded -systems. This header file has a C and C++ API for the test states, with -simple totals, and standardized output. Because the output has been -standardized, DejaGnu can be made to work with this test case, without -writing almost any Tcl. The library module, dejagnu.exp, will look for -the output messages, and then merge them into DejaGnu's. +testing. As this file also produces its one test state output, it can +be run stand-alone, which is very useful for testing on embedded +systems. This header file has a C and C++ API for the test states, +with simple totals, and standardized output. Because the output has +been standardized, DejaGnu can be made to work with this test case, +without writing almost any Tcl. The library module, dejagnu.exp, will +look for the output messages, and then merge them into DejaGnu's. @node C unit testing API, C++ unit testing API, The dejagnu_h header file, Unit testing @section C unit testing API @cindex C unit testing API -All of the functions that take a @code{msg} parameter use a C @code{char -*} that is the message to be displayed. There currently is no support -for variable length arguments. +All of the functions that take a @code{msg} parameter use a C +@code{char *} that is the message to be displayed. There currently is +no support for variable length arguments. @itemize @item @@ -2466,7 +2481,7 @@ some technical reason. @item @code{unresolved} prints a message for an test case that is run, but -there is no clear result. These output states require a human to look +there is no clear result. These output states require a human to look over the results to determine what happened. @quotation @@ -2488,8 +2503,8 @@ outputs. @cindex C++ unit testing API All of the methods that take a @code{msg} parameter use a C char * or -STL string, that is the message to be displayed. There currently is no -support for variable length arguments. +STL string, that is the message to be displayed. There currently is +no support for variable length arguments. @itemize @@ -2515,7 +2530,7 @@ some reason. @item @code{unresolved} prints a message for an test case that is run, but -there is no clear result. These output states require a human to look +there is no clear result. These output states require a human to look over the results to determine what happened. @quotation @@ -2614,8 +2629,8 @@ configured host matches the @code{pattern} argument, the result is @emph{1}; otherwise the result is @emph{0}. @emph{pattern} must be a full three-part configure triplet; in particular, you may not use the shorter aliases supported by @code{configure} (but you can use Tcl -globbing to specify a range of triplets). If called with no arguments or -an empty pattern, this procedure returns the build system triplet. +globbing to specify a range of triplets). If called with no arguments +or an empty pattern, this procedure returns the build system triplet. @quotation @t{@b{isbuild} @i{pattern}} @@ -2625,7 +2640,7 @@ an empty pattern, this procedure returns the build system triplet. @subsubheading isremote Procedure @findex isremote -Is @i{board} remote? Return a non-zero value, if so. +Is @i{board} remote? Return a non-zero value, if so. @quotation @t{@b{isremote} @i{ board }} @@ -2637,20 +2652,21 @@ This procedure is to be used instead of @code{is_remote}. @subsubheading is_remote Procedure @findex is_remote -Is @i{board} remote? Return a non-zero value, if so. +Is @i{board} remote? Return a non-zero value, if so. @quotation @t{@b{is_remote} @i{ board }} @end quotation -Note that this procedure is now deprecated. Use @code{isremote} instead. +Note that this procedure is now deprecated. Use @code{isremote} +instead. @node is3way procedure, ishost procedure, is_remote procedure, Core Internal Procedures @subsubheading is3way Procedure @findex is3way -Tests for a Canadian cross. This is when the tests will be run on a -remotely hosted cross-compiler. If it is a Canadian cross, then the +Tests for a Canadian cross. This is when the tests will be run on a +remotely hosted cross-compiler. If it is a Canadian cross, then the result is @emph{1}; otherwise @emph{0}. @quotation @@ -2662,12 +2678,12 @@ result is @emph{1}; otherwise @emph{0}. @findex ishost Tests for a particular host environment. If the currently configured -host matches the argument string, the result is @emph{1}; otherwise the -result is @emph{0}. @emph{pattern} must be a full three-part configure -triplet; in particular, you may not use the shorter aliases supported by -@code{configure} (but you can use Tcl globbing to specify a range of -triplets). If called with no arguments or an empty pattern, this -procedure returns the host triplet. +host matches the argument string, the result is @emph{1}; otherwise +the result is @emph{0}. @emph{pattern} must be a full three-part +configure triplet; in particular, you may not use the shorter aliases +supported by @code{configure} (but you can use Tcl globbing to specify +a range of triplets). If called with no arguments or an empty +pattern, this procedure returns the host triplet. @quotation @t{@b{ishost} @i{pattern}} @@ -2677,13 +2693,13 @@ procedure returns the host triplet. @subsubheading istarget Procedure @findex istarget -Tests for a particular target environment. If the currently configured -target matches the argument string, the result is @emph{1} ; otherwise -the result is @emph{0}. @emph{pattern} must be a full three-part -configure triplet; in particular, you may not use the shorter aliases -supported by @code{configure} (but you can use Tcl globbing to specify a -range of triplets). If called with no arguments or an empty pattern, -this procedure returns the target triplet. +Tests for a particular target environment. If the currently +configured target matches the argument string, the result is @emph{1} +; otherwise the result is @emph{0}. @emph{pattern} must be a full +three-part configure triplet; in particular, you may not use the +shorter aliases supported by @code{configure} (but you can use Tcl +globbing to specify a range of triplets). If called with no arguments +or an empty pattern, this procedure returns the target triplet. @quotation @t{@b{istarget} @i{pattern} } @@ -2694,7 +2710,7 @@ this procedure returns the target triplet. @findex isnative This procedure returns @emph{1} if the current configuration has the -same host and target (ie. it is a native configuration). Otherwise it +same host and target (ie. it is a native configuration). Otherwise it returns @emph{0}. @quotation @@ -2709,7 +2725,8 @@ returns @emph{0}. @t{@b{log_and_exit}} @end quotation -This procedure writes out the end of the test log and terminates @code{runtest}. +This procedure writes out the end of the test log and terminates +@code{runtest}. @node log_summary procedure, setup_xfail procedure, log_and_exit procedure, Core Internal Procedures @@ -2745,17 +2762,16 @@ unexpected success!) from other test outcomes. @strong{Warning} -Warning you must clear the expected failure after using setup_xfail in a -test case. Any call to @code{pass }or @code{fail} clears the expected -failure implicitly; if the test has some other outcome, e.g. an error, -you can call @code{clear_xfail} to clear the expected failure -explicitly. Otherwise, the expected-failure declaration applies to -whatever test runs next, leading to surprising results. +Warning you must clear the expected failure after using setup_xfail in +a test case. Any call to @code{pass }or @code{fail} clears the +expected failure implicitly; if the test has some other outcome, +e.g. an error, you can call @code{clear_xfail} to clear the expected +failure explicitly. Otherwise, the expected-failure declaration +applies to whatever test runs next, leading to surprising results. @end quotation @quotation -@t{@b{setup_xfail} @i{config} -@i{bugid}} +@t{@b{setup_xfail} @i{config} @i{bugid}} @end quotation @table @asis @@ -2764,14 +2780,15 @@ The config triplet to trigger whether this is an unexpected or expect failure. @item @code{bugid} -The optional bugid, used to tie this test case to a bug tracking system. +The optional bugid, used to tie this test case to a bug tracking +system. @end table @node pass procedure, fail procedure, setup_xfail procedure, Core Internal Procedures @subsubheading pass Procedure @findex pass -Declares a test to have passed. @code{pass} writes in the log files a +Declares a test to have passed. @code{pass} writes in the log files a message beginning with @emph{PASS} (or @emph{XPASS}, if failure was expected), appending the @code{message} argument. @@ -2808,7 +2825,7 @@ Declares a test to have passed when it was expected to fail. @subsubheading xfail Procedure @findex xfail -Declares a test to have expectedly failed. @code{xfail} writes in the +Declares a test to have expectedly failed. @code{xfail} writes in the log files a message beginning with @emph{XFAIL} (or @emph{PASS}, if success was expected), appending the @code{message} argument. @@ -2820,9 +2837,9 @@ success was expected), appending the @code{message} argument. @subsubheading set_warning_threshold Procedure @findex set_warning_threshold -Sets the value of @code{warning_threshold}. A value of @emph{0} disables -it: calls to @code{warning} will not turn a @emph{PASS} or @emph{FAIL} -into an @emph{UNRESOLVED}. +Sets the value of @code{warning_threshold}. A value of @emph{0} +disables it: calls to @code{warning} will not turn a @emph{PASS} or +@emph{FAIL} into an @emph{UNRESOLVED}. @quotation @t{@b{set_warning_threshold} @i{threshold}} @@ -2838,9 +2855,9 @@ This is the value of the new warning threshold. @subsubheading get_warning_threshold Procedure @findex get_warning_threshold -Returns the current value of @code{@{warning_threshold}. The default -value is 3. This value controls how many @code{warning} procedures can -be called before becoming @emph{UNRESOLVED}. +Returns the current value of @code{@{warning_threshold}. The default +value is 3. This value controls how many @code{warning} procedures +can be called before becoming @emph{UNRESOLVED}. @quotation @t{@b{get_warning_threshold}} @@ -2850,22 +2867,23 @@ be called before becoming @emph{UNRESOLVED}. @subsubheading warning Procedure @findex warning -Declares detection of a minor error in the test case -itself. @code{warning} writes in the log files a message beginning with +Declares detection of a minor error in the test case itself. +@code{warning} writes in the log files a message beginning with @emph{WARNING}, appending the argument @code{string}. Use @code{warning} rather than @code{perror} for cases (such as -communication failure to be followed by a retry) where the test case can -recover from the error. If the optional @code{number} is supplied, then -this is used to set the internal count of warnings to that value. +communication failure to be followed by a retry) where the test case +can recover from the error. If the optional @code{number} is +supplied, then this is used to set the internal count of warnings to +that value. -As a side effect, @code{warning_threshold} or more calls to warning in a -single test case also changes the effect of the next @code{pass} or -@code{fail} command: the test outcome becomes @emph{UNRESOLVED} since an -automatic @emph{PASS} or @emph{FAIL} may not be trustworthy after many -warnings. If the optional numeric value is @emph{0}, then there are no -further side effects to calling this function, and the following test -outcome doesn't become @emph{UNRESOLVED}. This can be used for errors -with no known side effects. +As a side effect, @code{warning_threshold} or more calls to warning in +a single test case also changes the effect of the next @code{pass} or +@code{fail} command: the test outcome becomes @emph{UNRESOLVED} since +an automatic @emph{PASS} or @emph{FAIL} may not be trustworthy after +many warnings. If the optional numeric value is @emph{0}, then there +are no further side effects to calling this function, and the +following test outcome doesn't become @emph{UNRESOLVED}. This can be +used for errors with no known side effects. @quotation @t{@b{warning} @i{messsage} @i{number} } @@ -2877,27 +2895,27 @@ with no known side effects. The warning message. @item @code{number} -The optional number to set the error counter. This is only used to fake -out the counter when using the @code{xfail} procedure to control when it -flips the output over to @emph{UNRESOLVED} state. +The optional number to set the error counter. This is only used to +fake out the counter when using the @code{xfail} procedure to control +when it flips the output over to @emph{UNRESOLVED} state. @end table @node perror procedure, note procedure, warning procedure, Core Internal Procedures @subsubheading perror Procedure @findex perror -Declares a severe error in the testing framework itself. @code{perror} -writes in the log files a message beginning with @emph{ERROR}, appending -the argument @code{string}. +Declares a severe error in the testing framework itself. +@code{perror} writes in the log files a message beginning with +@emph{ERROR}, appending the argument @code{string}. -As a side effect, perror also changes the effect of the next @code{pass} -or @code{fail} command: the test outcome becomes @emph{UNRESOLVED}, -since an automatic @emph{PASS} or @emph{FAIL} cannot be trusted after a -severe error in the test framework. If the optional numeric value is -@emph{0}, then there are no further side effects to calling this -function, and the following test outcome doesn't become -@emph{UNRESOLVED}. This can be used for errors with no known side -effects. +As a side effect, perror also changes the effect of the next +@code{pass} or @code{fail} command: the test outcome becomes +@emph{UNRESOLVED}, since an automatic @emph{PASS} or @emph{FAIL} +cannot be trusted after a severe error in the test framework. If the +optional numeric value is @emph{0}, then there are no further side +effects to calling this function, and the following test outcome +doesn't become @emph{UNRESOLVED}. This can be used for errors with no +known side effects. @quotation @t{@b{perror} @i{message} @i{number} } @@ -2908,21 +2926,21 @@ effects. The message to be logged. @item @code{number} -The optional number to set the error counter. This is only used to fake -out the counter when using the @code{xfail} procedure to control when it -flips the output over to @emph{UNRESOLVED} state. +The optional number to set the error counter. This is only used to +fake out the counter when using the @code{xfail} procedure to control +when it flips the output over to @emph{UNRESOLVED} state. @end table @node note procedure, untested procedure, perror procedure, Core Internal Procedures @subsubheading note Procedure @findex note -Appends an informational message to the log file. @code{note} writes in -the log files a message beginning with @emph{NOTE}, appending the -@code{message} argument. Use @code{note} sparingly. The @code{verbose} -should be used for most such messages, but in cases where a message is -needed in the log file regardless of the verbosity level use -@code{note}. +Appends an informational message to the log file. @code{note} writes +in the log files a message beginning with @emph{NOTE}, appending the +@code{message} argument. Use @code{note} sparingly. The +@code{verbose} should be used for most such messages, but in cases +where a message is needed in the log file regardless of the verbosity +level use @code{note}. @quotation @t{@b{note} @i{messsage} } @@ -2933,9 +2951,9 @@ needed in the log file regardless of the verbosity level use @subsubheading untested Procedure @findex untested -Declares a test was not run. @code{untested} writes in the log file a +Declares a test was not run. @code{untested} writes in the log file a message beginning with @emph{UNTESTED}, appending the @code{message} -argument. For example, you might use this in a dummy test whose only +argument. For example, you might use this in a dummy test whose only role is to record that a test does not yet exist for some feature. @quotation @@ -2947,11 +2965,11 @@ role is to record that a test does not yet exist for some feature. @subsubheading unresolved Procedure @findex unresolved -Declares a test to have an unresolved outcome. @code{unresolved} writes -in the log file a message beginning with @emph{UNRESOLVED}, appending -the @code{message} argument. This usually means the test did not -execute as expected, and a human being must go over results to determine -if it passed or failed (and to improve the test case). +Declares a test to have an unresolved outcome. @code{unresolved} +writes in the log file a message beginning with @emph{UNRESOLVED}, +appending the @code{message} argument. This usually means the test +did not execute as expected, and a human being must go over results to +determine if it passed or failed (and to improve the test case). @quotation @t{@b{unresolved} @i{message} } @@ -2963,9 +2981,9 @@ if it passed or failed (and to improve the test case). @findex unsupported Declares that a test case depends on some facility that does not exist -in the testing environment. @code{unsupported} writes in the log file a -message beginning with @emph{UNSUPPORTED}, appending the @code{message} -argument. +in the testing environment. @code{unsupported} writes in the log file +a message beginning with @emph{UNSUPPORTED}, appending the +@code{message} argument. @quotation @t{@b{unsupported} @i{message} } @@ -2977,11 +2995,11 @@ argument. @findex transform Generates a string for the name of a tool as it was configured and -installed, given its native name (as the argument @code{toolname}). This -makes the assumption that all tools are installed using the same naming -conventions: For example, for a cross compiler supporting the -@emph{m68k-vxworks} configuration, the result of transform @code{gcc} is -@code{m68k-vxworks-gcc}. +installed, given its native name (as the argument @code{toolname}). +This makes the assumption that all tools are installed using the same +naming conventions: For example, for a cross compiler supporting the +@emph{m68k-vxworks} configuration, the result of transform @code{gcc} +is @code{m68k-vxworks-gcc}. @quotation @t{@b{transform} @i{toolname}} @@ -2997,26 +3015,28 @@ The name of the cross-development program to transform. @subsubheading check_conditional_xfail Procedure @findex check_conditional_xfail -This procedure adds a conditional xfail, based on compiler options used -to create a test case executable. If an include options is found in the -compiler flags, and it's the right architecture, it'll trigger an -@emph{XFAIL}. Otherwise it'll produce an ordinary @emph{FAIL}. You can -also specify flags to exclude. This makes a result be a @emph{FAIL}, -even if the included options are found. To set the conditional, set the -variable @code{compiler_conditional_xfail_data} to the fields +This procedure adds a conditional xfail, based on compiler options +used to create a test case executable. If an include options is found +in the compiler flags, and it's the right architecture, it'll trigger +an @emph{XFAIL}. Otherwise it'll produce an ordinary @emph{FAIL}. +You can also specify flags to exclude. This makes a result be a +@emph{FAIL}, even if the included options are found. To set the +conditional, set the variable @code{compiler_conditional_xfail_data} +to the fields @example "[message string] [targets list] [includes list] [excludes list]" @end example -(descriptions below). This is the checked at pass/fail decision time, so -there is no need to call the procedure yourself, unless you wish to know -if it gets triggered. After a pass/fail, the variable is reset, so it -doesn't effect other tests. It returns @emph{1} if the conditional is -true, or @emph{0} if the conditional is false. +(descriptions below). This is the checked at pass/fail decision time, +so there is no need to call the procedure yourself, unless you wish to +know if it gets triggered. After a pass/fail, the variable is reset, +so it doesn't effect other tests. It returns @emph{1} if the +conditional is true, or @emph{0} if the conditional is false. @quotation -@t{@b{check_conditional_xfail} @i{message} @i{targets} @i{includes} @i{excludes}} +@t{@b{check_conditional_xfail} @i{message} @i{targets} @i{includes} +@i{excludes}} @end quotation @table @asis @@ -3025,20 +3045,22 @@ true, or @emph{0} if the conditional is false. This is the message to print with the normal test result. @item @code{targets} -This is a string with the list targets to activate this conditional on. +This is a string with the list targets to activate this conditional +on. @item @code{includes} -This is a list of sets of options to search for in the compiler options -to activate this conditional. If the list of sets of options is empty -or if any set of the options matches, then this conditional is true. -(It may be useful to specify an empty list of include sets if the -conditional is always true unless one of the exclude sets matches.) +This is a list of sets of options to search for in the compiler +options to activate this conditional. If the list of sets of options +is empty or if any set of the options matches, then this conditional +is true. (It may be useful to specify an empty list of include sets +if the conditional is always true unless one of the exclude sets +matches.) @item @code{excludes} -This is a list of sets of options to search for in the compiler options -to activate this conditional. If any set of the options matches, -(regardless of whether any of the include sets match) then this -conditional is de-activated. +This is a list of sets of options to search for in the compiler +options to activate this conditional. If any set of the options +matches, (regardless of whether any of the include sets match) then +this conditional is de-activated. @end table @strong{Specifying the conditional xfail data} @@ -3054,20 +3076,21 @@ set compiler_conditional_xfail_data @{ \ What this does is it matches only for these two targets if @code{-Wall -v} or @code{-O3} is set, but neither @code{-O1} or @code{-Map} is -set. For a set to match, the options specified are searched for +set. For a set to match, the options specified are searched for independently of each other, so a @code{-Wall -v} matches either -@code{-Wall -v} or @code{-v -Wall}. A space separates the options in the -string. Glob patterns are also permitted. +@code{-Wall -v} or @code{-v -Wall}. A space separates the options in +the string. Glob patterns are also permitted. @node clear_xfail procedure, verbose procedure, check_conditional_xfail procedure, Core Internal Procedures @subsubheading clear_xfail Procedure @findex clear_xfail -Cancel an expected failure (previously declared with @code{setup_xfail}) -for a particular set of configurations. The @code{config} argument is a -list of configuration target names. It is only necessary to call -@code{clear_xfail} if a test case ends without calling either -@code{pass} or @code{fail}, after calling @code{setup_xfail}. +Cancel an expected failure (previously declared with +@code{setup_xfail}) for a particular set of configurations. The +@code{config} argument is a list of configuration target names. It is +only necessary to call @code{clear_xfail} if a test case ends without +calling either @code{pass} or @code{fail}, after calling +@code{setup_xfail}. @quotation @t{@b{clear_xfail} @i{config}} @@ -3083,11 +3106,11 @@ The system triplets to clear. @subsubheading verbose Procedure @findex verbose -Test cases can use this procedure to issue helpful messages depending on -the number of @code{-v}/@code{--verbose} options passed on the command -line to @code{runtest}. It prints @i{message} if the value of the -number of @code{-v} options passed is greater than or equal to the -@i{loglevel} argument. The default log level is 1. +Test cases can use this procedure to issue helpful messages depending +on the number of @code{-v}/@code{--verbose} options passed on the +command line to @code{runtest}. It prints @i{message} if the value of +the number of @code{-v} options passed is greater than or equal to the +@i{loglevel} argument. The default log level is 1. @quotation @t{ @b{verbose} @@ -3101,8 +3124,8 @@ number of @code{-v} options passed is greater than or equal to the @table @asis @item @code{-log} -Always write @i{message} to the log file, even if it won't be printed on -the console. +Always write @i{message} to the log file, even if it won't be printed +on the console. @item @code{-x} Log the @i{message} into an XML file. @@ -3117,7 +3140,7 @@ Use this option if @i{message} begins with @samp{-}. The log messsage. @item @code{loglevel} -The specified log level. The default level is 1. +The specified log level. The default level is 1. @end table @node load_lib procedure, testsuite procedure, verbose procedure, Core Internal Procedures @@ -3125,13 +3148,13 @@ The specified log level. The default level is 1. @findex load_lib @code{load_lib} loads a DejaGnu library file by searching the default -fixed paths built into DejaGnu. If DejaGnu has been installed, it looks -in a path starting with the installed library directory. If you are -running DejaGnu directly from a source directory, without first running -@code{make install}, this path defaults to the current directory. In -either case, it then looks in the current directory for a directory -called @file{lib}. If there are duplicate definitions, the last one -loaded takes precedence over the earlier ones. +fixed paths built into DejaGnu. If DejaGnu has been installed, it +looks in a path starting with the installed library directory. If you +are running DejaGnu directly from a source directory, without first +running @code{make install}, this path defaults to the current +directory. In either case, it then looks in the current directory for +a directory called @file{lib}. If there are duplicate definitions, +the last one loaded takes precedence over the earlier ones. @quotation @t{@b{load_lib} @i{filespec}} @@ -3165,8 +3188,8 @@ providing information about the current testsuite. @subsubheading testsuite file -The @code{testsuite file} command returns an absolute file name specified -relative to either the testsuite source or object trees. +The @code{testsuite file} command returns an absolute file name +specified relative to either the testsuite source or object trees. @quotation @t{ @b{testsuite file} @@ -3204,25 +3227,25 @@ Use this option if the first @i{name} could begin with @samp{-}. One of @code{-top} or @code{-test} must be given; an error is raised otherwise. -Unless the @code{-hypothetical} option is given, any directories implied -by the returned value will exist upon return. Implied directories are -created in the object tree if needed. An error is raised if an implied -directory does not exist in the source tree. +Unless the @code{-hypothetical} option is given, any directories +implied by the returned value will exist upon return. Implied +directories are created in the object tree if needed. An error is +raised if an implied directory does not exist in the source tree. @node Procedures For Remote Communication, connprocs, Core Internal Procedures, Built-in Procedures @section Procedures For Remote Communication The file @file{lib/remote.exp} defines procedures for establishing and -managing communications. Each of these procedures tries to establish the -connection up to three times before returning. Warnings (if retries will -continue) or errors (if the attempt is abandoned) report on -communication failures. The result for any of these procedures is +managing communications. Each of these procedures tries to establish +the connection up to three times before returning. Warnings (if +retries will continue) or errors (if the attempt is abandoned) report +on communication failures. The result for any of these procedures is either @emph{-1}, when the connection cannot be established, or the spawn ID returned by the Expect command @code{spawn}. It use the value of the @code{connect} field in the @code{target_info} -array as the type of connection to make. Current supported connection -types are ssh, tip, kermit, telnet, rsh, and rlogin. If the +array as the type of connection to make. Current supported connection +types are ssh, tip, kermit, telnet, rsh, and rlogin. If the @code{--reboot} option was used on the @command{runtest} command line, then the target is rebooted before the connection is made. @@ -3278,9 +3301,10 @@ then the target is rebooted before the connection is made. @subsubheading call_remote Procedure @findex call_remote -A standard procedure to call the appropriate @i{proc}. This proceure +A standard procedure to call the appropriate @i{proc}. This proceure first looks for a board-specific version, then a protocol-specific -version, and finally @code{call_remote} will call @code{standard_$proc}. +version, and finally @code{call_remote} will call +@code{standard_$proc}. @quotation @t{@b{call_remote} @i{type} @i{proc} @i{dest} @i{args}} @@ -3296,10 +3320,10 @@ version, and finally @code{call_remote} will call @code{standard_$proc}. @subsubheading check_for_board_status Procedure @findex check_for_board_status -This procedure inspected the named variable within the calling procedure -for the expected output from the status wrapper. A non-negative value is -returned if it exists. Otherwise, it returns -1. The output from the -status wrapper is removed from the variable. +This procedure inspected the named variable within the calling +procedure for the expected output from the status wrapper. A +non-negative value is returned if it exists. Otherwise, it returns +-1. The output from the status wrapper is removed from the variable. @quotation @t{@b{check_for_board_status} @i{variable}} @@ -3307,8 +3331,8 @@ status wrapper is removed from the variable. @table @asis @item @code{variable} -The name of the variable to check in the calling procedure. Be sure to -pass the name of the variable (@code{var}) and not the value of the +The name of the variable to check in the calling procedure. Be sure +to pass the name of the variable (@code{var}) and not the value of the variable (@code{$var}). @end table @@ -3347,10 +3371,10 @@ variable (@code{$var}). Run the specified command on the local machine, redirecting input from file @code{inp} (if non-empty), redirecting output to file @code{outp} (if non-empty), and waiting @code{timeout} seconds for the command to -complete before killing it. A two-element list is returned: the exit -status of the command and any output produced by the command. If output -is redirected, this may or may not be empty. If output is redirected, -both stdout and stderr will appear in the specified file. +complete before killing it. A two-element list is returned: the exit +status of the command and any output produced by the command. If +output is redirected, this may or may not be empty. If output is +redirected, both stdout and stderr will appear in the specified file. @quotation @t{@b{local_exec} @i{commandline} @i{inp} @i{outp} @i{timeout}} @@ -3372,8 +3396,8 @@ Timeout in seconds. @subsubheading remote_binary Procedure @findex remote_binary -This procedure sets the connection into @i{binary} mode. That is, there -is no processing of input characters. +This procedure sets the connection into @i{binary} mode. That is, +there is no processing of input characters. @quotation @t{@b{remote_binary} @i{host}} @@ -3395,24 +3419,22 @@ The host on which to set a binary connection. @table @asis @item @code{shellid} -This is the value returned by a call to @code{remote_open}. This closes -the connection to the target so resources can be used by others. This -parameter can be left off if the @code{fileid} field in the -@code{target_info} array is set. +This is the value returned by a call to @code{remote_open}. This +closes the connection to the target so resources can be used by +others. This parameter can be left off if the @code{fileid} field in +the @code{target_info} array is set. @end table @node remote_download procedure, remote_exec procedure, remote_close procedure, Procedures For Remote Communication @subsubheading remote_download Procedure @findex remote_download -Download a file to a destination machine. This procedure returns either -an empty string (indicating failure) or the name of the file on the -destination macine. +Download a file to a destination machine. This procedure returns +either an empty string (indicating failure) or the name of the file on +the destination macine. @quotation -@t{@b{remote_download} @i{dest} -@i{file} -@i{args}} +@t{@b{remote_download} @i{dest} @i{file} @i{args}} @end quotation @table @asis @@ -3423,18 +3445,18 @@ Destination machine name. Filename. @item @code{args} -If the optional destination filename is specified, that filename will be -used on the destination machine. +If the optional destination filename is specified, that filename will +be used on the destination machine. @end table @node remote_exec procedure, remote_expect procedure, remote_download procedure, Procedures For Remote Communication @subsubheading remote_exec Procedure @findex remote_exec -Execute the supplied program on a remote host. A two-element list is -returned. The first element is the exit status of the program or -1 if -execution failed. The second element is any output produced by the -program. This may be an empty string if output from the program was +Execute the supplied program on a remote host. A two-element list is +returned. The first element is the exit status of the program or -1 +if execution failed. The second element is any output produced by the +program. This may be an empty string if output from the program was redirected. @quotation @@ -3519,9 +3541,9 @@ There are four optional arguments: @subsubheading remote_open Procedure @findex remote_open -Open connection to a remote host or target. This requires the +Open connection to a remote host or target. This requires the @code{target_info} array be filled in with the proper information to -work. It returns the spawn id of the process that is the connection. +work. It returns the spawn id of the process that is the connection. @quotation @t{@b{remote_open} @i{type}} @@ -3529,22 +3551,22 @@ work. It returns the spawn id of the process that is the connection. @table @asis @item @code{type} -This is passed @code{host} or @code{target}. Host or target refers to -whether it is a connection to a remote target, or a remote host. This +This is passed @code{host} or @code{target}. Host or target refers to +whether it is a connection to a remote target, or a remote host. This opens the connection to the desired target or host using the default -values in the configuration system. It returns that @code{spawn_id} of -the process that manages the connection. This value can be used in -Expect or @code{exp_send} statements, or passed to other procedures that -need the connection process's id. This also sets the @code{fileid} field -in the @code{target_info} array. +values in the configuration system. It returns that @code{spawn_id} +of the process that manages the connection. This value can be used in +Expect or @code{exp_send} statements, or passed to other procedures +that need the connection process's id. This also sets the +@code{fileid} field in the @code{target_info} array. @end table @node remote_pop_conn procedure, remote_push_conn procedure, remote_open procedure, Procedures For Remote Communication @subsubheading remote_pop_conn Procedure @findex remote_pop_conn -Pop a previously-pushed connection from the stack. You should have -closed the current connection before calling this procedure. Returns +Pop a previously-pushed connection from the stack. You should have +closed the current connection before calling this procedure. Returns @code{pass} or @code{fail}. @quotation @@ -3559,7 +3581,7 @@ closed the current connection before calling this procedure. Returns @subsubheading remote_push_conn Procedure @findex remote_push_conn -Pushes the current connection onto a stack. Returns @code{pass} or +Pushes the current connection onto a stack. Returns @code{pass} or @code{fail}. @quotation @@ -3704,10 +3726,10 @@ Pushes the current connection onto a stack. Returns @code{pass} or @subsubheading remote_reboot Procedure @findex remote_reboot -Reboot the host. The return value of this procedure depends on the +Reboot the host. The return value of this procedure depends on the actual implementation of reboot that will be used, in practice it is -expected that @code{remote_reboot} returns @b{1} on success and @b{0} on -failure. +expected that @code{remote_reboot} returns @b{1} on success and @b{0} +on failure. @quotation @t{@b{remote_reboot} @i{host}} @@ -3734,11 +3756,11 @@ failure. @subsubheading remote_spawn Procedure @findex remote_spawn -Start a command on the destination. By default it is not possible to -redirect I/O. If the command is successfully started, a positive spawn -ID is returned. If the spawn fails, a negative value will be -returned. Once the command has started, you can interact with it using -@code{remote_expect} and @code{remote_wait} procedures. +Start a command on the destination. By default it is not possible to +redirect I/O. If the command is successfully started, a positive +spawn ID is returned. If the spawn fails, a negative value will be +returned. Once the command has started, you can interact with it +using @code{remote_expect} and @code{remote_wait} procedures. @quotation @t{@b{remote_spawn} @i{dest} @i{commandline} @i{args}} @@ -3760,8 +3782,8 @@ command may be redirected. @subsubheading remote_swap_conn Procedure @findex remote_swap_conn -Swap the current connection with the topmost one on the stack. Returns -@code{pass} or @code{fail}. +Swap the current connection with the topmost one on the stack. +Returns @code{pass} or @code{fail}. @quotation @t{@b{remote_swap_conn} @i{host}} @@ -3802,9 +3824,9 @@ Swap the current connection with the topmost one on the stack. Returns @subsubheading remote_wait Procedure @findex remote_wait -Wait for the last spawned command on the destination to complete. A list -of two values is returned: the exit status (-1 if the program timed -out) and any output produced by the command. +Wait for the last spawned command on the destination to complete. A +list of two values is returned: the exit status (-1 if the program +timed out) and any output produced by the command. @quotation @t{@b{remote_wait} @i{dest} @i{timeout}} @@ -3837,7 +3859,7 @@ The host to close the connection to. @subsubheading standard_download Procedure @findex standard_download -Downloads a file to a destination. It returns either the empty string +Downloads a file to a destination. It returns either the empty string (indicating failure) or the name of the file on the destination. @quotation @@ -3852,8 +3874,8 @@ Destination board. The name of the file to download. @item @code{destfile} -If the optional @i{destile} is specified, that filename will be used on -the destination board. +If the optional @i{destile} is specified, that filename will be used +on the destination board. @end table @node standard_exec procedure, standard_file procedure, standard_download procedure, Procedures For Remote Communication @@ -3900,9 +3922,9 @@ the destination board. @findex standard_reboot It looks like that this procedure is never called, instead -@code{$@{board@}_reboot} defined in @file{base-config.exp} will be used -because it has higher priority and @file{base-config.exp} is always -imported by @code{runtest}. +@code{$@{board@}_reboot} defined in @file{base-config.exp} will be +used because it has higher priority and @file{base-config.exp} is +always imported by @code{runtest}. @quotation @t{@b{standard_reboot} @i{host}} @@ -3942,8 +3964,8 @@ imported by @code{runtest}. @subsubheading standard_transmit Procedure @findex standard_transmit -The default transmit procedure if none other exists. This feeds the file -directly into the connection. +The default transmit procedure if none other exists. This feeds the +file directly into the connection. @quotation @t{@b{standard_transmit} @i{dest} @i{file}} @@ -3987,8 +4009,8 @@ File to transmit. @subsubheading unix_clean_filename Procedure @findex unix_clean_filename -This procedure returns an absolute version of the filename argument with -@samp{.} and @samp{..} removed. +This procedure returns an absolute version of the filename argument +with @samp{.} and @samp{..} removed. @quotation @t{@b{unix_clean_filename} @i{dest} @i{file}} @@ -4099,7 +4121,7 @@ and returns the spawn id (or -1 for error). The host to connect to with TELNET. @item @code{args} -A list of options. Currently the only supported option is @code{raw}. +A list of options. Currently the only supported option is @code{raw}. @end table @node telnet_binary procedure, tip_open procedure, telnet_open procedure, connprocs @@ -4121,9 +4143,9 @@ Hostname for the connection. @subsubheading tip_open Procedure @findex tip_open -Connect to a host using @code{tip(1)}. This procedure sets the board -@code{fileid} field with the @code{spawn_id} on success and, otherwise, -returns -1. +Connect to a host using @code{tip(1)}. This procedure sets the board +@code{fileid} field with the @code{spawn_id} on success and, +otherwise, returns -1. @quotation @t{@b{tip_open} @i{hostname}} @@ -4151,8 +4173,7 @@ Hostname to connect to. @findex rlogin_spawn @quotation -@t{@b{rlogin_spawn} @i{dest} -@i{cmdline}} +@t{@b{rlogin_spawn} @i{dest} @i{cmdline}} @end quotation @table @asis @@ -4414,7 +4435,8 @@ This is the filename to download. @findex default_target_compile @quotation -@t{@b{default_target_compile} @i{source} @i{destfile} @i{type} @i{options}} +@t{@b{default_target_compile} @i{source} @i{destfile} @i{type} +@i{options}} @end quotation @table @asis @@ -4465,8 +4487,7 @@ This is the filename to download. @findex push_config @quotation -@t{@b{push_config} @i{type} -@i{name}} +@t{@b{push_config} @i{type} @i{name}} @end quotation @table @asis @@ -4584,9 +4605,8 @@ Value to set the field to. @subsubheading add_board_info Procedure @findex add_board_info -This treats @code{board_info} array's field -@emph{entry} as a TCL list and adds -@emph{value} at the end. +This treats @code{board_info} array's field @emph{entry} as a TCL list +and adds @emph{value} at the end. @quotation @t{@b{add_board_info} @i{entry} @i{value}} @@ -4631,8 +4651,8 @@ The value to add to the field. @subsubheading unset_board_info Procedure @findex unset_board_info -This checks if @code{board_info} array's field @emph{entry} has been set -and if so, then removes it. +This checks if @code{board_info} array's field @emph{entry} has been +set and if so, then removes it. @quotation @t{@b{unset_board_info} @i{entry}} @@ -4711,24 +4731,25 @@ This unsets the current host connection. @section Platform Dependent Procedures Each combination of target and tool requires some target-dependent -procedures. The names of these procedures have a common form: the tool -name, followed by an underscore @emph{_}, and finally a suffix -describing the procedure's purpose. For example, a procedure to extract -the version from GDB is called @code{gdb_version}. +procedures. The names of these procedures have a common form: the +tool name, followed by an underscore @emph{_}, and finally a suffix +describing the procedure's purpose. For example, a procedure to +extract the version from GDB is called @code{gdb_version}. @code{runtest} itself calls only two of these procedures, -@code{$@{tool@}_exit} and @code{$@{tool@}_version}; these procedures use -no arguments. +@code{$@{tool@}_exit} and @code{$@{tool@}_version}; these procedures +use no arguments. The other two procedures, @code{$@{tool@}_start} and -@code{$@{tool@}_load}, are only called by the test suites themselves (or -by testsuite-specific initialization code); they may take arguments or -not, depending on the conventions used within each testsuite. +@code{$@{tool@}_load}, are only called by the test suites themselves +(or by testsuite-specific initialization code); they may take +arguments or not, depending on the conventions used within each +testsuite. The usual convention for return codes from any of these procedures -(although it is not required by @code{runtest}) is to return @emph{0} if -the procedure succeeded, @emph{1} if it failed, and @emph{-1} if there -was a communication error. +(although it is not required by @code{runtest}) is to return @emph{0} +if the procedure succeeded, @emph{1} if it failed, and @emph{-1} if +there was a communication error. @menu * $@{tool@}_start Procedure: $@{tool@}_start procedure @@ -4742,21 +4763,21 @@ was a communication error. @findex $@{tool@}_start Starts a particular tool. For an interactive tool, -@code{$@{tool@}_start} starts and initializes the tool, leaving the tool -up and running for the test cases; an example is @code{gdb_start}, the -start function for GDB. For a batch-oriented tool, -@code{$@{tool@}_start} is optional; the recommended convention is to let -@code{$@{tool@}_start} run the tool, leaving the output in a variable -called @code{comp_output}. Test scripts can then analyze +@code{$@{tool@}_start} starts and initializes the tool, leaving the +tool up and running for the test cases; an example is +@code{gdb_start}, the start function for GDB. For a batch-oriented +tool, @code{$@{tool@}_start} is optional; the recommended convention +is to let @code{$@{tool@}_start} run the tool, leaving the output in a +variable called @code{comp_output}. Test scripts can then analyze @code{$comp_output} to determine the test results. An example of this second kind of start function is @code{gcc_start}, the start function for GCC. -DejaGnu itself does not call @code{$@{tool@}_start}. The initialization -module @code{$@{tool@}_init.exp} must call @code{$@{tool@}_start} for -interactive tools; for batch-oriented tools, each individual test script -calls @code{$@{tool@}_start} (or makes other arrangements to run the -tool). +DejaGnu itself does not call @code{$@{tool@}_start}. The +initialization module @code{$@{tool@}_init.exp} must call +@code{$@{tool@}_start} for interactive tools; for batch-oriented +tools, each individual test script calls @code{$@{tool@}_start} (or +makes other arrangements to run the tool). @quotation @t{@b{$@{tool@}_start}} @@ -4766,16 +4787,17 @@ tool). @subsubheading $@{tool@}_load Procedure @findex $@{tool@}_load -Loads something into a tool. For an interactive tool, this conditions -the tool for a particular test case; for example, @code{gdb_load} loads -a new executable file into the debugger. For batch-oriented tools, -@code{$@{tool@}_load} may do nothing---though, for example, the GCC -support uses @code{gcc_load} to load and run a binary on the target -environment. Conventionally, @code{$@{tool@}_load} leaves the output of -any program it runs in a variable called @code{$exec_output}. Writing -@code{$@{tool@}_load} can be the most complex part of extending DejaGnu -to a new tool or a new target, if it requires much communication coding -or file downloading. Test scripts call @code{$@{tool@}_load}. +Loads something into a tool. For an interactive tool, this conditions +the tool for a particular test case; for example, @code{gdb_load} +loads a new executable file into the debugger. For batch-oriented +tools, @code{$@{tool@}_load} may do nothing---though, for example, the +GCC support uses @code{gcc_load} to load and run a binary on the +target environment. Conventionally, @code{$@{tool@}_load} leaves the +output of any program it runs in a variable called +@code{$exec_output}. Writing @code{$@{tool@}_load} can be the most +complex part of extending DejaGnu to a new tool or a new target, if it +requires much communication coding or file downloading. Test scripts +call @code{$@{tool@}_load}. @quotation @t{@b{$@{tool@}_load}} @@ -4785,10 +4807,10 @@ or file downloading. Test scripts call @code{$@{tool@}_load}. @subsubheading $@{tool@}_exit Procedure @findex $@{tool@}_exit -Cleans up (if necessary) before DejaGnu exits. For interactive tools, +Cleans up (if necessary) before DejaGnu exits. For interactive tools, this usually ends the interactive session. You can also use @code{$@{tool@}_exit} to remove any temporary files left over from the -tests. @code{runtest} calls @code{$@{tool@}_exit}. +tests. @code{runtest} calls @code{$@{tool@}_exit}. @quotation @t{@b{$@{tool@}_exit}} @@ -4829,17 +4851,16 @@ tool, and its version number. @findex getdirs Returns a list of all the subdirectories in a single directory that -match a glob pattern. If no directories match the pattern, then an empty -list is returned. +match a glob pattern. If no directories match the pattern, then an +empty list is returned. -This procedure is specialized as a search for tests in -testsuites: @code{getdirs} ignores directories named -@samp{testsuite}, @samp{config}, or @samp{lib}, and also ignores -directories associated with a few revision control systems, -specifically Git (@samp{.git}), Subversion (@samp{.svn}), CVS -(@samp{CVS}), RCS (@samp{RCS}), and SCCS (@samp{SCCS}). These ignored -directories will not appear in the returned list, nor will they be -examined in a recursive search. +This procedure is specialized as a search for tests in testsuites: +@code{getdirs} ignores directories named @samp{testsuite}, +@samp{config}, or @samp{lib}, and also ignores directories associated +with a few revision control systems, specifically Git (@samp{.git}), +Subversion (@samp{.svn}), CVS (@samp{CVS}), RCS (@samp{RCS}), and SCCS +(@samp{SCCS}). These ignored directories will not appear in the +returned list, nor will they be examined in a recursive search. @quotation @t{@b{getdirs} @i{-all} @i{rootdir} @i{pattern}} @@ -4855,7 +4876,7 @@ recursively. The top level directory to start the search from. @item @code{pattern} -The Tcl glob pattern to match. If you do not specify @code{pattern}, +The Tcl glob pattern to match. If you do not specify @code{pattern}, @code{getdirs} uses a default pattern of @code{*}. @end table @@ -4876,18 +4897,19 @@ Return a relative file name, given a starting point. The starting point for relative file name traversal. @item @code{destination} -The absolute file name that should be reached by appending the return value to @i{base}. +The absolute file name that should be reached by appending the return +value to @i{base}. @end table @node find procedure, which procedure, relative_filename procedure, Utility Procedures @subsubheading find Procedure @findex find -Search for files whose names match a glob pattern. Search subdirectories -recursively, starting at a particular root directory. The result is the -list of files whose names match. Filenames in the result include all -intervening subdirectory names. If no files match the pattern, then an -empty string is returned. +Search for files whose names match a glob pattern. Search +subdirectories recursively, starting at a particular root directory. +The result is the list of files whose names match. Filenames in the +result include all intervening subdirectory names. If no files match +the pattern, then an empty string is returned. @quotation @t{@b{find} @i{rootdir} @i{pattern}} @@ -4907,9 +4929,9 @@ A glob pattern representing the files to find. Searches the execution path for an executable file like the BSD @code{which(1)} utility. This procedure uses the shell environment -variable @code{PATH}. It returns @b{0} if the binary is not in the path -or if the @code{PATH} environment variable is not set. If the file is in -the path, this procedure returns the full path to the file. +variable @code{PATH}. It returns @b{0} if the binary is not in the +path or if the @code{PATH} environment variable is not set. If the +file is in the path, this procedure returns the full path to the file. @quotation @t{@b{which} @i{file}} @@ -4925,8 +4947,8 @@ The executable program or shell script to look for. @findex grep Search a named file for lines that contain a match for a regular -expression. The result is a list of all the lines that match. If no -lines match, the result is an empty string. All of the Tcl regular +expression. The result is a list of all the lines that match. If no +lines match, the result is an empty string. All of the Tcl regular expression syntax is supported. @quotation @@ -4935,9 +4957,9 @@ expression syntax is supported. @table @asis @item @code{-n} -The @code{-n} option prefixes matched lines in the result with the line -number, just like GNU @code{grep} does. This option should be used in -preference to the @code{line} keyword documented below. +The @code{-n} option prefixes matched lines in the result with the +line number, just like GNU @code{grep} does. This option should be +used in preference to the @code{line} keyword documented below. @item @code{filename} The file to search. @@ -4948,24 +4970,25 @@ utility) to search for. @item @code{line} Use the optional keyword @code{line} to prefix matched lines in the -result with the line number. This usage is deprecated. +result with the line number. This usage is deprecated. @end table @node prune procedure, runtest_file_p procedure, grep procedure, Utility Procedures @subsubheading prune Procedure @findex prune -This procedure is deprecated and will be removed in a future release of -DejaGnu. If a testsuite uses this procedure, a copy of the procedure -should be made and placed in the @file{lib} directory of the testsuite. +This procedure is deprecated and will be removed in a future release +of DejaGnu. If a testsuite uses this procedure, a copy of the +procedure should be made and placed in the @file{lib} directory of the +testsuite. @node runtest_file_p procedure, diff procedure, prune procedure, Utility Procedures @subsubheading runtest_file_p Procedure @findex runtest_file_p Search @emph{runtest}s for @emph{testcase} and return @b{1} if found, -@b{0} if not. This is used by tools like compilers where each testcase -is a file. +@b{0} if not. This is used by tools like compilers where each +testcase is a file. @quotation @t{@b{runtest_file_p} @i{runtests} @i{testcase}} @@ -4987,7 +5010,7 @@ The filename of the current testcase under consideration. @findex diff Compares two files and returns @b{1} if they match (no differences) or -@b{0} if not. If @code{verbose} is set, then it will print the +@b{0} if not. If @code{verbose} is set, then it will print the differences to the console. @quotation @@ -5089,9 +5112,9 @@ systems. @subsubheading libgloss_link_flags Procedure @findex libgloss_link_flags -Finds the pieces of @code{libgloss} needed to link a set of object files -into an executable. This usually means setting the @code{-L} and -@code{-B} paths correctly. +Finds the pieces of @code{libgloss} needed to link a set of object +files into an executable. This usually means setting the @code{-L} +and @code{-B} paths correctly. @quotation @t{@b{libgloss_link_flags} @i{args} } @@ -5106,7 +5129,7 @@ Ignored. @subsubheading libgloss_include_flags Procedure @findex libgloss_include_flags -This procedure always returns an empty string. It is provided for +This procedure always returns an empty string. It is provided for consistency. @quotation @@ -5122,8 +5145,9 @@ Ignored. @subsubheading newlib_link_flags Procedure @findex newlib_link_flags -Return the options needed to link an executable with @code{newlib}. This -usually means setting the @code{-L} and @code{-B} paths correctly. +Return the options needed to link an executable with @code{newlib}. +This usually means setting the @code{-L} and @code{-B} paths +correctly. @quotation @t{@b{newlib_link_flags} @i{args}} @@ -5172,8 +5196,9 @@ Ignored. @t{@b{libio_link_flags} @i{args}} @end quotation -Return the options needed to link an executable with @code{libio}. This -usually means setting the @code{-L} and @code{-B} paths correctly. +Return the options needed to link an executable with @code{libio}. +This usually means setting the @code{-L} and @code{-B} paths +correctly. @table @asis @item @code{args} @@ -5204,8 +5229,9 @@ Ignored. @t{@b{g++_link_flags} @i{args}} @end quotation -Return the options needed to link an executable with @code{libg++}. This -usually means setting the @code{-L} and @code{-B} paths correctly. +Return the options needed to link an executable with @code{libg++}. +This usually means setting the @code{-L} and @code{-B} paths +correctly. @table @asis @item @code{args} @@ -5269,7 +5295,7 @@ Ignored. @findex find_gcc Looks for a copy of the GNU C compiler in the build tree and in the -@code{PATH}. This will also return the proper transformed name for a +@code{PATH}. This will also return the proper transformed name for a cross-compiler if the build tree is configured for one. @quotation @@ -5281,7 +5307,7 @@ cross-compiler if the build tree is configured for one. @findex find_gcj Looks for a copy of the GNU Java compiler in the build tree and in the -@code{PATH}. This will also return the proper transformed name for a +@code{PATH}. This will also return the proper transformed name for a cross-compiler if the build tree is configured for one. @quotation @@ -5293,7 +5319,7 @@ cross-compiler if the build tree is configured for one. @findex find_g++ Looks for a copy of the GNU C++ compiler in the build tree and in the -@code{PATH}. This will also return the proper transformed name for a +@code{PATH}. This will also return the proper transformed name for a cross-compiler if the build tree is configured for one. @quotation @@ -5305,7 +5331,7 @@ cross-compiler if the build tree is configured for one. @findex find_g77 Looks for a copy of the GNU Fortran 77 compiler in the build tree and -in the @code{PATH}. This will also return the proper transformed name +in the @code{PATH}. This will also return the proper transformed name for a cross-compiler if the build tree is configured for one. @quotation @@ -5317,8 +5343,8 @@ for a cross-compiler if the build tree is configured for one. @findex find_gfortran Looks for a copy of the GNU Fortran compiler in the build tree and in -the @code{PATH}. This will also return the proper transformed name for a -cross-compiler if the build tree is configured for one. +the @code{PATH}. This will also return the proper transformed name +for a cross-compiler if the build tree is configured for one. @quotation @t{@b{find_gfortran}} @@ -5436,7 +5462,7 @@ Tcl debugger. @c abbrev: dv This procedure prints the values of the global variables that match a -glob pattern. Abbreviation: @kbd{dv}. +glob pattern. Abbreviation: @kbd{dv}. @quotation @t{@b{dumpvars} @i{pattern}} @@ -5453,7 +5479,7 @@ The global variables to dump. @c abbrev: dl This procedure prints the values of local variables that match a glob -pattern. Abbreviation: @kbd{dl}. +pattern. Abbreviation: @kbd{dl}. @quotation @t{@b{dumplocals} @i{pattern} } @@ -5469,8 +5495,8 @@ The local variables to dump. @findex dumprocs @c abbrev: dp -This procedure dumps the body of all procs that match a glob pattern. It -is abbreviated as @kbd{dp}. +This procedure dumps the body of all procs that match a glob pattern. +It is abbreviated as @kbd{dp}. @quotation @t{@b{dumprocs} @i{pattern}} @@ -5486,8 +5512,8 @@ The proc bodies to dump. @findex dumpwatch @c abbrev: dw -This procedure prints all of the watchpoints matching a glob pattern. It -is abbreviated as @kbd{dw}. +This procedure prints all of the watchpoints matching a glob pattern. +It is abbreviated as @kbd{dw}. @quotation @t{@b{dumpwatch} @i{pattern}} @@ -5534,8 +5560,8 @@ The csh "glob" style pattern to look for. @findex watchunset @c abbrev: wu -This breaks program execution when the variable @code{var} is -unset. Abbreviation: @kbd{wu}. +This breaks program execution when the variable @code{var} is unset. +Abbreviation: @kbd{wu}. @quotation @t{@b{watchunset} @i{pattern}} @@ -5550,8 +5576,8 @@ unset. Abbreviation: @kbd{wu}. @findex watchwrite @c abbrev: ww -This breaks program execution when the variable @code{var} is -written. Abbreviation: @kbd{ww}. +This breaks program execution when the variable @code{var} is written. +Abbreviation: @kbd{ww}. @quotation @t{@b{watchwrite} @i{var}} @@ -5567,8 +5593,8 @@ The variable to watch. @findex watchread @c abbrev: wr -This breaks program execution when the variable @code{var} is -read. Abbreviation: @kbd{wr}. +This breaks program execution when the variable @code{var} is read. +Abbreviation: @kbd{wr}. @quotation @t{@b{watchread} @i{var}} @@ -5584,7 +5610,8 @@ The variable to watch. @findex watchdel @c abbrev: wd -This deletes a watchpoint from the watch list. Abbreviation: @kbd{wd}. +This deletes a watchpoint from the watch list. Abbreviation: +@kbd{wd}. @quotation @t{@b{watchdel} @i{pattern}} @@ -5598,7 +5625,7 @@ This deletes a watchpoint from the watch list. Abbreviation: @kbd{wd}. @subsubheading print Procedure @findex print -This prints the value of a variable. Abbreviation: @kbd{p}. +This prints the value of a variable. Abbreviation: @kbd{p}. @quotation @t{@b{print} @i{var}} @@ -5613,7 +5640,7 @@ The variable to print. @subsubheading quit Procedure @findex quit -This makes @code{runtest} exit. Abbreviation: @kbd{q}. +This makes @code{runtest} exit. Abbreviation: @kbd{q}. @quotation @t{@b{quit}} -- cgit v1.1