aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2007-12-16 17:55:34 -0600
committerRob Landley <rob@landley.net>2007-12-16 17:55:34 -0600
commit8b479b4fd22c13fcf3fd89f8be083180aac87ae7 (patch)
tree720dfa8e656ee21013b09943147376e5d5bfaf76
parent3e09c88b0db4d5a0dad64c24448b437c0045c145 (diff)
downloadtoybox-8b479b4fd22c13fcf3fd89f8be083180aac87ae7.tar.gz
Add a wrapper to run tests out of scripts/test. With no arguments, runs all
*.test files. Arguments are names of commands to test. When environment variable "OLD" is set, tests commands in $PATH rather than new toybox versions.
-rwxr-xr-xtest.sh33
1 files changed, 33 insertions, 0 deletions
diff --git a/test.sh b/test.sh
new file mode 100755
index 00000000..47a50b1e
--- /dev/null
+++ b/test.sh
@@ -0,0 +1,33 @@
+#!/bin/bash
+
+[ -z "$TOPDIR" ] && TOPDIR="$(pwd)"
+[ -z "$TESTDIR" ] && TESTDIR="testdir"
+
+rm -rf "$TESTDIR"
+mkdir -p "$TESTDIR"
+
+if [ -z "$OLD" ]
+then
+ make install_flat PREFIX="$TESTDIR"
+fi
+
+cd "$TESTDIR"
+PATH=.:$PATH
+
+. "$TOPDIR"/scripts/test/testing.sh
+[ -f "$TOPDIR/gen_config.h" ] && export OPTIONFLAGS=:$(echo $(sed -nr 's/^#define CFG_(.*) 1/\1/p' "$TOPDIR/gen_config.h") | sed 's/ /:/g')
+
+if [ $# -ne 0 ]
+then
+ for i in "$@"
+ do
+ . "$TOPDIR"/scripts/test/$i.test
+ done
+else
+ for i in "$TOPDIR"/scripts/test/*.test
+ do
+ . $i
+ done
+fi
+
+rm -rf "$TESTDIR"