-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdriver.sh
93 lines (86 loc) · 2.57 KB
/
driver.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
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
#!/usr/bin/env bash
#simple program to accompany Pxydrive. Used by autograder to grade submissions
dir=$(pwd)
# Per test weights of different test categories
WEIGHT_A=2
WEIGHT_B=1
WEIGHT_C=3
WEIGHT_D=2
# Stretch factors for pxydrive delays
CP_STRETCH=150
FULL_STRETCH=200
if [ $# -eq 0 ]; then
echo "Full submission testing"
echo "Running with stretch = ${FULL_STRETCH}"
pxy/pxyregress.py -p ./proxy -t 120 -L results.log -c 4 -d ${FULL_STRETCH} -a 5
cd logs
score_A=0
score_B=0
score_C=0
score_D=0
numPassed=0
for file in A*.log; do
result=$(tac $file |egrep -a -m 1 .)
if [ "$result" = "ALL TESTS PASSED" ]; then
numPassed=`expr ${numPassed} + 1`
fi
done
score_A=$((numPassed*WEIGHT_A))
numPassed=0
for file in B*.log; do
result=$(tac $file |egrep -a -m 1 .)
if [ "$result" = "ALL TESTS PASSED" ]; then
numPassed=`expr ${numPassed} + 1`
fi
done
score_B=$((numPassed*WEIGHT_B))
numPassed=0
for file in C*.log; do
result=$(tac $file |egrep -a -m 1 .)
if [ "$result" = "ALL TESTS PASSED" ]; then
numPassed=`expr ${numPassed} + 1`
fi
done
score_C=$((numPassed*WEIGHT_C))
numPassed=0
for file in D*.log; do
result=$(tac $file |egrep -a -m 1 .)
if [ "$result" = "ALL TESTS PASSED" ]; then
numPassed=`expr ${numPassed} + 1`
fi
done
score_D=$((numPassed*WEIGHT_D))
totalScore=$((score_A+score_B+score_C+score_D))
cd ..
echo "{ \"scores\": {\"A\":${score_A}, \"B\":${score_B}, \"C\":${score_C}, \"D\":${score_D}}, \"scoreboard\": [${totalScore}, ${score_A}, ${score_B}, ${score_C}, ${score_D}]}"
elif [ $1 == "check" ]; then
echo "Checkpoint submission testing"
echo "Running with stretch = ${CP_STRETCH}"
pxy/pxyregress.py -p ./proxy -s AB -t 120 -L results.log -d ${CP_STRETCH} -a 5
cd logs
score_A=0
score_B=0
numPassed=0
for file in A*.log; do
result=$(tac $file |egrep -a -m 1 .)
if [ "$result" = "ALL TESTS PASSED" ]; then
numPassed=`expr ${numPassed} + 1`
fi
done
score_A=$((numPassed*WEIGHT_A))
numPassed=0
for file in B*.log; do
result=$(tac $file |egrep -a -m 1 .)
if [ "$result" = "ALL TESTS PASSED" ]; then
numPassed=`expr ${numPassed} + 1`
fi
done
score_B=$((numPassed*WEIGHT_B))
totalScore=$((score_A+score_B))
cd ..
echo "{ \"scores\": {\"A\":${score_A}, \"B\":${score_B}}, \"scoreboard\": [${totalScore}, ${score_A}, ${score_B}]}"
else
echo "Run without arguments to run full PxyRegress test suite for final submission"
echo "Run with argument 'check' to run PxyRegress test suit for checkpoint submission"
fi
exit