-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtestall
executable file
·113 lines (94 loc) · 3.54 KB
/
testall
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#!/bin/bash
if [ $# -ne 1 ]
then
echo "Usage: `basename $0` port"
exit 1
fi
PORT=$1
export LAB=lab6
(make clean; make) || exit 1
echo Killing any server running
PIDS=`/bin/ps -u $USER | grep talk-ser | awk '{print $1;}'`
kill -9 $PIDS >& /dev/null
sleep 2
total=0
totalmax=0
rm -f total.txt *out total.txt
# Test driver
function runtest {
prog=$1
progorg=$2
args=$3
testinput=$4
grade=$5
totalmax=`expr $totalmax + $grade`;
inputdescr=
if [ "$testinput" != "none" ]; then
inputdescr=" < $testinput"
fi
descr="$prog $args $inputdescr"
echo "======= $descr ==========="
#Run tested program
rm -f prog.out prog.org.out
echo "$prog $args < $testinput > prog.out"
echo "$progorg $args < $testinput > prog.org.out"
$prog $args < $testinput > prog.out
$progorg $args < $testinput > prog.org.out
if [ $? -eq 0 ]; then
diff prog.out prog.org.out > diff.out
if [ $? -eq 0 ]; then
cat prog.out
echo Test passed...;
printf "%-36s: %-3d of %-3d\n" "$descr " $grade $grade >> total.txt
total=`expr $total + $grade`;
else
echo "*****Test Failed*****";
echo ------ Your Output ----------
cat prog.out
echo ------ Expected Output ------
cat prog.org.out
echo ------ Difference -----------
cat diff.out
echo -----------------------------
printf "%-36s: %-3d of %-3d\n" "$descr " 0 $grade >> total.txt
fi
else
echo "*****Test Failed*****";
echo $progorg failed
printf "%-36s: %-3d of %-3d\n" "$descr " 0 $grade >> total.txt
fi
echo
}
# List of tests running
runtest ./HashTableVoidTest ./HashTableVoidTest.org "test1" none 2
runtest ./HashTableVoidTest ./HashTableVoidTest.org "test2" none 2
runtest ./HashTableVoidTest ./HashTableVoidTest.org "test3" none 2
runtest ./HashTableVoidTest ./HashTableVoidTest.org "test4" none 2
runtest ./HashTableVoidTest ./HashTableVoidTest.org "test5" none 2
runtest ./HashTableVoidTest ./HashTableVoidTest.org "test6" none 2
runtest "./test-server1.sh ./IRCServer $PORT" "./test-server1.sh ./IRCServer.org $PORT" "" none 5
runtest "./test-server2.sh ./IRCServer $PORT" "./test-server2.sh ./IRCServer.org $PORT" "" none 5
runtest "./test-server3.sh ./IRCServer $PORT" "./test-server3.sh ./IRCServer.org $PORT" "" none 5
runtest "./test-server4.sh ./IRCServer $PORT" "./test-server4.sh ./IRCServer.org $PORT" "" none 5
runtest "./test-server5.sh ./IRCServer $PORT" "./test-server5.sh ./IRCServer.org $PORT" "" none 5
runtest "./test-server6.sh ./IRCServer $PORT" "./test-server6.sh ./IRCServer.org $PORT" "" none 5
runtest "./test-server7.sh ./IRCServer $PORT" "./test-server7.sh ./IRCServer.org $PORT" "" none 5
runtest "./test-server8.sh ./IRCServer $PORT" "./test-server8.sh ./IRCServer.org $PORT" "" none 5
runtest "./test-server9.sh ./IRCServer $PORT" "./test-server9.sh ./IRCServer.org $PORT" "" none 5
runtest "./test-server10.sh ./IRCServer $PORT" "./test-server10.sh ./IRCServer.org $PORT" "" none 5
echo
echo
echo "-------------------------------------------------"
echo "CS240: $LAB. $USER "
echo "-------------------------------------------------"
cat total.txt
echo "-------------------------------------------------"
echo "CS240: $LAB. $USER" `date` " Total: " $total of $totalmax >> total.out
echo >> total.out
cat total.out
cat total.out >> .local.total.out
#Do not remove or comment these lines. They are used for monitoring progress.
labout=/homes/cs240/LABOUT/$LAB/$USER/total.txt
cat total.out >> $labout
git add -A >> .local.git.out
git commit -a -m "$total of $totalmax" >> .local.git.out