-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathgrade-lab5.sh
99 lines (74 loc) · 1.89 KB
/
grade-lab5.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
#!/bin/sh
qemuopts="-hda obj/kern/kernel.img -hdb obj/fs/fs.img"
. ./grade-functions.sh
$make
run
score=0
total=0
# Reset the file system to its original, pristine state
resetfs() {
rm -f obj/fs/fs.img
$make obj/fs/fs.img >$out
}
resetfs
runtest1 -tag 'fs i/o [testfsipc]' testfsipc \
'FS can do I/O' \
! 'idle loop can do I/O' \
quicktest 'read_block [testfsipc]' \
'superblock is good' \
quicktest 'write_block [testfsipc]' \
'write_block is good' \
quicktest 'read_bitmap [testfsipc]' \
'read_bitmap is good' \
quicktest 'alloc_block [testfsipc]' \
'alloc_block is good' \
quicktest 'file_open [testfsipc]' \
'file_open is good' \
quicktest 'file_get_block [testfsipc]' \
'file_get_block is good' \
quicktest 'file_truncate [testfsipc]' \
'file_truncate is good' \
quicktest 'file_flush [testfsipc]' \
'file_flush is good' \
quicktest 'file rewrite [testfsipc]' \
'file rewrite is good' \
quicktest 'serv_* [testfsipc]' \
'serve_open is good' \
'serve_map is good' \
'serve_close is good' \
'stale fileid is good' \
echo Part A score: $score/55
echo
total=`expr $total + $score`
score=0
pts=10
runtest1 -tag 'motd display [writemotd]' writemotd \
'OLD MOTD' \
'This is /motd, the message of the day.' \
'NEW MOTD' \
'This is the NEW message of the day!' \
preservefs=y
runtest1 -tag 'motd change [writemotd]' writemotd \
'OLD MOTD' \
'This is the NEW message of the day!' \
'NEW MOTD' \
! 'This is /motd, the message of the day.' \
pts=25
preservefs=n
runtest1 -tag 'spawn via icode [icode]' icode \
'icode: read /motd' \
'This is /motd, the message of the day.' \
'icode: spawn /init' \
'init: running' \
'init: data seems okay' \
'icode: exiting' \
'init: bss seems okay' \
"init: args: 'init' 'initarg1' 'initarg2'" \
'init: exiting' \
echo Part B score: $score/45
echo
total=`expr $total + $score`
echo "Score: $total/100"
if [ $total -lt 100 ]; then
exit 1
fi