summaryrefslogtreecommitdiff
path: root/grade-lab-cow
diff options
context:
space:
mode:
authorMole Shang <[email protected]>2024-02-17 11:55:33 +0800
committerMole Shang <[email protected]>2024-02-17 12:22:07 +0800
commite8e0a7b4c97064eb5e9415726d7e38aaceccd3fd (patch)
treefb42ba5be7a8ae608b968266f62fd71fa889a89d /grade-lab-cow
parenta6af72924b115c1177d18d9b1eaba56623e4248b (diff)
parentd85aec2689c4250d0384904bdc11aa618c726bec (diff)
downloadxv6-labs-e8e0a7b4c97064eb5e9415726d7e38aaceccd3fd.tar.gz
xv6-labs-e8e0a7b4c97064eb5e9415726d7e38aaceccd3fd.tar.bz2
xv6-labs-e8e0a7b4c97064eb5e9415726d7e38aaceccd3fd.zip
Merge branch 'thread' into fs
Conflicts: .gitignore Makefile conf/lab.mk kernel/param.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()