forked from envenomator/agon-ez80asm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.sh
47 lines (44 loc) · 1.09 KB
/
test.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
export ASMBIN=../../bin/ez80asm
NOCOLOR='\033[0m'
RED='\033[0;31m'
GREEN='\033[0;32m'
FORMAT='%-25.25s'
testresult=2
failed=0
cd tests
for FILE in *; do
if [ -d "$FILE" ]; then
cd "$FILE"
printf $FORMAT $FILE
if [ -f "test.sh" ]; then
test_number=0
./test.sh > ./test.output
testresult=$?
if [ $testresult -eq 1 ]; then
echo -e " ${RED}FAIL${NOCOLOR}"
failed=$((failed+1))
else
if [ $testresult -eq 2 ]; then
echo -e "${RED}Config error${NOCOLOR}"
exit 1
fi
echo -e "${GREEN}OK${NOCOLOR}"
fi
else
echo -e "${RED}Testscript missing${NOCOLOR}"
echo -e "${RED}Test aborted${NOCOLOR}"
exit 1
fi
cd ..
fi
done
cd ..
if [ $failed -eq 0 ]; then echo -e "${GREEN}All tests passed${NOCOLOR}"
else
echo -e -n "${RED}${failed} test"
if [ $failed -gt 1 ]; then
echo -n "s"
fi
echo -e " failed${NOCOLOR}"
fi