diff options
author | Sanjit Bhat <[email protected]> | 2023-09-13 01:54:57 -0400 |
---|---|---|
committer | Sanjit Bhat <[email protected]> | 2023-09-13 01:54:57 -0400 |
commit | e3512e581807f0b7d0eeda44fcf002062ddd558a (patch) | |
tree | d07725b65bd31983b0bc9b75da8e420dd402e2cb /grade-lab-cow | |
parent | 74c1eba516fdb0ec1a17b16be7e76613ccba92bf (diff) | |
download | xv6-labs-e3512e581807f0b7d0eeda44fcf002062ddd558a.tar.gz xv6-labs-e3512e581807f0b7d0eeda44fcf002062ddd558a.tar.bz2 xv6-labs-e3512e581807f0b7d0eeda44fcf002062ddd558a.zip |
release lab cow
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() |