forked from ekinoguz/ProcessSchedulers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
grade.sh
executable file
·170 lines (147 loc) · 3.27 KB
/
grade.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
#!/bin/sh
if [ -z "$1" ]
then
echo 'Must enter a parameter <student-id-number>';
exit;
fi
SUBMISSION="$1"'.zip'
HOME="$1"'/'
echo 'Creating a directory for' $HOME;
mkdir $HOME;
echo 'Unzipping the submission' $SUBMISSION;
cp $SUBMISSION $HOME;
cd $HOME;
unzip -q $SUBMISSION;
echo 'Copying private tests and Tester.java into' $HOME;
cd '../';
cp Tester.java $HOME;
cp -r tests $HOME;
cd $HOME;
echo 'Compiling the submission'
make clean;
make;
java Tester;
# Declare grade variables
grade=0;
bonus=0;
# Add your test comparisons to below
# FCFS
echo 'Testing FCFS...'
if diff -q tests/fcfs1.output tests/fcfs1.expected > /dev/null; then
: # files are the same
echo 'passing 1'
grade=$((grade + 10))
else
: # files are different
echo 'failing 1'
fi
if diff -q tests/fcfs2.output tests/fcfs2.expected > /dev/null; then
: # files are the same
echo 'passing 2'
grade=$((grade + 10))
else
: # files are different
echo 'failing 2'
fi
if diff -q tests/fcfs3.output tests/fcfs3.expected > /dev/null; then
: # files are the same
echo 'passing 3'
grade=$((grade + 10))
else
: # files are different
echo 'failing 3'
fi
if diff -q tests/fcfs4.output tests/fcfs4.expected > /dev/null; then
: # files are the same
echo 'passing 4'
grade=$((grade + 10))
else
: # files are different
echo 'failing 4'
fi
# SRTF
echo 'Testing SRTF...'
if diff -q tests/srtf1.output tests/srtf1.expected > /dev/null; then
: # files are the same
echo 'passing 1'
grade=$((grade + 10))
else
: # files are different
echo 'failing 1'
fi
if diff -q tests/srtf2.output tests/srtf2.expected > /dev/null; then
: # files are the same
echo 'passing 2'
grade=$((grade + 10))
else
: # files are different
echo 'failing 2'
fi
if diff -q tests/srtf3.output tests/srtf3.expected > /dev/null; then
: # files are the same
echo 'passing 3'
grade=$((grade + 10))
else
: # files are different
echo 'failing 3'
fi
if diff -q tests/srtf4.output tests/srtf4.expected > /dev/null; then
: # files are the same
echo 'passing 4'
grade=$((grade + 10))
else
: # files are different
echo 'failing 4'
fi
if diff -q tests/srtf5.output tests/srtf5.expected > /dev/null; then
: # files are the same
echo 'passing 5'
grade=$((grade + 10))
else
: # files are different
echo 'failing 5'
fi
# PS
echo 'Testing PS...'
if diff tests/ps1.output tests/ps1.expected > /dev/null; then
: # files are the same
echo 'passing 1'
bonus=$((bonus + 10))
else
: # files are different
echo 'failing 1'
fi
if diff -q tests/ps2.output tests/ps2.expected > /dev/null; then
: # files are the same
echo 'passing 2'
bonus=$((bonus + 10))
else
: # files are different
echo 'failing 2'
fi
if diff -q tests/ps3.output tests/ps3.expected > /dev/null; then
: # files are the same
echo 'passing 3'
bonus=$((bonus + 10))
else
: # files are different
echo 'failing 3'
fi
if diff -q tests/ps4.output tests/ps4.expected > /dev/null; then
: # files are the same
echo 'passing 4'
bonus=$((bonus + 10))
else
: # files are different
echo 'failing 4'
fi
if diff -q tests/ps5.output tests/ps5.expected > /dev/null; then
: # files are the same
echo 'passing 5'
bonus=$((bonus + 10))
else
: # files are different
echo 'failing 5'
fi
echo 'Grade is:' $grade;
echo 'Bonus grade is:' $bonus;