-
Notifications
You must be signed in to change notification settings - Fork 0
/
grade-lab7
executable file
·113 lines (98 loc) · 3.57 KB
/
grade-lab7
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
#!/usr/bin/env python
from gradelib import *
r = Runner(save('jos.out'),
stop_breakpoint('readline'))
@test(0, 'running JOS')
def test_jos():
r.run_qemu()
@test(10)
def test_yield():
r.user_test('yield')
r.match('.PID 1. Hello!',
'.PID 1. I am back! This is round 1',
'.PID 1. I am back! This is round 2',
'.PID 1. I am back! This is round 3',
'.PID 1. I am back! This is round 4',
'.PID 1. I am back! This is round 5',
'.PID 1. I am done! Good bye!',
'.PID 1. Exiting gracefully',
'.PID 1. Freed task with PID 1',
'Destroyed the only task - nothing more to do!')
@test(10)
def test_waitnone():
r.user_test('waitnone')
r.match('.PID 1. Exiting gracefully',
'.PID 1. Freed task with PID 1',
'Destroyed the only task - nothing more to do!')
@test(10)
def test_waitself():
r.user_test('waitself')
r.match('.PID 1. Exiting gracefully',
'.PID 1. Freed task with PID 1',
'Destroyed the only task - nothing more to do!')
@test(10)
def test_basicfork():
r.user_test('basicfork')
r.match('.PID 1. New task with PID 2',
'.PID 2. I am the child!',
'.PID 1. I am the parent!',
'.PID 1. Exiting gracefully',
'.PID .. Freed task with PID 2',
'.PID 1. Freed task with PID 1',
'Destroyed the only task - nothing more to do!')
@test(10)
def test_cowfork():
r.user_test('cowfork')
r.match('.PID 1. New task with PID 2',
'.PID 2. I am the child!',
'.PID 1. I am the parent!',
'.PID 1. Exiting gracefully',
'.PID .. Freed task with PID 2',
'.PID 1. Freed task with PID 1',
'Destroyed the only task - nothing more to do!')
@test(10)
def test_reaper():
r.user_test('reaper')
r.match('.PID 1. New task with PID 2',
'.PID 2. I am the child!',
'.PID 1. I am the parent!',
'.PID .. Freed task with PID 2',
'.PID 1. Exiting gracefully',
'.PID 1. Freed task with PID 1',
'Destroyed the only task - nothing more to do!')
@test(10)
def test_wait():
r.user_test('wait')
r.match('.PID 1. New task with PID 2',
'.PID 2. I am the child!',
'.PID 2. Back again!',
'.PID 2. Back again!',
'.PID 2. Back again!',
'.PID 2. Back again!',
'.PID 2. Back again!',
'.PID .. Freed task with PID 2',
'.PID 1. I am the parent!',
'.PID 1. Exiting gracefully',
'.PID 1. Freed task with PID 1',
'Destroyed the only task - nothing more to do!')
@test(10)
def test_evilchild():
r.user_test('evilchild')
r.match('.PID 1. New task with PID 2',
'.PID 2. I am the child!',
'.PID 1. Reaping task with PID 2',
'.PID 1. Freed task with PID 2',
'.PID 1. I am the parent!',
'.PID 1. Exiting gracefully',
'.PID 1. Freed task with PID 1',
'Destroyed the only task - nothing more to do!')
@test(10)
def test_mcorefork():
r.user_test('mcorefork')
r.match('.PID ...... Running on CPU 0')
r.match('.PID ...... Running on CPU 1')
@test(10)
def test_mempress():
r.user_test('mempress')
r.match('mempress successful.')
run_tests()