Builtin Procedures

DejaGnu provides these Tcl procedures.

Core Internal Procedures

Mail_file Procedure

mail_file(file to subject);

Isbuild Procedure

Tests 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.

isbuild(pattern);

pattern

Is_remote Procedure

is_remote(board);

is3way Procedure

Tests for a canadian cross. This is when the tests will be run on a remotly hosted cross compiler. If it is a canadian cross, then the result is 1; otherwise the result is 0.

is3way();

Ishost Procedure

Tests 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).

ishost(pattern);

Istarget Procedure

Tests 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.

istarget(args);

Isnative Procedure

Tests 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.

isnative();

Unknown Procedure

unknown(args);

args

Clone_output Procedure

clone_output(message);

message

Log_and_exit Procedure

log_and_exit();

Log_summary Procedure

log_summary(args);

args

Setup_xfail Procedure

Declares 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

Warning you must clear the expected failure after using setup_xfail in a test case. Any call to pass or faill 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_xfail(config bugid);

config

The config triplet to trigger whether this is an unexpected or expect failure.

bugid

The optional bugid, used to tie it this test case to a bug tracking system.

Record_test Procedure

record_test(type message args);

type

message

args

Pass Procedure

Declares 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.

pass(string);

string

The string to use for this PASS message.

Fail Procedure

Declares 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.

fail(string);

string

The string to use for this FAIL message.

Xpass Procedure

Declares a test to have unexpectably 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.

xpass(string);

string

The string to use for this output state.

Xfail Procedure

Declares a test to have expectably failed. xfail writes in the log files a message beginning with XFAIL (or PASS, if success was expected), appending the argument string.

xpass(string);

string

The string to use for this output state.

Set_warning_threshold Procedure

Sets 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_threshold(threshold);

threshold

This is the value of the new warning threshold.

Get_warning_threshold Procedure

Returns 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_threshold();

Warning Procedure

Declares 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.

warning(string number );

string

number

The optional number to set the error counter. Thius 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 Procedure

Declares 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.

perror(string number );

string

number

The optional number to set the error counter. Thius 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 Procedure

Appends 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.

note(string);

string

The string to use for this note.

Untested Procedure

Declares 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.

untested(string);

string

The string to use for this output state.

Unresolved Procedure

Declares 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).

unresolved(string);

string

The string to use for this output state.

Unsupported Procedure

Declares 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.

unsupported(string);

string

The string to use for this output state.

Init_testcounts Procedure

init_testcounts();

Incr_count Procedure

incr_count(name args);

name

args

transform Procedure

Generates 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.

transform(toolname);

toolname

The name of the cross-development program to transform.

Check_conditional_xfail Procedure

This procedure adds a condition 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_xfail(message targets includes excludes);

message

This is the message to print with the normal test result.

targets

This is a string with the list targets to activate this conditional on.

includes

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, then this conditional is true.

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.

Example 6-1. 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 independantly of each other, so a "-Wall -v" matches either "-Wall -v" or "-v -Wall". A space seperates the options in the string. Glob-style regular expressions are also permitted.

Clear_xfail Procedure

Cancel 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_xfail(config);

config

The configuration triplets to clear.

Verbose Procedure

Test cases can use this function to issue helpful messages depending on the number of --verbose 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 -log argument to cause string to always be added to the log file, even if it won't be printed. Use the optional -n argument to print string without a trailing newline. Use the optional -- argument if string begins with "-".

verbose(-log -n -r string number);

-log

-n

--

string

number

Load_lib Procedure

Loads a DejaGnu library file by searching a fixed path 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 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_lib(filespec);

filespec

The name of the DejaGnu library file to load.

Procedures For Remote Communication

lib/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 --reboot option was used on the runtest command line, then the target is rebooted before the connection is made.

Call_remote Procedure

call_remote(type proc dest args);

proc

dest

args

Check_for_board_status Procedure

check_for_board_status(variable);

variable

File_on_build Procedure

file_on_build(op file args);

op

file

args

File_on_host Procedure

file_on_host(op file args);

op

file

args

Local_exec Procedure

local_exec(commandline inp outp timeout);

inp

outp

timeout

Remote_binary Procedure

remote_binary(host);

host

Remote_close Procedure

remote_close(shellid);

shellid

This 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 Procedure

