generated from usnistgov/opensource-repo
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtestall
executable file
·52 lines (46 loc) · 1.3 KB
/
testall
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash
#
# testall: run all package tests
#
# Usage: testall [ CATEGORY ... ]
#
# where CATEGORY is one of
# pyunit run the python unit tests
# services run the services integration tests
#
# For each supported CATEGORY, there must be a script with a name of the form
# scripts/testall.CATEGORY.
#
set -e
prog=`basename $0`
execdir=`dirname $0`
[ "$execdir" = "" -o "$execdir" = "." ] && execdir=$PWD
PACKAGE_DIR=`(cd $execdir/.. > /dev/null 2>&1; pwd)`
if [ -d "$PACKAGE_DIR/python/build" ]; then
export OAR_TEST_ARTIFACT_DIR="$PACKAGE_DIR/python/build/test-artifacts"
[ -d "$OAR_TEST_ARTIFACT_DIR" ] || mkdir $OAR_TEST_ARTIFACT_DIR
fi
buildtypes="pyunit services"
dotypes="$@"
[ -n "$dotypes" ] || dotypes=$buildtypes
echo > testall.out
set -o pipefail
fail=
for bt in $dotypes; do
if [ -x "$execdir/testall.$bt" ]; then
echo "Running $bt tests..." | tee -a testall.out
echo >> testall.out
echo '+' "$execdir/testall.$bt" | tee -a testall.out
("$execdir/testall.$bt" -v 2>&1 | tee -a testall.out) || fail=$?
else
echo "Testing script for $bt does not exist!" | tee -a testall.out
fail=2
fi
done
if [ -n "$fail" ]; then
echo "Some test(s) failed" | tee -a testall.out
exit $fail
else
echo "All OK" | tee -a testall.out
fi
exit 0