Mercurial > hg > toybox
annotate scripts/test.sh @ 1359:fa1a3b9eed6f draft
Tweak license page to explicitly say that zero clause BSD is functionally equivalent to placing the code in the public domain.
This license variant looks like BSD, but is an unrestricted permission grant that doesn't require you to copy specific license text into derivative works. (The second paragraph is about something we DON'T do, I.E. provide any sort of warantee, and is just boilerplate from BSD to make it look like a BSD license.)
author | Rob Landley <rob@landley.net> |
---|---|
date | Tue, 24 Jun 2014 07:00:13 -0500 |
parents | 55a533fa5039 |
children | 7dd487ddd7dc |
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 | 5 rm -rf testdir |
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 |
1088
4948a942de49
Teach scripts/test.sh to call scripts/single.sh.
Rob Landley <rob@landley.net>
parents:
606
diff
changeset
|
10 if [ $# -ne 0 ] |
4948a942de49
Teach scripts/test.sh to call scripts/single.sh.
Rob Landley <rob@landley.net>
parents:
606
diff
changeset
|
11 then |
4948a942de49
Teach scripts/test.sh to call scripts/single.sh.
Rob Landley <rob@landley.net>
parents:
606
diff
changeset
|
12 PREFIX=testdir/ scripts/single.sh "$@" || exit 1 |
4948a942de49
Teach scripts/test.sh to call scripts/single.sh.
Rob Landley <rob@landley.net>
parents:
606
diff
changeset
|
13 else |
4948a942de49
Teach scripts/test.sh to call scripts/single.sh.
Rob Landley <rob@landley.net>
parents:
606
diff
changeset
|
14 make install_flat PREFIX=testdir || exit 1 |
4948a942de49
Teach scripts/test.sh to call scripts/single.sh.
Rob Landley <rob@landley.net>
parents:
606
diff
changeset
|
15 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
|
16 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
|
17 |
206 | 18 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
|
19 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
|
20 |
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 . "$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
|
22 [ -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
|
23 |
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 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
|
25 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
|
26 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
|
27 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
|
28 . "$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
|
29 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
|
30 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
|
31 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
|
32 do |
287
977302071875
Teach run-all-tests mode to only test enabled commands.
Rob Landley <rob@landley.net>
parents:
275
diff
changeset
|
33 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
|
34 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
|
35 then |
977302071875
Teach run-all-tests mode to only test enabled commands.
Rob Landley <rob@landley.net>
parents:
275
diff
changeset
|
36 . $i |
977302071875
Teach run-all-tests mode to only test enabled commands.
Rob Landley <rob@landley.net>
parents:
275
diff
changeset
|
37 else |
977302071875
Teach run-all-tests mode to only test enabled commands.
Rob Landley <rob@landley.net>
parents:
275
diff
changeset
|
38 echo "$CMDNAME disabled" |
977302071875
Teach run-all-tests mode to only test enabled commands.
Rob Landley <rob@landley.net>
parents:
275
diff
changeset
|
39 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
|
40 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
|
41 fi |