-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.sh
39 lines (34 loc) · 806 Bytes
/
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
#!/bin/bash
#获取文件夹下所有文件
#
unit_test="./test/tac"
test_check="./test_check.py"
runner="./build/LightC"
files=$(ls $unit_test)
for sfile in ${files}
do
echo "start test:" $unit_test/$sfile
output_file=$(mktemp)
$runner $unit_test/$sfile ./output > $output_file 2>&1
ans=$?
#echo $ans
output=$(< $output_file)
rm -f $output_file
python3 $test_check $sfile $ans "$output"
ans=$?
if [ $ans -eq 0 ] ; then
echo "pass test"
else
echo "failed test:"
echo $output
if [ $ans -eq 1 ] ; then
echo "input file's name invalid"
elif [ $ans -eq 2 ] ; then
echo "err code not match"
elif [ $ans -eq 3 ] ; then
echo "err line not match"
fi
exit 1
fi
done
echo "finish all tests"