forked from mkatri/mit6.828-jos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
grade-lab3
executable file
·135 lines (117 loc) · 4.11 KB
/
grade-lab3
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
#!/usr/bin/env python
from gradelib import *
r = Runner(save("jos.out"),
stop_breakpoint("readline"))
@test(10)
def test_divzero():
r.user_test("divzero")
r.match('Incoming TRAP frame at 0xefbfff..',
'TRAP frame at 0xf.......',
' trap 0x00000000 Divide error',
' eip 0x008.....',
' ss 0x----0023',
'.00001000. free env 00001000',
no=['1/0 is ........!'])
@test(10)
def test_softint():
r.user_test("softint")
r.match('Welcome to the JOS kernel monitor!',
'Incoming TRAP frame at 0xefbfffbc',
'TRAP frame at 0xf.......',
' trap 0x0000000d General Protection',
' eip 0x008.....',
' ss 0x----0023',
'.00001000. free env 0000100')
@test(10)
def test_badsegment():
r.user_test("badsegment")
r.match('Incoming TRAP frame at 0xefbfffbc',
'TRAP frame at 0xf.......',
' trap 0x0000000d General Protection',
' err 0x00000028',
' eip 0x008.....',
' ss 0x----0023',
'.00001000. free env 0000100')
end_part("A")
@test(5)
def test_faultread():
r.user_test("faultread")
r.match('.00001000. user fault va 00000000 ip 008.....',
'Incoming TRAP frame at 0xefbfffbc',
'TRAP frame at 0xf.......',
' trap 0x0000000e Page Fault',
' err 0x00000004.*',
'.00001000. free env 0000100',
no=['I read ........ from location 0!'])
@test(5)
def test_faultreadkernel():
r.user_test("faultreadkernel")
r.match('.00001000. user fault va f0100000 ip 008.....',
'Incoming TRAP frame at 0xefbfffbc',
'TRAP frame at 0xf.......',
' trap 0x0000000e Page Fault',
' err 0x00000005.*',
'.00001000. free env 00001000',
no=['I read ........ from location 0xf0100000!'])
@test(5)
def test_faultwrite():
r.user_test("faultwrite")
r.match('.00001000. user fault va 00000000 ip 008.....',
'Incoming TRAP frame at 0xefbfffbc',
'TRAP frame at 0xf.......',
' trap 0x0000000e Page Fault',
' err 0x00000006.*',
'.00001000. free env 0000100')
@test(5)
def test_faultwritekernel():
r.user_test("faultwritekernel")
r.match('.00001000. user fault va f0100000 ip 008.....',
'Incoming TRAP frame at 0xefbfffbc',
'TRAP frame at 0xf.......',
' trap 0x0000000e Page Fault',
' err 0x00000007.*',
'.00001000. free env 0000100')
@test(5)
def test_breakpoint():
r.user_test("breakpoint")
r.match('Welcome to the JOS kernel monitor!',
'Incoming TRAP frame at 0xefbfffbc',
'TRAP frame at 0xf.......',
' trap 0x00000003 Breakpoint',
' eip 0x008.....',
' ss 0x----0023',
no=['.00001000. free env 00001000'])
@test(5)
def test_testbss():
r.user_test("testbss")
r.match('Making sure bss works right...',
'Yes, good. Now doing a wild write off the end...',
'.00001000. user fault va 00c..... ip 008.....',
'.00001000. free env 0000100')
@test(5)
def test_hello():
r.user_test("hello")
r.match('.00000000. new env 00001000',
'hello, world',
'i am environment 00001000',
'.00001000. exiting gracefully',
'.00001000. free env 00001000',
'Destroyed the only environment - nothing more to do!')
@test(5)
def test_buggyhello():
r.user_test("buggyhello")
r.match('.00001000. user_mem_check assertion failure for va 00000001',
'.00001000. free env 00001000')
@test(5)
def test_buggyhello2():
r.user_test("buggyhello2")
r.match('.00001000. user_mem_check assertion failure for va 0....000',
'.00001000. free env 00001000',
no=['hello, world'])
@test(5)
def test_evilhello():
r.user_test("evilhello")
r.match('.00001000. user_mem_check assertion failure for va f0100...',
'.00001000. free env 00001000')
end_part("B")
run_tests()