ReferenceObtaining &dj;You can obtain &dj; from the &dj; web site at the
Free Software Foundation,
which is at www.gnu.org/software/dejagnu/
InstallationOnce you have the &dj; source unpacked and available, you must
first configure the software to specify where it is to run (and the
associated defaults); then you can proceed to installing it.Configuring &dj;It is usually best to configure in a directory separate from the
source tree, specifying where to find the source with the optional
option to
configure. &dj; uses the GNU
autoconf to configure itself. For more info on using
autoconf, read the GNU autoconf manual. To configure, execute the
configure program, no other options are
required. For an example, to configure in a separate tree for objects,
execute the configure script from the source tree like this:
../dejagnu-&version;/configure
&dj; doesn't care at config time if it's for testing a native
system or a cross system. That is determined at runtime by using the
config files.You may also want to use the configure option
to specify where you want &dj; and its
supporting code installed. By default, installation is in subdirectories
of /usr/local, but you can select any alternate
directory altdir by including
{altdir}} on the
configure command line. (This value is captured in
the Makefile variables prefix and
execprefix}.)Save for a small number of example tests, the &dj; distribution
itself does not include any testsuites; these are available
separately. Testsuites for the GNU development tools are included in
those releases. After configuring the top-level &dj; directory, unpack
and configure the test directories for the tools you want to test; then,
in each test directory, run make check to build
auxiliary programs required by some of the tests, and run the test
suites.Installing &dj;To install &dj; in your file system (either in
/usr/local, or as specified by your
option to configure),
execute.
eg$ make install
make installdoes these things for
&dj;:Look in the path specified for executables
$exec_prefix) for directories called
lib and bin. If these
directories do not exist, make install creates
them.Create another directory in the
share directory, called
dejagnu, and copy all the library files into
it.Create a directory in the
dejagnu/share directory, called
config, and copy all the configuration files into
it.Copy the runtest shell script into
$exec_prefix/bin.Copy runtest.exp into
$exec_prefix/lib/dejagnu. This is the main Tcl
code implementing &dj;.Builtin Procedures&dj; provides these Tcl procedures.Core Internal ProceduresMail_file Proceduremail_filefile to
subjectOpen_logs Procedureopen_logsClose_logs Procedureclose_logsIsbuild ProcedureTests for a particular build host environment. If the
currently configured host matches the argument string, the result is
1; otherwise the result is
0. host must be a full
three-part configure host name; in particular, you may not use the
shorter nicknames supported by configure (but you can use wildcard
characters, using shell syntax, to specify sets of names). If it is
passed a NULL string, then it returns the name of the build canonical
configuration.isbuildpatternpatternIs_remote Procedureis_remoteboardis3way ProcedureTests 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 1; otherwise the result is
0.is3wayIshost ProcedureTests for a particular host environment. If the currently
configured host matches the argument string, the result is
1; otherwise the result is
0. host must be a full
three-part configure host name; in particular, you may not use the
shorter nicknames supported by configure (but you can use wildcard
characters, using shell syntax, to specify sets of names).ishostpatternIstarget ProcedureTests for a particular target environment. If the currently
configured target matches the argument string, the result is
1 ; otherwise the result is
0. target must be a full three-part configure
target name; in particular, you may not use the shorter nicknames
supported by configure (but you can use wildcard characters, using
shell syntax, to specify sets of names). If it is passed a
NULL string, then it returns the name of the
build canonical configuration.istargetargsIsnative ProcedureTests whether the current configuration has the same host and
target. When it runs in a native configuration this procedure returns
a 1; otherwise it returns a
0.isnativeUnknown ProcedureunknownargsargsClone_output Procedureclone_outputmessagemessageReset_vars Procedurereset_varsLog_and_exit Procedurelog_and_exitLog_summary Procedurelog_summaryargsargsCleanup ProcedurecleanupSetup_xfail ProcedureDeclares that the test is expected to fail on a particular set
of configurations. The config argument must be a list of full
three-part configure target name; in particular, you may not use the
shorter nicknames supported by configure (but you can use the common
shell wildcard characters to specify sets of names). The
bugid argument is optional, and used only in the
logging file output; use it as a link to a bug-tracking system such
as GNATS.Once you use setup_xfail, the
fail and pass procedures
produce the messages XFAIL and
XPASS respectively, allowing you to distinguish
expected failures (and unexpected success!) from other test
outcomes.Warning you must clear the expected failure after
using setup_xfail in a test case. Any call to pass
or fail clears the expected failure
implicitly; if the test has some other outcome, e.g. an error, you
can call clear_xfail to clear the expected
failure explicitly. Otherwise, the expected-failure declaration
applies to whatever test runs next, leading to surprising
results.setup_xfailconfigbugidconfigThe config triplet to trigger whether this is an
unexpected or expect failure.bugidThe optional bugid, used to tie this test case
to a bug tracking system.Record_test Procedurerecord_testtypemessageargstypemessageargsPass ProcedureDeclares a test to have passed. pass
writes in the log files a message beginning with
PASS (or XPASS, if failure
was expected), appending the argument
string.passstringstringThe string to use for this PASS
message.Fail ProcedureDeclares a test to have failed. fail
writes in the log files a message beginning with
FAIL (or XFAIL, if failure
was expected), appending the argument
string.failstringstringThe string to use for this FAIL
message.Xpass ProcedureDeclares a test to have unexpectedly passed, when it was
expected to be a failure. xpass
writes in the log files a message beginning with
XPASS (or XFAIL, if failure
was expected), appending the argument
string.xpassstringstringThe string to use for this output
state.Xfail ProcedureDeclares a test to have expectedly
failed. xfail
writes in the log files a message beginning with
XFAIL (or PASS, if success
was expected), appending the argument
string.xpassstringstringThe string to use for this output
state.Set_warning_threshold ProcedureSets the value of warning_threshold. A value
of 0 disables it: calls to
warning will not turn a
PASS or FAIL into an
UNRESOLVED.set_warning_thresholdthresholdthresholdThis is the value of the new warning
threshold.Get_warning_threshold ProcedureReturns the current value of
{warning_threshold. The default value is 3. This
value controls how many warning procedures can
be called before becoming UNRESOLVED.get_warning_thresholdWarning ProcedureDeclares detection of a minor error in the test case
itself. warning writes in the log files a message
beginning with WARNING, appending the argument
string. Use warning rather
than 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 number is supplied,
then this is used to set the internal count of warnings to that
value.As a side effect, warning_threshold or more
calls to warning in a single test case also changes the effect of the
next pass or fail command:
the test outcome becomes UNRESOLVED since an
automatic PASS or FAIL may
not be trustworthy after many warnings. If the optional numeric value
is 0, then there are no further side effects to
calling this function, and the following test outcome doesn't become
UNRESOLVED. This can be used for errors with no
known side effects.warningstringnumberstringnumberThe optional number to set the error counter. This
is only used to fake out the counter when using the
xfail procedure to control when it flips the
output over to UNRESOLVED
state.Perror ProcedureDeclares a severe error in the testing framework
itself. perror writes in the log files a message
beginning with ERROR, appending the argument
string.As a side effect, perror also changes the effect of the next
pass or fail command: the
test outcome becomes UNRESOLVED, since an
automatic PASS or FAIL cannot
be trusted after a severe error in the test framework. If the optional
numeric value is 0, then there are no further side
effects to calling this function, and the following test outcome
doesn't become UNRESOLVED. This can be used for
errors with no known side effects.perrorstringnumberstringnumberThe optional number to set the error counter. This
is only used to fake out the counter when using the
xfail procedure to control when it flips the
output over to UNRESOLVED
state.Note ProcedureAppends an informational message to the log
file. note writes in the log files a message
beginning with NOTE, appending the argument
string. Use note
sparingly. The 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 note.notestringstringThe string to use for this note.Untested ProcedureDeclares a test was not run. untested writes
in the log file a message beginning with UNTESTED,
appending the argument string. 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.untestedstringstringThe string to use for this output
state.Unresolved ProcedureDeclares a test to have an unresolved
outcome. unresolved writes in the log file a
message beginning with UNRESOLVED, appending the
argument string. 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).unresolvedstringstringThe string to use for this output
state.Unsupported ProcedureDeclares that a test case depends on some facility that does not
exist in the testing environment. unsupported
writes in the log file a message beginning with
UNSUPPORTED, appending the argument string.unsupportedstringstringThe string to use for this output
state.Init_testcounts Procedureinit_testcountsIncr_count Procedureincr_countnameargsnameargstransform ProcedureGenerates a string for the name of a tool as it was configured
and installed, given its native name (as the argument
toolname). This makes the assumption that all
tools are installed using the same naming conventions: For example,
for a cross compiler supporting the m68k-vxworks
configuration, the result of transform gcc is
m68k-vxworks-gcc.transformtoolnametoolnameThe name of the cross-development program to
transform.Check_conditional_xfail ProcedureThis 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 XFAIL. Otherwise it'll produce
an ordinary FAIL. You can also specify flags to
exclude. This makes a result be a FAIL, even if
the included options are found. To set the conditional, set
the variable compiler_conditional_xfail_data to the
fields
"[message string] [targets list] [includes list] [excludes list]"
(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 1 if the
conditional is true, or 0 if the conditional is
false.check_conditional_xfailmessagetargetsincludesexcludesmessageThis is the message to print with the normal test
result.targetsThis is a string with the list targets to activate
this conditional on.includesThis 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.)excludesThis 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.Specifying the conditional xfail data
set compiler_conditional_xfail_data { \
"I sure wish I knew why this was hosed" \
"sparc*-sun*-* *-pc-*-*" \
{"-Wall -v" "-O3"} \
{"-O1" "-Map"} \
}
What this does is it matches only for these two targets if
"-Wall -v" or "-O3" is set, but neither "-O1" or "-Map" is set. For
a set to match, the options specified are searched for independently
of each other, so a "-Wall -v" matches either "-Wall -v" or "-v
-Wall". A space separates the options in the string. Glob-style
regular expressions are also permitted.Clear_xfail ProcedureCancel an expected failure (previously declared with
setup_xfail) for a particular set of
configurations. The config argument is a list
of configuration target names. It is only necessary to call
clear_xfail if a test case ends without calling
either pass or fail, after
calling setup_xfail.clear_xfailconfigconfigThe configuration triplets to
clear.Verbose ProcedureTest cases can use this function to issue helpful messages
depending on the number of options on the
runtest command line. It prints string if the value of the variable
verbose is higher than or equal to the optional
number. The default value for number is 1. Use
the optional argument to cause string to always
be added to the log file, even if it won't be printed. Use the
optional argument to log the test results into
a parsable XML file. Use the optional argument
to print string without a trailing newline. Use the optional
argument if string begins with "-".verbose-log-x-n-rstringnumber-x-log-n--stringnumberLoad_lib ProcedureLoads a &dj; library file by searching the default fixed paths
built
into &dj;. If &dj; has been installed, it looks in a path
starting with the installed library directory. If you are running
&dj; directly from a source directory, without first running
make install, this path defaults to the current
directory. In either case, it then looks in the current directory
for a directory called lib. If there are
duplicate definitions, the last one loaded takes precedence over the
earlier ones.load_libfilespecfilespecThe name of the &dj; library file to
load.The global variable libdirs, handled
as a list, is appended to the default fixed paths built
into &dj;.Additional search directories for load_lib# append a non-standard search path
global libdirs
lappend libdirs $srcdir/../../gcc/testsuite/lib
# now loading $srcdir/../../gcc/testsuite/lib/foo.exp works
load_lib foo.expProcedures For Remote Communicationlib/remote.exp defines these
functions, 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 either -1, when the
connection cannot be established, or the spawn ID returned by
the Expect command
spawn.It use the value of the connect field
in the target_info array (was
connectmode as the type of connection to
make. Current supported connection types are tip, kermit,
telnet, rsh, rlogin, and netdata. If the
option was used on the runtest command line, then the target
is rebooted before the connection is made.Call_remote Procedurecall_remotetypeprocdestargsprocdestargsCheck_for_board_status Procedurecheck_for_board_statusvariablevariableFile_on_build Procedurefile_on_buildopfileargsopfileargsFile_on_host Procedurefile_on_hostopfileargsopfileargsLocal_exec Procedurelocal_execcommandlineinpoutptimeoutinpoutptimeoutRemote_binary Procedureremote_binaryhosthostRemote_close Procedureremote_closeshellidshellidThis is the value returned by a call
to remote_open. This closes the
connection to the target so resources can be used by
others. This parameter can be left off if the
fileid field in the
target_info array is set.Remote_download Procedureremote_downloaddestfileargsdestfileargsRemote_exec Procedureremote_exechostnameprogramargshostnameprogramargsRemote_expect Procedureremote_expectboardtimeoutargsboardtimeoutargsRemote_file Procedureremote_filedestargsdestargsRemote_ld Procedureremote_lddestprogdestprogRemote_load Procedureremote_loaddestprogargsdestprogargsRemote_open Procedureremote_opentypetypeThis is passed or
. 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
spawn_id of the process that manages
the connection. This value can be used in
Expect or
exp_send statements, or passed to
other procedures that need the connection process's
id. This also sets the fileid field in
the target_info array.Remote_pop_conn Procedureremote_pop_connhosthostRemote_push_conn Procedureremote_push_connhosthostRemote_raw_binary Procedureremote_raw_binaryhosthostRemote_raw_close Procedureremote_raw_closehosthostRemote_raw_file Procedureremote_raw_filedestargsdestargsremote_raw_ld Procedureremote_raw_lddestprogdestprogRemote_raw_load Procedureremote_raw_loaddestprogargsdestprogargsRemote_raw_open Procedureremote_raw_openargsargsRemote_raw_send Procedureremote_raw_senddeststringdeststringRemote_raw_spawn Procedureremote_raw_spawndestcommandlinedestcommandlineRemote_raw_transmit Procedureremote_raw_transmitdestfiledestfileRemote_raw_wait Procedureremote_raw_waitdesttimeoutdesttimeoutRemote_reboot ProcedureReturn value of this function depends on actual implementation
of reboot that will be used, in practice it is expected that
remote_reboot returns 1
on success and 0 on failure.remote_reboothosthostRemote_send Procedureremote_senddeststringdeststringRemote_spawn Procedureremote_spawndestcommandlineargsdestcommandlineargsRemote_swap_conn Procedureremote_swap_connhostRemote_transmit Procedureremote_transmitdestfiledestfileRemote_upload Procedureremote_uploaddestsrcfileargdestsrcfileargRemote_wait Procedureremote_waitdesttimeoutdesttimeoutStandard_close Procedurestandard_closehosthostStandard_download Procedurestandard_downloaddestfiledestfiledestfiledestfileStandard_exec Procedurestandard_exechostnameargshostnameargsStandard_file Procedurestandard_filedestopargsStandard_load Procedurestandard_loaddestprogargsdestprogargsStandard_reboot ProcedureIt looks like that this procedure is never called, instead
${board}_reboot defined in
base-config.exp will be used because it has
higher priority and base-config.exp is
always imported by runtest.standard_reboothosthostStandard_send Procedurestandard_senddeststringdeststringStandard_spawn Procedurestandard_spawndestcommandlinedestcommandlineStandard_transmit Procedurestandard_transmitdestfiledestfileStandard_upload Procedurestandard_uploaddest srcfile destfiledestsrcfiledestfileStandard_wait Procedurestandard_waitdesttimeoutdesttimeoutUnix_clean_filename Procedureunix_clean_filenamedestfiledestfileProcedures For Using Utilities to Connecttelnet, rsh, tip, kermittelnet Proceduretelnethostnameportrloginhostnamersh ProcedurershhostnamehostnameThis refers to the IP address or name
(for example, an entry in
/etc/hosts) for this target. The
procedure names reflect the Unix utility used to
establish a connection. The optional
port is used to specify the IP
port number. The value of the
netport field in the
target_info array is used. (was
$netport) This value has two parts,
the hostname and the port number, separated by a
:. If host or target is used in
the hostname field, than the
config array is used for all information.Tip ProceduretipportportConnect using the Unix utility
tip. Portmust
be a name from the tip
configuration file
/etc/remote. Often, this is called
hardwire, or something like
ttya. This file holds all the
configuration data for the serial port. The value of
the serial field in the
target_info array is used. (was
$serialport) If
or is used in the
port field, than the config
array is used for all information. the
config array is used for all information.Kermit ProcedurekermitportbpsportConnect using the program
kermit. Port
is the device name,
e.g. /dev/ttyb.
bpsbps is the line
speed to use (in its per second) for the
connection. The value of the serial
field in the target_info array is
used. (was $serialport) If
or is
used in the port field, than the
config array is used for all information. the
config array is used for all information.kermit_open Procedurekermit_opendestargsdestargsKermit_command Procedurekermit_commanddestargsdestargsKermit_send Procedurekermit_senddest string argsdeststringargsKermit_transmit Procedurekermit_transmitdestfileargsdestfileargsTelnet_open Proceduretelnet_openhostnameargshostnameargsTelnet_binary Proceduretelnet_binaryhostnamehostnameTelnet_transmit Proceduretelnet_transmitdestfileargsdestfileargsTip_open Proceduretip_openhostnamehostnameRlogin_open Procedurerlogin_openargargRlogin_spawn Procedurerlogin_spawndestcmdlinedestcmdlineRsh_open Procedurersh_openhostnamehostnameRsh_download Procedurersh_downloaddesthostsrcfiledestfiledesthostsrcfiledestfileRsh_upload Procedurersh_uploaddesthostsrcfiledestfiledesthostsrcfiledestfileRsh_exec Procedurersh_execboardnamecmdargsboardnamecmdargsFtp_open Procedureftp_openhosthostFtp_upload Procedureftp_uploadhostremotefilelocalfilehostremotefilelocalfileFtp_download Procedureftp_downloadhostlocalfileremotefilehostlocalfileremotefileFtp_close Procedureftp_closehosthostTip_download Proceduretip_downloadspawnidfilespawnidDownload to the
process spawnid (the value returned
when the connection was established), using the
~put command under
tip. Most often used for
single board computers that require downloading
programs in ASCII S-records. Returns
1 if an error occurs,
0 otherwise.fileThis is the filename to
download.Procedures For Target BoardsDefault_link Proceduredefault_linkboardobjectsdestfileflagsboardobjectsdestfileflagsDefault_target_assemble Proceduredefault_target_assemblesourcedestfileflagssourcedestfileflagsdefault_target_compile Proceduredefault_target_compilesourcedestfiletypeoptionssourcedestfiletypeoptionsPop_config Procedurepop_configtypetypePrune_warnings Procedureprune_warningstexttextPush_build Procedurepush_buildnamenamepush_config Procedurepush_configtypenametypenameReboot_target Procedurereboot_targetTarget_assemble Proceduretarget_assemblesource destfile flagssourcedestfileflagsTarget_compile Proceduretarget_compilesourcedestfiletypeoptionssourcedestfiletypeoptionsTarget Database ProceduresBoard_info Procedureboard_infomachineopargsmachineopargsHost_info Procedurehost_infoopargsopargsSet_board_info ProcedureThis checks if board_info array's field
entry has been set already and if not, then
sets it to value.set_board_infoentryvalueentryThe name of a board_info field
to operate on.valueThe value to set the field to.Add_board_info ProcedureThis treats board_info array's field
entry as a TCL list and adds
value at the end.add_board_infoentryvalueentryThe name of a board_info field
to operate on.valueThe value to add to the field.Set_currtarget_info Procedureset_currtarget_infoentryvalueentryvalueTarget_info Proceduretarget_infoopargsopargsUnset_board_info ProcedureThis checks if board_info array's field
entry has been set and if so, then removes
it.unset_board_infoentryentryThe name of a board_info field
to operate on.Unset_currtarget_info Procedureunset_currtarget_infoentryentryPush_target ProcedureThis makes the target named name be the
current target connection. The value of name is
an index into the target_info array and is set in
the global config file.push_targetnamenameThe name of the target to make current
connection.Pop_target ProcedureThis unsets the current target connection.pop_targetList_targets ProcedureThis lists all the supported targets for this
architecture.list_targetsPush_host ProcedureThis makes the host named name be the
current remote host connection. The value of
name is an index into the
target_info array and is set in the global config
file.push_hostnamenamePop_host ProcedureThis unsets the current host connection.pop_hostCompile ProcedureThis invokes the compiler as set by CC to compile the
file file. The default options for many cross
compilation targets are guessed by &dj;, and
these options can be added to by passing in more parameters as
arguments to compile. Optionally, this will also
use the value of the cflags field in the target
config array. If the host is not the same as the build machines, then
then compiler is run on the remote host using
execute_anywhere.compilefilefileArchive ProcedureThis produces an archive file. Any parameters passed to
archive are used in addition to the default
flags. Optionally, this will also use the value of the
arflags field in the target config array. If the
host is not the same as the build machines, then then archiver is run
on the remote host using execute_anywhere.archivefilefileRanlib ProcedureThis generates an index for the archive file for systems that
aren't POSIX yet. Any parameters passed to ranlib
are used in for the flags.ranlibfilefileExecute_anywhere ProcedureThis executes the cmdline on the proper
host. This should be used as a replacement for the Tcl command
exec as this version utilizes the target config
info to execute this command on the build machine or a remote
host. All config information for the remote host must be setup to
have this command work. If this is a Canadian cross (where we test a
cross compiler that runs on a different host then where &dj; is
running) then a connection is made to the remote host and the command
is executed there. It returns either REMOTERROR (for an error) or the
output produced when the command was executed. This is used for
running the tool to be tested, not a test case.execute_anywherecmdlinecmdlinePlatform Dependent ProceduresEach 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
_, and finally a suffix describing the
procedure's purpose. For example, a procedure to extract the
version from GDB is called
gdb_version.runtest itself calls only two of these
procedures, ${tool}_exit and
${tool}_version; these procedures use no
arguments.The other two procedures, ${tool}_start
and ${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
runtest) is to return 0
if the procedure succeeded, 1 if it failed,
and -1 if there was a communication error.${tool}_start ProcedureStarts a particular tool. For an interactive tool,
${tool}_start starts and initializes the
tool, leaving the tool up and running for the test cases; an
example is gdb_start, the start function
for GDB. For a batch oriented tool,
${tool}_start is optional; the recommended
convention is to let ${tool}_start run the
tool, leaving the output in a variable called
comp_output. Test scripts can then analyze
$comp_output to determine the test results.
An example of this second kind of start function is
gcc_start, the start function for GCC.&dj; itself does not call
${tool}_start. The initialization
module ${tool}_init.exp must call
${tool}_start for interactive tools;
for batch-oriented tools, each individual test script calls
${tool}_start (or makes other
arrangements to run the tool).${tool}_start${tool}_load ProcedureLoads something into a tool. For an interactive tool,
this conditions the tool for a particular test case; for
example, gdb_load loads a new
executable file into the debugger. For batch oriented tools,
${tool}_load may do nothing---though,
for example, the GCC support uses
gcc_load to load and run a binary on
the target environment. Conventionally,
${tool}_load leaves the output of any
program it runs in a variable called
$exec_output. Writing
${tool}_load can be the most complex
part of extending &dj; to a new tool or a new target, if
it requires much communication coding or file
downloading. Test scripts call
${tool}_load.${tool}_load${tool}_exit ProcedureCleans up (if necessary) before &dj; exits. For
interactive tools, this usually ends the interactive
session. You can also use ${tool}_exit
to remove any temporary files left over from the
tests. runtest calls
${tool}_exit.${tool}_exit${tool}_version ProcedurePrints the version label and number for
${tool}. This is called by the &dj;
procedure that prints the final summary report. The output
should consist of the full path name used for the tested
tool, and its version number.${tool}_versionUtility ProceduresGetdirs ProcedureReturns a list of all the directories in the single
directory a single directory that match an optional
pattern. getdirsrootdirpatternargspatternIf you do not specify
pattern,
Getdirs assumes a default pattern of
*. You may use the common shell
wildcard characters in the pattern. If no directories
match the pattern, then a NULL string is
returned.Find ProcedureSearch for files whose names match pattern
(using shell wildcard characters for filename expansion). Search
subdirectories recursively, starting at
rootdir. The result is the list of files whose
names match; if no files match, the result is empty. Filenames in the
result include all intervening subdirectory names. If no files match
the pattern, then a NULL string is returned.findrootdirpatternrootdirThe top level directory to search the search
from.patternA csh "glob" style regular expression representing
the files to find.Which ProcedureSearches the execution path for an executable file
binary, like the BSD which
utility. This procedure uses the shell environment variable
PATH. It returns 0 if the
binary is not in the path, or if there is no PATH
environment variable. If binary is in the path, it
returns the full path to binary.whichfilebinaryThe executable program or shell script to look
for.Grep ProcedureSearch the file called filename (a fully
specified path) for lines that contain a match for regular expression
regexp. The result is a list of all the lines that
match. If no lines match, the result is an empty string. Specify
regexp using the standard regular expression style
used by the Unix utility program grep.Use the optional third argument line to
start lines in the result with the line number in
filename. (This argument is simply an option
flag; type it just as shown .)grepfilenameregexp--linefilenameThe file to search.regexpThe Unix style regular expression (as used by the
grep Unix utility) to search
for.--linePrefix the line number to each line where the
regexp matches.Prune ProcedureThis procedure is deprecated and will be removed in
the next release of &dj;. If a testsuite uses this
procedure, a copy of the procedure should be made and placed
in the lib directory of the testsuite.Slay ProcedureThis procedure is deprecated and will be removed in
the next release of &dj;. If a testsuite uses this
procedure, a copy of the procedure should be made and placed
in the lib directory of the testsuite.Absolute ProcedureThis procedure is deprecated and will be removed in
the next release of &dj;. If a testsuite uses this
procedure, a copy of the procedure should be made and placed
in the lib directory of the testsuite.Psource ProcedureThis procedure is deprecated and will be removed in
the next release of &dj;. If a testsuite uses this
procedure, a copy of the procedure should be made and placed
in the lib directory of the testsuite.Runtest_file_p ProcedureSearch runtests for
testcase and return 1 if
found, 0 if not. runtests
is a list of two elements. The first is a copy of what was on
the right side of the = iffoo.exp="..."was specified, or
an empty string if no such argument is present. The second is the
pathname of the current testcase under consideration. This is used
by tools like compilers where each testcase is a file.runtest_file_prunteststestcaseruntestsThe list of patterns to compare against.
testcaseThe test case filename.Diff ProcedureCompares the two files and returns a 1 if
they match, or a 0 if they don't. If
verbose is set, then it'll print the differences to
the screen.difffile_1file_2file_1The first file to compare.file_2The second file to compare.Setenv ProcedureSets the environment variable var to the
value val.setenvvarvalvarThe environment variable to set.valThe value to set the variable to.unsetenv ProcedureUnsets the environment variable
var.unsetenvvarvarThe environment variable to
unset.Getenv ProcedureReturns the value of var in the
environment if it exists, otherwise it returns NULL.getenvvarvarThe environment variable to get the value
of.Prune_system_crud ProcedureFor system system, delete text the host or
target operating system might issue that will interfere with pattern
matching of program output in text. An example
is the message that is printed if a shared library is out of
date.prune_system_crudsystemtestsystemThe system error messages to look for to screen out
.textThe Tcl variable containing the
text.Libgloss, A Free BSPLibgloss is a free BSP (Board Support
Package) commonly used with GCC and G++ to produce a fully linked
executable image for an embedded systems.Libgloss_link_flags Procedurelibgloss_link_flagsargsargsLibgloss_include_flags Procedurelibgloss_include_flagsargsargsNewlib_link_flags Procedurenewlib_link_flagsargsargsNewlib_include_flags Procedurenewlib_include_flagsargsargsLibio_include_flags Procedurelibio_include_flagsargsargsLibio_link_flags Procedurelibio_link_flagsargsargsG++_include_flags Procedureg++_include_flagsargsargsG++_link_flags Procedureg++_link_flagsargsargsLibstdc++_include_flags Procedurelibstdc++_include_flagsargsargsLibstdc++_link_flags Procedurelibstdc++_link_flagsargsargsGet_multilibs Procedureget_multilibsargsargsFind_binutils_prog Procedurefind_binutils_prognamenameFind_gcc Procedurefind_gccFind_gcj Procedurefind_gcjFind_g++ Procedurefind_g++Find_g77 Procedurefind_g77Find_gfortran Procedurefind_gfortranProcess_multilib_options Procedureprocess_multilib_optionsargsargsAdd_multilib_option Procedureadd_multilib_optionargsargsFind_gas Procedurefind_gasFind_ld Procedurefind_ldBuild_wrapper Procedurebuild_wrappergluefilegluefileWinsup_include_flags Procedurewinsup_include_flagsargsargsWinsup_link_flags Procedurewinsup_link_flagsargsargsProcedures for debugging your Tcl code.lib/debugger.expdefines these utility
procedures:Dumpvars ProcedureThis takes a csh style regular expression (glob rules) and prints
the values of the global variable names that match. It is abbreviated
as dv.dumpvarsvarsvarsThe variables to dump.Dumplocals ProcedureThis takes a csh style regular expression (glob rules) and
prints the values of the local variable names that match. It is
abbreviated as dl.dumplocalsargsargsDumprocs ProcedureThis takes a csh style regular expression (glob rules) and
prints the body of all procs that match. It is abbreviated as
dp.dumprocspatternpatternThe csh "glob" style pattern to look
for.Dumpwatch ProcedureThis takes a csh style regular expression (glob rules) and
prints all the watchpoints. It is abbreviated as
dw.dumpwatchpatternpatternThe csh "glob" style pattern to look
for.Watcharray ProcedurewatcharrayelementtypetypeThe csh "glob" style pattern to look
for.Watchvar ProcedurewatchvarvartypeWatchunset ProcedureThis breaks program execution when the variable
var is unset. It is abbreviated as
wu.watchunsetargargsWatchwrite ProcedureThis breaks program execution when the variable
var is written. It is abbreviated as
ww.watchwritevarvarThe variable to watch.Watchread ProcedureThis breaks program execution when the variable
var is read. It is abbreviated as
wr.watchreadvarvarThe variable to watch.Watchdel ProcedureThis deletes a watchpoint from the watch list. It is
abbreviated as wd.watchdelargsargsPrint ProcedureThis prints the value of the variable
var. It is abbreviated as
p.printvarvarQuit ProcedureThis makes runtest exit. It is abbreviated as
q.quitFile MapThis is a map of the files in &dj;.runtestruntest.expstub-loader.ctestglue.cconfigbaseboardslib/debugger.explib/dg.explib/framework.explib/ftp.explib/kermit.explib/libgloss.explib/mondfe.explib/remote.explib/rlogin.explib/rsh.explib/standard.explib/target.explib/targetdb.explib/telnet.explib/tip.explib/util-defs.explib/utils.explib/xsh.explib/dejagnu.expUnit Testing APIC Unit Testing APIAll of the functions that take a
msg parameter use a C char * that is
the message to be displayed. There currently is no support for
variable length arguments.Pass FunctionThis prints a message for a successful test
completion.passmsgFail FunctionThis prints a message for an unsuccessful test
completion.failmsgUntested FunctionThis prints a message for an test case that isn't run
for some technical reason.untestedmsgUnresolved FunctionThis prints a message for an test case that is run,
but there is no clear result. These output states require a
human to look over the results to determine what happened.
unresolvedmsgTotals FunctionThis prints out the total numbers of all the test
state outputs.totalsC++ Unit Testing APIAll of the methods that take a
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.Pass MethodThis prints a message for a successful test
completion.TestState::passmsgFail MethodThis prints a message for an unsuccessful test
completion.TestState::failmsgUntested MethodThis prints a message for an test case that isn't run
for some technical reason.TestState::untestedmsgUnresolved MethodThis prints a message for an test case that is run,
but there is no clear result. These output states require a
human to look over the results to determine what happened.
TestState::unresolvedmsgTotals MethodThis prints out the total numbers of all the test
state outputs.TestState::totals