-
Notifications
You must be signed in to change notification settings - Fork 1
/
run_tests.sh
54 lines (46 loc) · 914 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
48
49
50
51
#!/bin/bash
TEST_DIR=test/
IN=$TEST_DIR/in/
OUT=$TEST_DIR/out/
ERROR=$TEST_DIR/error/
for case in $(ls $ERROR); do
rm $ERROR/$case
done
for case in $(ls $IN); do
ERRORS=false
if [ -e run.out ]; then
rm run.out
fi
if [ -e stdout.tmp ]; then
rm stdout.tmp
fi
filename=$(basename ${case%%.*})
printf "Executing $filename... ";
./tp0 $(cat $IN/$case) >> stdout.tmp
if [ -e run.out ]; then
diff run.out $OUT/$filename.out >> tmp;
if [ $? -ne 0 ]; then
ERRORS=true
fi
fi
diff stdout.tmp $OUT/$filename.stdout >> tmp;
if [ $? -eq 0 ]; then
echo "OK"
else
ERRORS=true
fi
if $ERRORS; then
echo "ERROR"
cat tmp
cp stdout.tmp $ERROR/$filename.error.stdout
if [ -e run.out ]; then
cp run.out $ERROR/$filename.error
fi
fi
done
if [ -e tmp ]; then
rm tmp
fi
if [ -e stdout.tmp ]; then
rm stdout.tmp
fi