This repository has been archived by the owner on May 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
test_all.sh
executable file
·65 lines (56 loc) · 1.56 KB
/
test_all.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/usr/bin/env bash
# set -e
source venv/bin/activate
#TESTCASE=tests/variables.py
# TESTCASE=tests/variables.py
#TESTCASE=tests/minimum.py
unexpected_count=0
expected_count=0
fail_titles=$""
RED='\033[0;31m'
NC='\033[0m' # No Color
for TESTCASE in $(find tests -name \*.py -print)
do
echo "TEST START: ${TESTCASE}"
echo "--------------------------------"
FILENAME="$(basename ${TESTCASE})"
xfail=false
if [ "${FILENAME:0:6}" = "xfail_" ]; then
echo "Expected FAIL"
xfail=true
fi
python compile_code.py $TESTCASE > $TESTCASE.bytecode
cd RustPython
cargo run ../$TESTCASE.bytecode
if [[ $? -ne 0 ]]; then
if [ "${xfail}" = true ]; then
echo "== FAIL as expected =="
let expected_count=expected_count+1
else
printf "${RED}== FAIL, expected PASS ==${NC}\n"
let unexpected_count=unexpected_count+1
fail_titles=$"${fail_titles}\n${TESTCASE}\t${RED}FAIL${NC} (expected PASS)"
fi
else
if [ "${xfail}" = true ]; then
printf "${RED}== PASS, expected FAIL ==${NC}\n"
let unexpected_count=unexpected_count+1
let unexpected_count=unexpected_count+1
fail_titles=$"${fail_titles}\n${TESTCASE}\t${RED}PASS${NC} (expected FAIL)"
else
echo "== PASS as expected =="
let expected_count=expected_count+1
fi
fi
cd ..
echo "--------------------------------"
done
echo "Summary"
echo "================"
printf "${RED}${unexpected_count} unexpected${NC}, ${expected_count} expected"
echo ""
echo ""
echo "unexpected results:"
printf "${fail_titles}"
echo ""
echo "================"