This repository has been archived by the owner on Apr 20, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
grade-lab8
executable file
·135 lines (117 loc) · 4.13 KB
/
grade-lab8
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 python2
# -*- coding: utf-8 -*-
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 0x803fffff..',
'TRAP frame at 0x804.......',
' trap 0x00000000 Divide error',
' rip 0x008.....',
' ss 0x----0033',
'.00001000. free env 00001000',
no=['1337/0 is ........!'])
@test(10)
def test_softint():
r.user_test("softint")
r.match('Welcome to the JOS kernel monitor!',
'Incoming TRAP frame at 0x803fffff40',
'TRAP frame at 0x804.......',
' trap 0x0000000d General Protection',
' rip 0x008.....',
' ss 0x----0033',
'.00001000. free env 0000100')
@test(10)
def test_badsegment():
r.user_test("badsegment")
r.match('Incoming TRAP frame at 0x803fffff40',
'TRAP frame at 0x804.......',
' trap 0x0000000d General Protection',
' err 0x00000038',
' rip 0x008.....',
' ss 0x----0033',
'.00001000. free env 0000100')
end_part("A")
@test(7)
def test_faultread():
r.user_test("faultread")
r.match('.00001000. user fault va 00000000 ip 008.....',
'Incoming TRAP frame at 0x803fffff40',
'TRAP frame at 0x804.......',
' trap 0x0000000e Page Fault',
' err 0x00000004.*',
'.00001000. free env 0000100',
no=['I read ........ from location 0!'])
@test(7)
def test_faultreadkernel():
r.user_test("faultreadkernel")
r.match('.00001000. user fault va 8040000000 ip 008.....',
'Incoming TRAP frame at 0x803fffff40',
'TRAP frame at 0x804.......',
' trap 0x0000000e Page Fault',
' err 0x00000005.*',
'.00001000. free env 00001000',
no=['I read ........ from location 0xe0100000!'])
@test(7)
def test_faultwrite():
r.user_test("faultwrite")
r.match('.00001000. user fault va 00000000 ip 008.....',
'Incoming TRAP frame at 0x803fffff40',
'TRAP frame at 0x804.......',
' trap 0x0000000e Page Fault',
' err 0x00000006.*',
'.00001000. free env 0000100')
@test(7)
def test_faultwritekernel():
r.user_test("faultwritekernel")
r.match('.00001000. user fault va 8040000000 ip 008.....',
'Incoming TRAP frame at 0x803fffff40',
'TRAP frame at 0x804.......',
' trap 0x0000000e Page Fault',
' err 0x00000007.*',
'.00001000. free env 0000100')
@test(7)
def test_breakpoint():
r.user_test("breakpoint")
r.match('Welcome to the JOS kernel monitor!',
'Incoming TRAP frame at 0x803fffff40',
'TRAP frame at 0x804.......',
' trap 0x00000003 Breakpoint',
' rip 0x008.....',
' ss 0x----0033',
no=['.00001000. free env 00001000'])
@test(7)
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 02c..... ip 008.....',
'.00001000. free env 0000100')
@test(7)
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')
@test(7)
def test_buggyhello():
r.user_test("buggyhello")
r.match('.00001000. user_mem_check assertion failure for va 0000000000000001',
'.00001000. free env 00001000')
@test(7)
def test_buggyhello2():
r.user_test("buggyhello2")
r.match('.00001000. user_mem_check assertion failure for va ................',
'.00001000. free env 00001000',
no=['hello, world'])
@test(7)
def test_evilhello():
r.user_test("evilhello")
r.match('.00001000. user_mem_check assertion failure for va 0000008040200...',
'.00001000. free env 00001000')
end_part("B")
run_tests()