-
Notifications
You must be signed in to change notification settings - Fork 45
/
grade-lab1.sh
54 lines (45 loc) · 994 Bytes
/
grade-lab1.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
#!/bin/sh
qemuopts="-hda obj/kern/kernel.img"
. ./grade-functions.sh
$make
check () {
pts=20
echo_n "Printf: "
if grep "6828 decimal is 15254 octal!" jos.out >/dev/null
then
pass
else
fail
fi
pts=10
echo "Backtrace:"
args=`grep "ebp f01.* eip f0100.* args" jos.out | awk '{ print $6 }'`
cnt=`echo $args | grep '^00000000 00000000 00000001 00000002 00000003 00000004 00000005' | wc -w`
echo_n " Count "
if [ $cnt -eq 8 ]
then
pass
else
fail
fi
cnt=`grep "ebp f01.* eip f0100.* args" jos.out | awk 'BEGIN { FS = ORS = " " }
{ print $6 }
END { printf("\n") }' | grep '^00000000 00000000 00000001 00000002 00000003 00000004 00000005' | wc -w`
echo_n " Args "
if [ $cnt -eq 8 ]; then
pass
else
fail "($args)"
fi
syms=`grep "kern/init.c:[0-9]*: *test_backtrace[+]" jos.out`
symcnt=`grep "kern/init.c:[0-9]*: *test_backtrace[+]" jos.out | wc -l`
echo_n " Symbols "
if [ $symcnt -eq 6 ]; then
pass
else
fail "($syms)"
fi
}
run
check
showfinal