summaryrefslogtreecommitdiff
path: root/22_tests_power/run_all.sh
blob: 68f709d41d7b7c6d2ca304d18c5421a0cf35e6ac (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
#!/bin/bash

for i in /usr/local/l2p/power/power*.o
do
    test=`basename $i | sed 's/power//' | sed 's/.o//'`
    if [ "$test"  == "" ]
    then
	echo "**Testing correct implementation **"
    else
	echo "**Testing broken implementation ${test} **"
    fi
    echo "-------------------------------------"
    echo ""
    gcc -o test-power test-power.c $i
    if [ "$?" != "0" ]
    then
	echo "Could not compile test-power.c with $i" > /dev/stderr
	exit 1
    fi
    ./test-power
    if [ "$?" != 0 ]
    then
	if [ "$test" == "" ]
	then
	    echo "Your test program falsely failed the correct implementation!" > /dev/stderr
	    exit 1
	fi
    else
	if [ "$test" != "" ]
	then
	    echo "Your test program did not identify $i as broken!" > /dev/stderr
	    exit 1
	fi
    fi
    echo ""
done