annotate scripts/test.sh @ 994:00c7b6f4104a

Cleanup klogd Remove #if and inline most functions
author Felix Janda <felix.janda@posteo.de>
date Sat, 10 Aug 2013 19:35:11 +0200
parents b9ea00fffee5
children 4948a942de49
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
204
64b6941c2f51 Add a wrapper to run tests out of scripts/test. With no arguments, runs all
Rob Landley <rob@landley.net>
parents:
diff changeset
1 #!/bin/bash
64b6941c2f51 Add a wrapper to run tests out of scripts/test. With no arguments, runs all
Rob Landley <rob@landley.net>
parents:
diff changeset
2
64b6941c2f51 Add a wrapper to run tests out of scripts/test. With no arguments, runs all
Rob Landley <rob@landley.net>
parents:
diff changeset
3 [ -z "$TOPDIR" ] && TOPDIR="$(pwd)"
64b6941c2f51 Add a wrapper to run tests out of scripts/test. With no arguments, runs all
Rob Landley <rob@landley.net>
parents:
diff changeset
4
206
a14921912ebc Delete testdir after use.
Rob Landley <rob@landley.net>
parents: 204
diff changeset
5 rm -rf testdir
a14921912ebc Delete testdir after use.
Rob Landley <rob@landley.net>
parents: 204
diff changeset
6 mkdir -p testdir
204
64b6941c2f51 Add a wrapper to run tests out of scripts/test. With no arguments, runs all
Rob Landley <rob@landley.net>
parents:
diff changeset
7
291
620a2eab6b82 More tweaks to rmdir.test and the testing infrastructure.
Rob Landley <rob@landley.net>
parents: 287
diff changeset
8 if [ -z "$TEST_HOST" ]
204
64b6941c2f51 Add a wrapper to run tests out of scripts/test. With no arguments, runs all
Rob Landley <rob@landley.net>
parents:
diff changeset
9 then
287
977302071875 Teach run-all-tests mode to only test enabled commands.
Rob Landley <rob@landley.net>
parents: 275
diff changeset
10 make install_flat PREFIX=testdir || exit 1
204
64b6941c2f51 Add a wrapper to run tests out of scripts/test. With no arguments, runs all
Rob Landley <rob@landley.net>
parents:
diff changeset
11 fi
64b6941c2f51 Add a wrapper to run tests out of scripts/test. With no arguments, runs all
Rob Landley <rob@landley.net>
parents:
diff changeset
12
206
a14921912ebc Delete testdir after use.
Rob Landley <rob@landley.net>
parents: 204
diff changeset
13 cd testdir
606
b9ea00fffee5 Work around a Bash bug that removes "." from the $PATH when you're root. (The FSF believes it knows better than you, and won't let you do things, in the name of Freedom.)
Rob Landley <rob@landley.net>
parents: 300
diff changeset
14 PATH="$(pwd):$PATH"
204
64b6941c2f51 Add a wrapper to run tests out of scripts/test. With no arguments, runs all
Rob Landley <rob@landley.net>
parents:
diff changeset
15
64b6941c2f51 Add a wrapper to run tests out of scripts/test. With no arguments, runs all
Rob Landley <rob@landley.net>
parents:
diff changeset
16 . "$TOPDIR"/scripts/test/testing.sh
300
8f481b23138b Adjust "optional" function (gen_config.h became generated/config.h).
Rob Landley <rob@landley.net>
parents: 291
diff changeset
17 [ -f "$TOPDIR/generated/config.h" ] && export OPTIONFLAGS=:$(echo $(sed -nr 's/^#define CFG_(.*) 1/\1/p' "$TOPDIR/generated/config.h") | sed 's/ /:/g')
204
64b6941c2f51 Add a wrapper to run tests out of scripts/test. With no arguments, runs all
Rob Landley <rob@landley.net>
parents:
diff changeset
18
64b6941c2f51 Add a wrapper to run tests out of scripts/test. With no arguments, runs all
Rob Landley <rob@landley.net>
parents:
diff changeset
19 if [ $# -ne 0 ]
64b6941c2f51 Add a wrapper to run tests out of scripts/test. With no arguments, runs all
Rob Landley <rob@landley.net>
parents:
diff changeset
20 then
64b6941c2f51 Add a wrapper to run tests out of scripts/test. With no arguments, runs all
Rob Landley <rob@landley.net>
parents:
diff changeset
21 for i in "$@"
64b6941c2f51 Add a wrapper to run tests out of scripts/test. With no arguments, runs all
Rob Landley <rob@landley.net>
parents:
diff changeset
22 do
606
b9ea00fffee5 Work around a Bash bug that removes "." from the $PATH when you're root. (The FSF believes it knows better than you, and won't let you do things, in the name of Freedom.)
Rob Landley <rob@landley.net>
parents: 300
diff changeset
23 ln -sf toybox $i
204
64b6941c2f51 Add a wrapper to run tests out of scripts/test. With no arguments, runs all
Rob Landley <rob@landley.net>
parents:
diff changeset
24 . "$TOPDIR"/scripts/test/$i.test
64b6941c2f51 Add a wrapper to run tests out of scripts/test. With no arguments, runs all
Rob Landley <rob@landley.net>
parents:
diff changeset
25 done
64b6941c2f51 Add a wrapper to run tests out of scripts/test. With no arguments, runs all
Rob Landley <rob@landley.net>
parents:
diff changeset
26 else
64b6941c2f51 Add a wrapper to run tests out of scripts/test. With no arguments, runs all
Rob Landley <rob@landley.net>
parents:
diff changeset
27 for i in "$TOPDIR"/scripts/test/*.test
64b6941c2f51 Add a wrapper to run tests out of scripts/test. With no arguments, runs all
Rob Landley <rob@landley.net>
parents:
diff changeset
28 do
287
977302071875 Teach run-all-tests mode to only test enabled commands.
Rob Landley <rob@landley.net>
parents: 275
diff changeset
29 CMDNAME="$(echo "$i" | sed 's@.*/\(.*\)\.test@\1@')"
291
620a2eab6b82 More tweaks to rmdir.test and the testing infrastructure.
Rob Landley <rob@landley.net>
parents: 287
diff changeset
30 if [ -h $CMDNAME ] || [ ! -z "$TEST_HOST" ]
287
977302071875 Teach run-all-tests mode to only test enabled commands.
Rob Landley <rob@landley.net>
parents: 275
diff changeset
31 then
977302071875 Teach run-all-tests mode to only test enabled commands.
Rob Landley <rob@landley.net>
parents: 275
diff changeset
32 . $i
977302071875 Teach run-all-tests mode to only test enabled commands.
Rob Landley <rob@landley.net>
parents: 275
diff changeset
33 else
977302071875 Teach run-all-tests mode to only test enabled commands.
Rob Landley <rob@landley.net>
parents: 275
diff changeset
34 echo "$CMDNAME disabled"
977302071875 Teach run-all-tests mode to only test enabled commands.
Rob Landley <rob@landley.net>
parents: 275
diff changeset
35 fi
204
64b6941c2f51 Add a wrapper to run tests out of scripts/test. With no arguments, runs all
Rob Landley <rob@landley.net>
parents:
diff changeset
36 done
64b6941c2f51 Add a wrapper to run tests out of scripts/test. With no arguments, runs all
Rob Landley <rob@landley.net>
parents:
diff changeset
37 fi