-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathgradeproject.py
62 lines (48 loc) · 1.5 KB
/
gradeproject.py
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
from gradelib import *
def addlines():
inputfile = open('GNUmakefile', 'r').readlines()
write_file = open('GNUmakefile','w')
found = 0
for line in inputfile:
write_file.write(line)
if 'USER_CFLAGS' in line:
if (found == 0):
write_file.write("\nifndef GUEST_KERN\nKERN_CFLAGS += -DTEST_EPT_MAP\nUSER_CFLAGS += -DTEST_EPT_MAP\nendif\n")
found = 1
write_file.close()
def dellines():
inputfile = open('GNUmakefile', 'r').readlines()
write_file = open('GNUmakefile','w')
found = 0
count = 5
for line in inputfile:
if(found == 0):
write_file.write(line)
if 'USER_CFLAGS' in line:
found = 1
if(found == 1):
if(count > 0):
count = count - 1
else:
found = 0
write_file.close()
r = Runner(save("jos.out"),
stop_breakpoint("readline"))
@test(30, "sys_ept_tests")
def sys_ept_map_test():
addlines()
r.run_qemu()
r.match("Cheers! sys_ept_map seems to work correctly")
dellines()
def matchtest(parent, name, points, *args, **kw):
def do_test():
r.match(*args, **kw)
test(points, name, parent=parent)(do_test)
@test(0, "VMM Tests")
def test_vm():
r.user_test("vmm")
matchtest(test_vm,"start vmxon:", 10, "VMXON")
matchtest(test_vm, "VMX extension test:", 20, "VMX extension hidden from guest")
matchtest(test_vm, "Print message in VM:", 30, "What is the tortoise")
matchtest(test_vm, "VM correctly started:", 10, "vm\$")
run_tests()