Skip to content

Commit 4ec7614

Browse files
committed
Update tests and reference
1 parent b026582 commit 4ec7614

File tree

22 files changed

+280
-213
lines changed

22 files changed

+280
-213
lines changed

grader.py

Lines changed: 166 additions & 69 deletions
Large diffs are not rendered by default.

grader_config.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,8 @@ common_dir = "tests/common"
3131
[grader]
3232
# 评分器的全局配置
3333
default_timeout = 5.0 # 默认超时时间(秒)
34+
35+
[executables]
36+
# 预定义的可执行文件
37+
tsh = "${root_dir}/tsh"
38+
tshref = "${root_dir}/tshref"

tests/cases/1-eof/config.toml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
[meta]
2-
name = "Terminate on EOF Test"
2+
name = "Terminate on EOF"
33
description = "Properly terminate on EOF."
44
score = 10
55

66
[[run]]
7-
name = "Run tiny shell"
8-
command = "${root_dir}/tsh"
7+
name = "Run Shell"
8+
command = "${tsh}"
99
pwd = "${root_dir}"
1010
args = ["-p"]
1111
mode = "interactive"
12+
timeout = 30.0
1213

1314
[run.reference]
14-
command = "${root_dir}/tshref"
15+
command = "${tshref}"
1516
args = ["-p"]
1617

1718
[[run.steps]]

tests/cases/10-fg/config.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
[meta]
22
name = "Process fg builtin command"
33
description = "Tests the shell's fg command and handling of job control signals."
4-
score = 10.0
4+
score = 10
55

66
[[run]]
77
name = "Run Shell"
8-
command = "${root_dir}/tsh"
8+
command = "${tsh}"
99
pwd = "${root_dir}"
1010
args = ["-p"]
1111
mode = "interactive"
1212
timeout = 30.0
1313

1414
[run.reference]
15-
command = "${root_dir}/tshref"
15+
command = "${tshref}"
1616
args = ["-p"]
1717

1818
# Start a background job

tests/cases/11-sigint-proc-group/config.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
[meta]
22
name = "Forward SIGINT to foreground process group"
33
description = "Tests whether the shell correctly forwards SIGINT to every process in the foreground process group"
4-
score = 5
4+
score = 10
55

66
[[run]]
7-
name = "Test SIGINT forwarding"
8-
command = "${root_dir}/tsh"
7+
name = "Run Shell"
8+
command = "${tsh}"
99
pwd = "${root_dir}"
1010
args = ["-p"]
1111
mode = "interactive"
12-
timeout = 10.0
12+
timeout = 30.0
1313

1414
[run.reference]
15-
command = "${root_dir}/tshref"
15+
command = "${tshref}"
1616
args = ["-p"]
1717

1818
[[run.steps]]

tests/cases/12-sigtstp-proc-group/config.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ description = "Tests whether the shell correctly forwards SIGTSTP to every proce
44
score = 10
55

66
[[run]]
7-
name = "Test SIGTSTP forwarding"
8-
command = "${root_dir}/tsh"
9-
args = ["-p"]
7+
name = "Run Shell"
8+
command = "${tsh}"
109
pwd = "${root_dir}"
10+
args = ["-p"]
1111
mode = "interactive"
12-
timeout = 10.0
12+
timeout = 30.0
1313

1414
[run.reference]
15-
command = "${root_dir}/tshref"
15+
command = "${tshref}"
1616
args = ["-p"]
1717

1818
[[run.steps]]

tests/cases/13-restart/config.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ description = "Tests whether the shell correctly stops processes with TSTP and r
44
score = 10
55

66
[[run]]
7-
name = "Test stop and restart processes"
8-
command = "${root_dir}/tsh"
7+
name = "Run Shell"
8+
command = "${tsh}"
99
pwd = "${root_dir}"
1010
args = ["-p"]
1111
mode = "interactive"
12-
timeout = 15.0
12+
timeout = 30.0
1313

1414
[run.reference]
15-
command = "${root_dir}/tshref"
15+
command = "${tshref}"
1616
args = ["-p"]
1717

1818
[[run.steps]]

tests/cases/14-errors/config.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@ description = "Tests shell's handling of various error conditions and edge cases
44
score = 10
55

66
[[run]]
7-
name = "Test error handling"
8-
command = "${root_dir}/tsh"
7+
name = "Run Shell"
8+
command = "${tsh}"
99
pwd = "${root_dir}"
1010
args = ["-p"]
1111
mode = "interactive"
12-
timeout = 20.0
12+
timeout = 30.0
1313
stderr_to_stdout = true
1414

1515
[run.reference]
16-
command = "${root_dir}/tshref"
16+
command = "${tshref}"
1717
args = ["-p"]
1818

1919
# Test command not found

tests/cases/15-all/config.toml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@ description = "Comprehensive test of shell functionality including error handlin
44
score = 10
55

66
[[run]]
7-
name = "Comprehensive Shell Test"
8-
command = "${root_dir}/tsh"
7+
name = "Run Shell"
8+
command = "${tsh}"
99
pwd = "${root_dir}"
1010
args = ["-p"]
1111
mode = "interactive"
1212
timeout = 30.0
1313
stderr_to_stdout = true
1414

1515
[run.reference]
16-
command = "${root_dir}/tshref"
16+
command = "${tshref}"
1717
args = ["-p"]
1818

1919
# Test command not found
@@ -200,11 +200,6 @@ content = "fg %1"
200200
echo = true
201201
wait_for_output = true
202202

203-
# Wait for myspin to complete
204-
[[run.steps]]
205-
type = "sleep"
206-
seconds = 3
207-
208203
# Test quit command
209204
[[run.steps]]
210205
type = "input"

tests/cases/16-other-proc-sig/config.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
[meta]
22
name = "Handle signals from other processes"
33
description = "Tests whether the shell can handle SIGTSTP and SIGINT signals that come from other processes instead of the terminal"
4-
score = 5
4+
score = 10
55

66
[[run]]
7-
name = "Test signal handling from other processes"
8-
command = "${root_dir}/tsh"
7+
name = "Run Shell"
8+
command = "${tsh}"
99
pwd = "${root_dir}"
1010
args = ["-p"]
1111
mode = "interactive"
12-
timeout = 15.0
12+
timeout = 30.0
1313
stderr_to_stdout = true
1414

1515
[run.reference]
16-
command = "${root_dir}/tshref"
16+
command = "${tshref}"
1717
args = ["-p"]
1818

1919
# Test SIGTSTP handling

0 commit comments

Comments
 (0)