blob: 6770d02fe7e6d0a55e7dd657b4be6d35c75acfe8 (
plain)
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
#!/bin/sh
fail()
{
echo -e '[\e[1;31mFAIL\e[0m] '$i $@
}
xfail()
{
echo -e '[\e[1;35mXFAIL\e[0m] '$i $@
}
pass()
{
echo -e '[\e[0;32mPASS\e[0m] '$i $@
}
#########################
# tests expected to pass
cd $(dirname $0)
export EXECUTABLE="$PWD/../pgm-interlace"
for i in {pass,error,xfail}/*.sh ; do
test_type=$(dirname $i)
pushd $test_type > /dev/null
name=$(basename "${i/.sh/}")
expected="$name.pgm.expected"
out="$name.pgm.out"
log="$name.stderr.log"
log_expected="$log.expected"
./$(basename $i) 2> "$log"
result=$?
if [ -f "$expected" ] ; then
if ! diff "$expected" "$out" ; then
fail "output file doesn't match expectation"
popd > /dev/null
continue
fi
fi
if [ -f "$log_expected" ] ; then
if ! diff "$log_expected" "$log" ; then
fail "stderr doesn't match expectation"
popd > /dev/null
continue
fi
fi
case $test_type in
pass)
if [ $result -eq 0 ] ; then
pass
else
fail
fi
;;
error)
if [ $result -ne 0 ] ; then
pass
else
fail
fi
;;
xfail)
if [ $result -ne 0 ] ; then
xfail
else
fail
fi
;;
*)
echo Unexpected test type "$test_type", bailing
exit 1
;;
esac
rm -f "$out" # "$log"
popd > /dev/null
done
|