-
Notifications
You must be signed in to change notification settings - Fork 0
/
grader.sh
executable file
·110 lines (85 loc) · 1.93 KB
/
grader.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
#!/bin/bash
BACKEND="xinu135"
RDSERVER_PORT=10000
basedir=`pwd`
echo $basedir
skipped=0
if [ $# -eq 1 ]
then
echo "Skip until " $1
fi
grading_ts=`date +"%F_%T"`
echo "Timestamp: $grading_ts"
selective_start=0
for submission in *
do
cd "$basedir"
if [ -d "$submission" ]; then
echo $submission
else
continue
fi
if [ $# -eq 1 ]
then
if [ $1 = $submission ] || [ $selective_start -eq 1 ];
then
echo "start from " $1
selective_start=1
else
echo "skip" $1
continue
fi
fi
cd $basedir/$submission
XINUSRC=`ls -d *`
if [ $? -eq 0 ]; then
echo "XINUSRC is set to $XINUSRC"
else
echo "\$XINUSRC undefined"
fi
cd $XINUSRC
echo "at " `pwd`
if [ ! -e system/_orig_main.c ]; then
cp system/main.c system/_orig_main.c
fi
mv system/main.c system/main.c.$grading_ts
# patch rdserver port number
../../../patch_rdserver_port.sh
# patch bug
#cp ../../../new_xdone.c system/xdone.c
#cp ../../../new_kprintf.c system/kprintf.c
cp ../../../testcases/lab6_testcase.c system/main.c
cp ../../../testcases/lab6_hooks.c system/hooks.c
#echo "Pause before patching main.c"
#read choice
cd rdserver/
make
cd ..
cd compile/
if [ $? -ne 0 ]; then
echo "compile/ subdirectory not found. error and don't grade"
continue;
fi
retry_compile='y'
while [ $retry_compile == 'y' ]; do
make clean all > ../make.log
if [ $? -eq 0 ]; then
break
else
echo "can't compile. retry? (y/n)"
read retry_compile
#retry_compile='n'
fi
done
if [ $retry_compile != 'y' ]; then
echo "code does not compile. give up. move up to the next student";
continue
fi
# start the remote backend machine
rm -f ../rdserver/backing_store
../rdserver/rdserver $RDSERVER_PORT &> ../rdserver.log &
# start the kernel
../../../../manual-run.exp $BACKEND xinu | tee ../grading.log
killall rdserver
sleep 5
done