First upload
[CS310.git] / grade_lab_fs.py
blob1d04d65a86c72ef4bb240226b33bf5fee4286fb9
1 #!/usr/bin/env python3
3 import re
4 import sys
5 from gradelib import *
7 r = Runner(save("xv6.out"))
9 @test(0, "running special file test")
10 def test_special():
11 r.run_qemu(shell_script([
12 'specialtest'
13 ]))
15 @test(15, "test /dev/null", parent=test_special)
16 def test_devnull():
17 r.match('^SUCCESS: test /dev/null$', no=["exec .* failed"])
19 @test(15, "test /dev/zero", parent=test_special)
20 def test_devnull():
21 r.match('^SUCCESS: test /dev/zero$', no=["exec .* failed"])
23 @test(15, "test /dev/uptime", parent=test_special)
24 def test_devnull():
25 r.match('^SUCCESS: test /dev/uptime$', no=["exec .* failed"])
27 @test(15, "test /dev/random", parent=test_special)
28 def test_devnull():
29 r.match('^SUCCESS: test /dev/random$', no=["exec .* failed"])
31 @test(20, "test symlinks")
32 def test_devnull():
33 r.run_qemu(shell_script([
34 'symlinktest'
35 ]))
36 r.match('^SUCCESS: test symlinks$', no=["exec .* failed"])
38 @test(20, "usertests")
39 def test_usertests():
40 r.run_qemu(shell_script([
41 'usertests'
42 ]), timeout=300)
43 r.match('^ALL TESTS PASSED$')
45 if __name__ == '__main__':
46 if len(sys.argv) > 1:
47 run_tests(outputJSON=sys.argv[1])
48 else:
49 run_tests()