Descripition of the test environment
====================================

Andreas Gruenbacher, SuSE Labs, SuSE Linux AG

April 1, 2003


Test scripts are text files that contain embedded commands, like this
file.  They are executed with the "run" script.  This file can be executed
by typing "run README".

The test script script syntax is as follows.  Ordninary text is treated
as a comment.  Lines that begin with "$" are interpreted as commands
that are to be executed.  Lines that begin with "<" are input to the
command.  Lines that begin with ">" are results of the command,
including both the command's standard output and standard error output.
Commands do not need to output anything.  Here is a simple example:

	$ echo "blubb"
	> blubb

When run, this results in roughly this output.  The number in brackets
represents the line number in the test script.

	[20] $ echo "blubb" -- ok


After executing all tests in a test script, the total number of tests,
and the number of passed and failed tests is reported.  Here is an
example that also uses standard input:

	$ cat
	< through
	> through


Inside test commands, input, and output environment variables of the
form %VARIABLE or %{VARIABLE} are substituted.  This is shown next.

	$ echo $LOGNAME
	> %LOGNAME


Each command is executed in a separate process, so changing the working
directory or the umask would not have an effect on the next command.
Therefore, the cd and umask commands are not executed directly, but
they are handled by the run script.  Here is how this works.

	$ umask 0
	$ ls test
	> ls: test: No such file or directory

	$ mkdir test
	$ cd test
	$ ls


Some test cases require to run commands as a different user.  The su
command which is usually used for that purpose can only be used
interactively.  Therefore, the run script also implements its own
version that allows to switch back and forth between users.  Because
only root is allowed to switch between users, the following example only
works if run by root.  Similarly, sg switches the primary group ID.

	$ su bin
	$ touch bin
	$ su daemon
	$ touch daemon
	$ su root
	$ ls -l bin daemon | awk '{print $3}'
	> bin
	> daemon



Oh ... there is some mess left to be cleaned up:

	$ cd ..
	$ rm -r test

