summaryrefslogtreecommitdiff
path: root/grade-lab-cow
diff options
context:
space:
mode:
authorMole Shang <[email protected]>2024-02-14 20:46:23 +0800
committerMole Shang <[email protected]>2024-02-14 20:46:23 +0800
commitf98eeb30507040dc916b2a337818830954ee1d4a (patch)
treea741cb0bbd6be96d8084e72b4af895ac093a2b48 /grade-lab-cow
parent0de5ac779602f562a038e5ad27163d85bc71638b (diff)
parent904885a96efd1dd0221585f67477f5a39bcce7f7 (diff)
downloadxv6-labs-f98eeb30507040dc916b2a337818830954ee1d4a.tar.gz
xv6-labs-f98eeb30507040dc916b2a337818830954ee1d4a.tar.bz2
xv6-labs-f98eeb30507040dc916b2a337818830954ee1d4a.zip
Merge branch 'net' into lock
Conflicts: .gitignore Makefile conf/lab.mk kernel/defs.h user/user.h
Diffstat (limited to 'grade-lab-cow')
-rwxr-xr-xgrade-lab-cow55
1 files changed, 55 insertions, 0 deletions
diff --git a/grade-lab-cow b/grade-lab-cow
new file mode 100755
index 0000000..08b6990
--- /dev/null
+++ b/grade-lab-cow
@@ -0,0 +1,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()