From 0975a057b56b4222fe402032601c78d7ac84505f Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Thu, 26 Nov 2009 09:24:51 +0100 Subject: [PATCH] init.sh: add documentation in comments * tests/init.sh: Add some developer and user documentation. --- ChangeLog | 5 +++++ tests/init.sh | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/ChangeLog b/ChangeLog index dacf78201..d590bce68 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-11-25 Bruno Haible + + init.sh: add documentation in comments + * tests/init.sh: Add some developer and user documentation. + 2009-11-26 Jim Meyering init.sh: accommodate even those who specify bogus srcdir manually diff --git a/tests/init.sh b/tests/init.sh index db2fa76c9..c7e042558 100644 --- a/tests/init.sh +++ b/tests/init.sh @@ -15,6 +15,42 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +# Using this file in a test +# ========================= +# +# The typical skeleton of a test looks like this: +# +# #!/bin/sh +# : ${srcdir=.} +# . "$srcdir/init.sh" --set-path=. +# Execute some commands. +# Note that these commands are executed in a subdirectory, therefore you +# need to prepend "../" to relative filenames in the build directory. +# Set the exit code 0 for success, 77 for skipped, or 1 or other for failure. +# with the corresponding exit code. +# Exit $? + +# Executing a test that uses this file +# ==================================== +# +# Running a single test: +# $ make check TESTS=test-foo.sh +# +# Running a single test, with verbose output: +# $ make check TESTS=test-foo.sh VERBOSE=yes +# +# Running a single test, with single-stepping: +# 1. Go into a sub-shell: +# $ bash +# 2. Set relevant environment variables from TESTS_ENVIRONMENT in the +# Makefile: +# $ export srcdir=../../tests # this is an example +# 3. Execute the commands from the test, copy&pasting them one by one: +# $ . "$srcdir/init.sh" --set-path=. +# ... +# 4. Finally +# $ exit + # We use a trap below for cleanup. This requires us to go through # hoops to get the right exit status transported through the handler. # So use `Exit STATUS' instead of `exit STATUS' inside of the tests. -- 2.11.0