forked from wrpseudo/pseudo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_tests.sh
executable file
·48 lines (42 loc) · 940 Bytes
/
run_tests.sh
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
#!/bin/bash
opt_verbose=
usage()
{
echo >&2 "usage:"
echo >&2 " run_tests [-v|--verbose]"
exit 1
}
for arg
do
case $arg in
--) shift; break ;;
-v | --verbose)
opt_verbose=-v
;;
*)
usage
;;
esac
done
#The tests will be run on the build dir, not the installed versions
#This requires to following be set properly.
export PSEUDO_PREFIX=${PWD}
num_tests=0
num_passed_tests=0
for file in test/test*.sh
do
filename=${file#test/}
let num_tests++
mkdir -p var/pseudo
./bin/pseudo $file ${opt_verbose}
if [ "$?" -eq "0" ]; then
let num_passed_tests++
if [ "${opt_verbose}" == "-v" ]; then
echo "${filename%.sh}: Passed."
fi
else
echo "${filename/%.sh}: Failed."
fi
rm -rf var/pseudo/*
done
echo "${num_passed_tests}/${num_tests} test(s) passed."