annotate test.sh @ 204:64b6941c2f51

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.
author Rob Landley <rob@landley.net>
date Sun, 16 Dec 2007 17:55:34 -0600
parents
children a14921912ebc
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 [ -z "$TESTDIR" ] && TESTDIR="testdir"
64b6941c2f51 Add a wrapper to run tests out of scripts/test. With no arguments, runs all
Rob Landley <rob@landley.net>
parents:
diff changeset
5
64b6941c2f51 Add a wrapper to run tests out of scripts/test. With no arguments, runs all
Rob Landley <rob@landley.net>
parents:
diff changeset
6 rm -rf "$TESTDIR"
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 mkdir -p "$TESTDIR"
64b6941c2f51 Add a wrapper to run tests out of scripts/test. With no arguments, runs all
Rob Landley <rob@landley.net>
parents:
diff changeset
8
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 if [ -z "$OLD" ]
64b6941c2f51 Add a wrapper to run tests out of scripts/test. With no arguments, runs all
Rob Landley <rob@landley.net>
parents:
diff changeset
10 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
11 make install_flat PREFIX="$TESTDIR"
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 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
13
64b6941c2f51 Add a wrapper to run tests out of scripts/test. With no arguments, runs all
Rob Landley <rob@landley.net>
parents:
diff changeset
14 cd "$TESTDIR"
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 PATH=.:$PATH
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
64b6941c2f51 Add a wrapper to run tests out of scripts/test. With no arguments, runs all
Rob Landley <rob@landley.net>
parents:
diff changeset
17 . "$TOPDIR"/scripts/test/testing.sh
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 [ -f "$TOPDIR/gen_config.h" ] && export OPTIONFLAGS=:$(echo $(sed -nr 's/^#define CFG_(.*) 1/\1/p' "$TOPDIR/gen_config.h") | sed 's/ /:/g')
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
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 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
21 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
22 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
23 do
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
64b6941c2f51 Add a wrapper to run tests out of scripts/test. With no arguments, runs all
Rob Landley <rob@landley.net>
parents:
diff changeset
29 . $i
64b6941c2f51 Add a wrapper to run tests out of scripts/test. With no arguments, runs all
Rob Landley <rob@landley.net>
parents:
diff changeset
30 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
31 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
32
64b6941c2f51 Add a wrapper to run tests out of scripts/test. With no arguments, runs all
Rob Landley <rob@landley.net>
parents:
diff changeset
33 rm -rf "$TESTDIR"