remote_download(dest file args);

dest

file

args

Remote_exec Procedure

remote_exec(hostname program args);

hostname

program

args

Remote_expect Procedure

remote_expect(board timeout args);

board

timeout

args

Remote_file Procedure

remote_file(dest args);

dest

args

Remote_ld Procedure

remote_ld(dest prog);

dest

prog

Remote_load Procedure

remote_load(dest prog args);

dest

prog

args

Remote_open Procedure

remote_open(type);

type

This is passed host or 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 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 Procedure

remote_pop_conn(host);

host

Remote_push_conn Procedure

remote_push_conn(host);

host

Remote_raw_binary Procedure

remote_raw_binary(host);

host

Remote_raw_close Procedure

remote_raw_close(host);

host

Remote_raw_file Procedure

remote_raw_file(dest args);

dest

args

remote_raw_ld Procedure

remote_raw_ld(dest prog);

dest

prog

Remote_raw_load Procedure

remote_raw_load(dest prog args);

dest

prog

args

Remote_raw_open Procedure

remote_raw_open(args);

args

Remote_raw_send Procedure

remote_raw_send(dest string);

dest

string

Remote_raw_spawn Procedure

remote_raw_spawn(dest commandline);

dest

commandline

Remote_raw_transmit Procedure

remote_raw_transmit(dest file);

dest

file

Remote_raw_wait Procedure

remote_raw_wait(dest timeout);

dest

timeout

Remote_reboot Procedure

remote_reboot(host);

host

Remote_send Procedure

remote_send(dest string);

dest

string

Remote_spawn Procedure

remote_spawn(dest commandline args);

dest

commandline

args

Remote_swap_conn Procedure

remote_swap_conn(host);

Remote_transmit Procedure

remote_transmit(dest file);

dest

file

Remote_upload Procedure

remote_upload(dest srcfile arg);

dest

srcfile

arg

Remote_wait Procedure

remote_wait(dest timeout);

dest

timeout

Standard_close Procedure

standard_close(host);

host

Standard_download Procedure

standard_download(dest file destfile);

dest

file

destfile

Standard_exec Procedure

standard_exec(hostname args);

hostname

args

Standard_file Procedure

standard_file(dest, op, args);

Standard_load Procedure

standard_load(dest prog args);

dest

prog

args

Standard_reboot Procedure

standard_reboot(host);

host

Standard_send Procedure

standard_send(dest string);

dest

string

Standard_spawn Procedure

standard_spawn(dest commandline);

dest

commndline

Standard_transmit Procedure

standard_transmit(dest file);

dest

file

Standard_upload Procedure

standard_upload(dest srcfile destfile);

dest

srcfile

destfile

Standard_wait Procedure

standard_wait(dest timeout);

dest

timeout

Unix_clean_filename Procedure

unix_clean_filename(dest file);

dest

file

Procedures For Using Utilities to Connect

telnet, rsh, tip, kermit

telnet Procedure

telnet(hostname port);

rlogin(hostname);

rsh Procedure

rsh(hostname);

hostname

This 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, seperated by a :. If host or target is used in the hostname field, than the config array is used for all information.

Tip Procedure

tip(port);

port

Connect 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 host or target is used in the port field, than the config array is used for all information. the config array is used for all information.

Kermit Procedure

kermit(port bps);

port

Connect using the program kermit. Port is the device name, e.g. /dev/ttyb.

bps

bps 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 host or target 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 Procedure

kermit_open(dest args);

dest

args

Kermit_command Procedure

kermit_command(dest args);

dest

args

Kermit_send Procedure

kermit_send(dest string args);

dest

string

args

Kermit_transmit Procedure

kermit_transmit(dest file args);

dest

file

args

Telnet_open Procedure

telnet_open(hostname args);

hostname

args

Telnet_binary Procedure

telnet_binary(hostname);

hostname

Telnet_transmit Procedure

telnet_transmit(dest file args);

dest

file

args

Tip_open Procedure

tip_open(hostname);

hostname

Rlogin_open Procedure

rlogin_open(arg);

arg

Rlogin_spawn Procedure

rlogin_spawn(dest cmdline);

dest

cmdline

Rsh_open Procedure

rsh_open(hostname);

hostname

Rsh_download Procedure

rsh_download(desthost srcfile destfile);

