Mercurial > hg > toybox
comparison scripts/test.sh @ 1376:7dd487ddd7dc draft
Have "make test" run tests in testdir/testdir instead of same directory as command symlinks. (Makes cleanup easier.)
author | Rob Landley <rob@landley.net> |
---|---|
date | Thu, 03 Jul 2014 22:09:11 -0500 |
parents | 55a533fa5039 |
children | 8700cbe1cb29 |
comparison
equal
deleted
inserted
replaced
1375:b6645034202b | 1376:7dd487ddd7dc |
---|---|
1 #!/bin/bash | 1 #!/bin/bash |
2 | 2 |
3 [ -z "$TOPDIR" ] && TOPDIR="$(pwd)" | 3 [ -z "$TOPDIR" ] && TOPDIR="$(pwd)" |
4 | 4 |
5 rm -rf testdir | 5 rm -rf testdir |
6 mkdir -p testdir | 6 mkdir -p testdir/testdir |
7 | 7 |
8 if [ -z "$TEST_HOST" ] | 8 if [ -z "$TEST_HOST" ] |
9 then | 9 then |
10 if [ $# -ne 0 ] | 10 if [ $# -ne 0 ] |
11 then | 11 then |
14 make install_flat PREFIX=testdir || exit 1 | 14 make install_flat PREFIX=testdir || exit 1 |
15 fi | 15 fi |
16 fi | 16 fi |
17 | 17 |
18 cd testdir | 18 cd testdir |
19 PATH="$(pwd):$PATH" | 19 PATH="$PWD:$PATH" |
20 cd testdir | |
20 | 21 |
21 . "$TOPDIR"/scripts/test/testing.sh | 22 . "$TOPDIR"/scripts/test/testing.sh |
22 [ -f "$TOPDIR/generated/config.h" ] && export OPTIONFLAGS=:$(echo $(sed -nr 's/^#define CFG_(.*) 1/\1/p' "$TOPDIR/generated/config.h") | sed 's/ /:/g') | 23 [ -f "$TOPDIR/generated/config.h" ] && export OPTIONFLAGS=:$(echo $(sed -nr 's/^#define CFG_(.*) 1/\1/p' "$TOPDIR/generated/config.h") | sed 's/ /:/g') |
23 | 24 |
24 if [ $# -ne 0 ] | 25 if [ $# -ne 0 ] |
29 done | 30 done |
30 else | 31 else |
31 for i in "$TOPDIR"/scripts/test/*.test | 32 for i in "$TOPDIR"/scripts/test/*.test |
32 do | 33 do |
33 CMDNAME="$(echo "$i" | sed 's@.*/\(.*\)\.test@\1@')" | 34 CMDNAME="$(echo "$i" | sed 's@.*/\(.*\)\.test@\1@')" |
34 if [ -h $CMDNAME ] || [ ! -z "$TEST_HOST" ] | 35 if [ -h ../$CMDNAME ] || [ ! -z "$TEST_HOST" ] |
35 then | 36 then |
37 cd .. && rm -rf testdir && mkdir testdir && cd testdir || exit 1 | |
36 . $i | 38 . $i |
37 else | 39 else |
38 echo "$CMDNAME disabled" | 40 echo "$CMDNAME disabled" |
39 fi | 41 fi |
40 done | 42 done |