mirror of
https://codeberg.org/landley/toybox.git
synced 2026-01-26 14:13:25 +00:00
Add comments and collate some assignments.
This commit is contained in:
parent
c45e800803
commit
c807258d65
@ -3,15 +3,16 @@
|
||||
source scripts/runtest.sh
|
||||
source scripts/portability.sh
|
||||
|
||||
TOPDIR="$PWD"
|
||||
export FILES="$PWD"/tests/files
|
||||
|
||||
# Kill child processes when we exit
|
||||
trap 'kill $(jobs -p) 2>/dev/null; exit 1' INT
|
||||
|
||||
export PREFIX=generated/testdir
|
||||
# Create working directory
|
||||
TOPDIR="$PWD"
|
||||
export FILES="$PWD"/tests/files PREFIX=generated/testdir
|
||||
rm -rf "$PREFIX"
|
||||
mkdir -p "$PREFIX"/testdir
|
||||
|
||||
# Populate working directory
|
||||
if [ -z "$TEST_HOST" ]
|
||||
then
|
||||
if [ $# -ne 0 ]
|
||||
@ -22,21 +23,25 @@ then
|
||||
fi
|
||||
fi
|
||||
|
||||
# Add prefix to $PATH
|
||||
export -n PREFIX
|
||||
cd "$PREFIX"
|
||||
PATH="$PWD:$PATH"
|
||||
TESTDIR="$PWD"
|
||||
PATH="$PWD:$PATH" TESTDIR="$PWD"
|
||||
export LC_COLLATE=C
|
||||
|
||||
# Collection OPTIONFLAGS for optional()
|
||||
[ -f "$TOPDIR/generated/config.h" ] &&
|
||||
export OPTIONFLAGS=:$($SED -nr 's/^#define CFG_(.*) 1$/\1/p' "$TOPDIR/generated/config.h" | tr '\n' :)
|
||||
|
||||
# Run a test file in $TESTDIR/testdir with $CMDNAME and $C set, parse $FAILCOUNT
|
||||
do_test()
|
||||
{
|
||||
# reset testdir
|
||||
cd "$TESTDIR" && rm -rf testdir continue && mkdir testdir && cd testdir ||
|
||||
exit 1
|
||||
CMDNAME="${1##*/}"
|
||||
CMDNAME="${CMDNAME%.test}"
|
||||
|
||||
# set CMDNAME to base name of test file, and C to full path to command
|
||||
CMDNAME="${1##*/}" CMDNAME="${CMDNAME%.test}"
|
||||
if [ -z "$TEST_HOST" ]
|
||||
then
|
||||
C="$TESTDIR/$CMDNAME"
|
||||
@ -47,11 +52,13 @@ do_test()
|
||||
[ -z "$C" ] && printf '%s\n' "$SHOWSKIP: no $CMDNAME" && return
|
||||
fi
|
||||
|
||||
# Run command.test in a subshell
|
||||
(. "$1"; cd "$TESTDIR"; echo "$FAILCOUNT" > continue)
|
||||
cd "$TESTDIR"
|
||||
[ -e continue ] && FAILCOUNT=$(($(cat continue)+$FAILCOUNT)) || exit 1
|
||||
}
|
||||
|
||||
# Run each test listed on command line or else all tests with executable bit set
|
||||
if [ $# -ne 0 ]
|
||||
then
|
||||
for i in "$@"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user