desthost

srcfile

destfile

Rsh_upload Procedure

rsh_upload(desthost srcfile destfile);

desthost

srcfile

destfile

Rsh_exec Procedure

rsh_exec(boardname cmd args);

boardname

cmd

args

Ftp_open Procedure

ftp_open(host);

host

Ftp_upload Procedure

ftp_upload(host remotefile localfile);

host

remotefile

localfile

Ftp_download Procedure

ftp_download(host localfile remotefile);

host

localfile

remotefile

Ftp_close Procedure

ftp_close(host);

host

Tip_download Procedure

tip_download(spawnid file);

spawnid

Download file 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.

file

This is the filename to downlaod.

Procedures For Target Boards

Default_link Procedure

default_link(board objects destfile flags);

board

objects

destfile

flags

Default_target_assemble Procedure

default_target_assemble(source destfile flags);

source

destfile

flags

default_target_compile Procedure

default_target_compile(source destfile type options);

source

destfile

type

options

Pop_config Procedure

pop_config(type);

type

Prune_warnings Procedure

prune_warnings(text);

text

Push_build Procedure

push_build(name);

name

push_config Procedure

push_config(type name);

type

name

Reboot_target Procedure

reboot_target();

Target_assemble Procedure

target_assemble(source destfile flags);

source

destfile

flags

Target_compile Procedure

target_compile(source destfile type options);

source

destfile

type

options

Target Database Procedures

Board_info Procedure

board_info(machine op args);

machine

op

args

Host_info Procedure

host_info(op args);

op

args

Set_board_info Procedure

set_board_info(entry value);

entry

value

Set_currtarget_info Procedure

set_currtarget_info(entry value);

entry

value

Target_info Procedure

target_info(op args);

op

args

Unset_board_info Procedure

unset_board_info(entry);

entry

Unset_currtarget_info Procedure

unset_currtarget_info(entry);

entry

Push_target Procedure

This 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_target(name);

name

The name of the target to make current connection.

Pop_target Procedure

This unsets the current target connection.

pop_target();

List_targets Procedure

This lists all the supported targets for this architecture.

list_targets();

Push_host Procedure

This 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_host(name);

name

Pop_host Procedure

This unsets the current host connection.

pop_host();

Compile Procedure

This invokes the compiler as set by CC to compile the file file. The default options for many cross compilation targets are guessed by DejaGnu, 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.

compile(file);

file

Archive Procedure

This 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.

archive(file);

file

Ranlib Procedure

This 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.

ranlib(file);

file

Execute_anywhere Procedure

This 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 DejaGnu 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_anywhere(cmdline);

cmdline

Platform Dependant 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 underbar _, 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 test suite.

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 Procedure

Starts 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.

DejaGnu 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 Procedure

Loads 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 DejaGnu 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 Procedure

Cleans up (if necessary) before DejaGnu 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 Procedure

Prints the version label and number for ${tool}. This is called by the DejaGnu 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}_version();

Utility Procedures

Getdirs Procedure

Returns a list of all the directories in the single directory a single directory that match an optional pattern.

getdirs(rootdir pattern);

args

pattern

If 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 Procedure

Search 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.

find(rootdir pattern);

rootdir

The top level directory to search the search from.

pattern

A csh "glob" style regular expression reprsenting the files to find.

Which Procedure

Searches the execution path for an executable file binary, like the 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.

which(file);

binary

The executable program or shell script to look for.

Grep Procedure

Search 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 --line.)

grep(filename regexp --line);

filename

The file to search.

regexp

The Unix style regular expression (as used by the grep Unix utility) to search for.

--line

Prefix the line number to each line where the regexp matches.

Prune Procedure

Remove elements of the Tcl list list. Elements are fields delimited by spaces. The result is a copy of list, without any elements that match pattern. You can use the common shell wildcard characters to specify the pattern.

prune(list pattern);

list

A Tcl list containing the original data. Commonly this is the output of a batch executed command, like running a compiler.

pattern

The csh shell "glob" style pattern to search for.

Slay Procedure

This look in the process table for name and send it a unix SIGINT, killing the process. This will only work under NT if you have Cygwin or another Unix system for NT installed.

slay(name);

name

The name of the program to kill.

Absolute Procedure

This procedure takes the relative path, and converts it to an absolute path.

