Opportunity to choose the shell that runs the releng test scripts
This commit is contained in:
parent
2b3342c9c0
commit
2abce248b3
@ -9,35 +9,37 @@ Copyright (C) 2011 George Danchev, Thomas Schmitt
|
||||
Provided under GPL version 2 or later.
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
The impatient tester will build libisoburn according to ./README and then do
|
||||
The impatient tester will build libisoburn according to its README and then do
|
||||
|
||||
cd ./releng
|
||||
./run_all_auto -x ../xorriso/xorriso
|
||||
|
||||
More patient testers will first read the following description.
|
||||
|
||||
Those who simply lack the interpreter /bin/bash, may do
|
||||
./change_shell_to_use
|
||||
and then retry.
|
||||
|
||||
|
||||
The test suite
|
||||
|
||||
+++ introduce the test suite,
|
||||
|
||||
Directory ./releng of libisoburn contains a collection of test scripts and
|
||||
auxiliary data. They exercise some typical use cases of building libisoburn
|
||||
applications and running the ISO 9660 filesystem manipulation and CD/DVD/BD
|
||||
burn program xorriso.
|
||||
|
||||
|
||||
+++ inform about resource needs,
|
||||
|
||||
It is assumed that libburn and libisofs are installed, so that libisoburn
|
||||
can be configured and built. It is not mandatory that libisoburn is already
|
||||
installed. The tests may use an installed xorriso program as well as a
|
||||
freshly built one.
|
||||
|
||||
>>> Do we really need to be glued to bash ?
|
||||
The test scripts explicitely demand /bin/bash as interpreter, although they
|
||||
would run on certain other shells too. If you get an error message like
|
||||
./run_all_auto: not found
|
||||
then consider to install /bin/bash.
|
||||
If you decide against that, see below "Alternative Shells".
|
||||
|
||||
|
||||
+++ auto and manual tests
|
||||
|
||||
There are two groups of test scripts:
|
||||
|
||||
auto_* gets started and watched by script run_all_auto.
|
||||
@ -51,8 +53,6 @@ There are two groups of test scripts:
|
||||
and operate the mechanics of a CD drive.
|
||||
|
||||
|
||||
+++ tell how to run the tests,
|
||||
|
||||
Running automated tests
|
||||
|
||||
The test scripts expect to get run while the working directory is
|
||||
@ -75,10 +75,6 @@ or if you want to use an installed xorriso program:
|
||||
resp.
|
||||
./run_all_auto -x $(type -p xorriso)
|
||||
|
||||
|
||||
+++ General options -x , -k, -f, -c, -h, --
|
||||
+++ + All scripts support -h
|
||||
|
||||
There are several options which work with run_all_auto and any single test.
|
||||
-x absolute or relative path to xorriso binary to be run.
|
||||
-k keep self-generated data.
|
||||
@ -92,8 +88,6 @@ particular manually executable test scripts.
|
||||
|
||||
Manually executable tests
|
||||
|
||||
+++ list of manual tests
|
||||
|
||||
Currently there are the following tests which should have the attention of
|
||||
the user or require sysadmin considerations before they are run:
|
||||
|
||||
@ -137,24 +131,29 @@ the user or require sysadmin considerations before they are run:
|
||||
as one single argument. On Solaris use: --priv_cmd pfexec
|
||||
|
||||
|
||||
>>> ./run_all_manual
|
||||
|
||||
>>> + Any auto_* script can be run on its own, regardless.
|
||||
>>> List auto tests
|
||||
Any auto_* script can be run on its own. Some of them demand option -x.
|
||||
All general options are accepted.
|
||||
|
||||
./auto_cxx
|
||||
Exercises inclusion of xorriso/xorriso.h and libisoburn/libisoburn.h
|
||||
in C++ programs and linking of the libraries. It might be necessary
|
||||
to set compiler options by shell variable CFLAGS before running the test.
|
||||
E.g. if the include headers libisofs.h and libburn.h are not found:
|
||||
E.g. if on FreeBSD the include headers libisofs.h , libburn.h are not found:
|
||||
export CFLAGS="-I/usr/local/include"
|
||||
|
||||
>>> ./auto_isocontent
|
||||
./auto_isocontent -x ../xorriso/xorriso
|
||||
Tests whether xorriso is able to record and restore two familes of
|
||||
hard links.
|
||||
|
||||
>>> ./auto_printsize
|
||||
./auto_printsize -x ../xorriso/xorriso
|
||||
Tests how long xorriso needs to compose a medium sized directory tree.
|
||||
If programs mkisofs and/or genisomage are availaible, then the same test
|
||||
is done with them.
|
||||
|
||||
|
||||
+++ give hints what to do with FAIL results.
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
What to do with FAIL results
|
||||
|
||||
The text output of the automatic tests is recorded in file
|
||||
releng_generated_data/log.run_all_auto
|
||||
@ -169,11 +168,29 @@ please contact mailing list libburn-hackers@pykix.org .
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
Creating a new test script
|
||||
Alternative Shells
|
||||
|
||||
+++ * DELIVERING A NEW TEST SCRIPT
|
||||
+++ + Start a new test script over the top of template_new_releng
|
||||
+++ + Each completed script starts with auto_ or manual_ prefix
|
||||
If you decided against installing /bin/bash, you may try to use your
|
||||
current $SHELL by running
|
||||
./change_shell_to_use
|
||||
which will modify the test scripts named run_all_auto , auto_* ,manual_*.
|
||||
|
||||
Known to be suitable are the following shells
|
||||
GNU/Linux: /bin/bash
|
||||
FreeBSD 8: /bin/sh
|
||||
Solaris: /bin/bash , /bin/i86/ksh93
|
||||
|
||||
The script does not choose an interpreter explicitely and is safe to be run
|
||||
inline:
|
||||
. ./change_shell_to_use
|
||||
One may set any interpreter path by runnung a sub shell and changing its
|
||||
variable SHELL. E.g. by:
|
||||
( SHELL=/bin/my_shell" ; . ./change_shell_to_use )
|
||||
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
Creating a new test script
|
||||
|
||||
If you want to provide an own test, manual or auto, then first invent a name
|
||||
for it
|
||||
@ -185,19 +202,12 @@ Edit $test_name and process any line that begins by "# === TEMPLATE:".
|
||||
Do what the line prescribes and then remove it from the script. You are
|
||||
not done as long as such a line remains.
|
||||
|
||||
+++ + Each script' self-generated data are to be stored in
|
||||
+++ ./releng_generated_data/scriptname/ directory
|
||||
|
||||
Your test must not start if no file
|
||||
./inc/releng_getopts.inc
|
||||
exists, i.e. if the current working direcoty is not ./releng.
|
||||
If your test creates own files on disk, then it must do this underneath
|
||||
directory ./releng_generated_data/$test_name (resp. $GEN_DATA_DIR, see below).
|
||||
|
||||
+++ + Throw FAIL string to stdout if any failure is detected
|
||||
+++ + Return exit code 0 on success, non-zero on failure
|
||||
+++ + Use different exit codes for any failure (range 0-31)
|
||||
|
||||
In case of failure, issue a line to stdout that begins by the word "FAIL",
|
||||
followed by " : " and the name of the test (e.g. $SELF, see below).
|
||||
Make sure that the test script finally returns a non-zero exit value.
|
||||
@ -211,9 +221,7 @@ Predefined are:
|
||||
When exiting prematurely, make sure to call function cleanup.
|
||||
|
||||
|
||||
General options, variables, and functions
|
||||
|
||||
+++ inc/releng_getopts.inc variables, functions, initializations
|
||||
Variables, general options, helper functions
|
||||
|
||||
The code piece inc/releng_getopts.inc should get executed inline at the
|
||||
start of a test script.
|
||||
@ -258,8 +266,6 @@ for use by the single tests:
|
||||
|
||||
Specific options
|
||||
|
||||
+++ + Keep the newly added script options in sync with other scripts
|
||||
|
||||
Options which are specific to the test should begin with a double dash.
|
||||
They may have further arguments.
|
||||
Implement them in the prepared interpreter loop which begins after line
|
||||
@ -275,16 +281,13 @@ please re-use the name of that existing option.
|
||||
TODO:
|
||||
|
||||
|
||||
* Delete debian-testing-i386-businesscard.iso with ./run_all_auto -c
|
||||
* ??? Delete debian-testing-i386-businesscard.iso with ./run_all_auto -c
|
||||
|
||||
* Have a script ./run_all_manual
|
||||
* ??? Have a script ./run_all_manual
|
||||
|
||||
* derive a GNU xorriso test suite from libisoburn test suite
|
||||
|
||||
* auto_ tests should know whether they work underneath run_all_auto
|
||||
or whether they run standalone
|
||||
|
||||
* Port releng to FreeBSD.
|
||||
- Make it run with /bin/sh . Remove all bashisms and GNU gimmicks.
|
||||
|
||||
|
||||
|
39
releng/change_shell_to_use
Executable file
39
releng/change_shell_to_use
Executable file
@ -0,0 +1,39 @@
|
||||
|
||||
# check whether we are in releng and eventually create dir
|
||||
mkdir_ret=29
|
||||
if test -d releng_generated_data
|
||||
then
|
||||
if test -d releng_generated_data/change_shell_to_use
|
||||
then
|
||||
mkdir_ret=0
|
||||
else
|
||||
mkdir releng_generated_data/change_shell_to_use
|
||||
mkdir_ret=$?
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$mkdir_ret" = 0
|
||||
then
|
||||
for i in run_all_auto auto_* manual_*
|
||||
do
|
||||
temp=releng_generated_data/change_shell_to_use/temp_file
|
||||
c=$(wc -l "$i" | awk '{print $1}')
|
||||
line=$(head -n 1 "$i")
|
||||
|
||||
if echo x"$line" | grep '^x#!' >/dev/null 2>&1
|
||||
then
|
||||
cp "$i" "$temp"
|
||||
echo '#!'"$SHELL" > "$temp"
|
||||
tail -n "$(expr $c - 1)" "$i" >> "$temp"
|
||||
mv "$temp" "$i"
|
||||
echo "Changed to #!$SHELL : $i"
|
||||
fi
|
||||
done
|
||||
rmdir releng_generated_data/change_shell_to_use
|
||||
else
|
||||
echo "change_shell_to_use: Missing directory ./releng_generated_data" >&2
|
||||
echo "or cannot create directory ./releng_generated_data/change_shell_to_use" >&2
|
||||
echo "change_shell_to_use: Run aborted"
|
||||
test 1 = 0
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user