-
Notifications
You must be signed in to change notification settings - Fork 0
/
grade-lab-cow
executable file
·55 lines (42 loc) · 1.42 KB
/
grade-lab-cow
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
#!/usr/bin/env python3
import re
from gradelib import *
r = Runner(save("xv6.out"))
@test(0, "running cowtest")
def test_cowtest():
r.run_qemu(shell_script([
'cowtest'
]))
@test(30, "simple", parent=test_cowtest)
def test_simple():
matches = re.findall("^simple: ok$", r.qemu.output, re.M)
assert_equal(len(matches), 2, "Number of appearances of 'simple: ok'")
@test(30, "three", parent=test_cowtest)
def test_three():
matches = re.findall("^three: ok$", r.qemu.output, re.M)
assert_equal(len(matches), 3, "Number of appearances of 'three: ok'")
@test(20, "file", parent=test_cowtest)
def test_file():
r.match('^file: ok$')
@test(0, "usertests")
def test_usertests():
r.run_qemu(shell_script([
'usertests -q'
]), timeout=1000)
r.match('^ALL TESTS PASSED$')
def usertest_check(testcase, nextcase, output):
if not re.search(r'\ntest {}: [\s\S]*OK\ntest {}'.format(testcase, nextcase), output):
raise AssertionError('Failed ' + testcase)
@test(5, "usertests: copyin", parent=test_usertests)
def test_sbrkbugs():
usertest_check("copyin", "copyout", r.qemu.output)
@test(5, "usertests: copyout", parent=test_usertests)
def test_sbrkbugs():
usertest_check("copyout", "copyinstr1", r.qemu.output)
@test(19, "usertests: all tests", parent=test_usertests)
def test_usertests_all():
r.match('^ALL TESTS PASSED$')
@test(1, "time")
def test_time():
check_time()
run_tests()