absolute(path);

path

The path to convert.

Psource Procedure

This sources the file filename, and traps all errors. It also ignores all extraneous output. If there was an error it returns a 1, otherwise it returns a 0.

psource(file);

filename

The filename to Tcl script to source.

Runtest_file_p Procedure

Search runtests for testcase and return 1 if found, 0 if not. runtests is a list of two elements. The first is the pathname of the testsuite expect script running. The second is a copy of what was on the right side of the = if
foo.exp="..."
" was specified, or an empty string if no such argument is present. This is used by tools like compilers where each testcase is a file.

runtest_file_p(runtests testcase);

runtests

The pathname of the testsuite expect script running

testcase

The test case filename.

Diff Procedure

Compares 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.

diff(file_1 file_2);

file_1

The first file to compare.

file_2

The second file to compare.

Setenv Procedure

Sets the environment variable var to the value val.

setenv(var val);

var

The environment variable to set.

val

The value to set the variable to.

unsetenv Procedure

Unsets the environment variable var.

unsetenv(var);

var

The environment variable to unset.

Getenv Procedure

Returns the value of var in the environment if it exists, otherwise it returns NULL.

getenv(var);

var

The environment variable to get the value of.

Prune_system_crud Procedure

For 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_crud(system test);

system

The system error messages to look for to screen out .

text

The Tcl variable containing the text.

Libgloss, A Free BSP

Libgloss 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 Procedure

libgloss_link_flags(args);

args

Libgloss_include_flags Procedure

libgloss_include_flags(args);

args

Newlib_link_flags Procedure

newlib_link_flags(args);

args

Newlib_include_flags Procedure

newlib_include_flags(args);

args

Libio_include_flags Procedure

libio_include_flags(args);

args

Libio_link_flags Procedure

libio_link_flags(args);

args

G++_include_flags Procedure

g++_include_flags(args);

args

G++_link_flags Procedure

g++_link_flags(args);

args

Libstdc++_include_flags Procedure

libstdc++_include_flags(args);

args

Libstdc++_link_flags Procedure

libstdc++_link_flags(args);

args

Get_multilibs Procedure

get_multilibs(args);

args

Find_binutils_prog Procedure

find_binutils_prog(name);

name

Process_multilib_options Procedure

process_multilib_options(args);

args

Add_multilib_option Procedure

add_multilib_option(args);

args

Build_wrapper Procedure

build_wrapper(gluefile);

gluefile

Winsup_include_flags Procedure

winsup_include_flags(args);

args

Winsup_link_flags Procedure

winsup_link_flags(args);

args

Procedures for debugging your Tcl code.

lib/debugger.expdefines these utility procedures:

Dumpvars Procedure

This takes a csh style regular expression (glob rules) and prints the values of the global variable names that match. It is abbreviated as dv.

dumpvars(vars);

vars

The variables to dump.

Dumplocals Procedure

This takes a csh style regular expression (glob rules) and prints the values of the local variable names that match. It is abbreviated as dl.

dumplocals(args);

args

Dumprocs Procedure

This takes a csh style regular expression (glob rules) and prints the body of all procs that match. It is abbreviated as dp.

dumprocs(pattern);

pattern

The csh "glob" style pattern to look for.

Dumpwatch Procedure

This takes a csh style regular expression (glob rules) and prints all the watchpoints. It is abbreviated as dw.

dumpwatch(pattern);

pattern

The csh "glob" style pattern to look for.

Watcharray Procedure

watcharray(element type);

type

The csh "glob" style pattern to look for.

Watchvar Procedure

watchvar(var type);

Watchunset Procedure

This breaks program execution when the variable var is unset. It is abbreviated as wu.

watchunset(arg);

args

Watchwrite Procedure

This breaks program execution when the variable var is written. It is abbreviated as ww.

watchwrite(var);

var

The variable to watch.

Watchread Procedure

This breaks program execution when the variable var is read. It is abbreviated as wr.

watchread(var);

var

The variable to watch.

Watchdel Procedure

This deletes a the watchpoint from the watch list. It is abbreviated as wd.

watchdel(args);

args

Print Procedure

This prints the value of the variable var. It is abbreviated as p.

print(var);

var

Quit Procedure

This makes runtest exit. It is abbreviated as q.

quit();