forked from RedemptionC/xv6-riscv-6s081
-
Notifications
You must be signed in to change notification settings - Fork 0
/
grade-lab-sh
executable file
·57 lines (44 loc) · 1.52 KB
/
grade-lab-sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/env python
import re
from gradelib import *
r = Runner(save("xv6.out"))
@test(0, "running nsh tests")
def test_nsh_top():
try:
with open('user/nsh.c') as f:
contents = f.read()
if 'malloc' in contents or 'sbrk' in contents:
raise AssertionError('Use of malloc() / sbrk() is forbidden')
except IOError:
raise AssertionError('Cannot read user/nsh.c')
r.run_qemu(shell_script([
'testsh nsh'
]))
@test(11, "simple echo", parent=test_nsh_top)
def test_simple_echo():
r.match('^simple echo:.*PASS$')
@test(11, "simple grep", parent=test_nsh_top)
def test_simple_grep():
r.match('^simple grep:.*PASS$')
@test(11, "two commands", parent=test_nsh_top)
def test_two_commands():
r.match('^two commands:.*PASS$')
@test(11, "output redirection", parent=test_nsh_top)
def test_output_redirection():
r.match('^output redirection:.*PASS$')
@test(11, "input redirection", parent=test_nsh_top)
def test_input_redirection():
r.match('^input redirection:.*PASS$')
@test(11, "both redirections", parent=test_nsh_top)
def test_both_redirections():
r.match('^both redirections:.*PASS$')
@test(11, "simple pipe", parent=test_nsh_top)
def test_simple_pipe():
r.match('^simple pipe:.*PASS$')
@test(11, "pipe and redirects", parent=test_nsh_top)
def test_pipe_and_redirects():
r.match('^pipe and redirects:.*PASS$')
@test(12, "lots of commands", parent=test_nsh_top)
def test_lots_of_commands():
r.match('^lots of commands:.*PASS$')
run_tests()