diff options
| author | Mole Shang <135e2@135e2.dev> | 2024-02-16 10:20:27 +0800 | 
|---|---|---|
| committer | Mole Shang <135e2@135e2.dev> | 2024-02-16 10:20:27 +0800 | 
| commit | a98c56a811142e5ede3332a7a444cca45f628769 (patch) | |
| tree | c93ff7090da7b6ef911932be283818c2f6a03784 /grade-lab-cow | |
| parent | 0d65be5d1d880afafbf08c2adb605cf9f72216e2 (diff) | |
| parent | 99015f3a985b2fd051606636743a2a2969b216e8 (diff) | |
| download | xv6-labs-a98c56a811142e5ede3332a7a444cca45f628769.tar.gz xv6-labs-a98c56a811142e5ede3332a7a444cca45f628769.tar.bz2 xv6-labs-a98c56a811142e5ede3332a7a444cca45f628769.zip | |
Merge branch 'lock' into thread
Conflicts:
	.gitignore
	Makefile
	conf/lab.mk
Diffstat (limited to 'grade-lab-cow')
| -rwxr-xr-x | grade-lab-cow | 55 | 
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() | 
