Skip to content

Commit f8b39c6

Browse files
committed
[test] Add test for multiprocessing and ls -l
1 parent 8f0bb1a commit f8b39c6

File tree

4 files changed

+21
-6
lines changed

4 files changed

+21
-6
lines changed

src/usr/local/src/multiprocessing.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ int main(int argc,char *argv[]) {
2020
printf("will for child process to exit\n");
2121
waitpid(pid, NULL);
2222
}
23-
printf("process exiting. Is correct process the child: %s\n", (am_i_child)?"Yes":"No");
23+
printf("process exiting. Is current process the child: %s\n", (am_i_child)?"Yes":"No");
2424

2525
return 0;
2626
}

tests/app/ls_test.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44

55
QEMU_SCREENSHOT_NAME="ls_test.ppm"
66

7-
python3 -m tests.qemu.monitor -p ${MONITOR_PORT:?} -sc ls
7+
python3 -m tests.qemu.monitor -p ${MONITOR_PORT:?} -sc "ls -l"
88

99
test_create_screen_dump
10-
test_screen_content $LINENO "cat"
11-
test_screen_content $LINENO "calc"
12-
test_screen_content $LINENO "ls"
13-
test_screen_content $LINENO "tictactoe"
10+
test_screen_content $LINENO "r-x.*cat"
11+
test_screen_content $LINENO "r-x.*ls"
12+
test_screen_content $LINENO "r-x.*calc"
13+
test_screen_content $LINENO "r-x.*tictactoe"
14+
test_screen_content $LINENO "r--.*README.md"

tests/app/multiprocessing_test.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
3+
# Test is supposed to be sourced from shell_test.sh
4+
5+
QEMU_SCREENSHOT_NAME="multiprocessing_test.ppm"
6+
7+
python3 -m tests.qemu.monitor -p ${MONITOR_PORT:?} -sc "multiprocessing"
8+
9+
test_create_screen_dump
10+
test_screen_content $LINENO "child process: says.*"
11+
test_screen_content $LINENO "parent process: says.*"
12+
test_screen_content $LINENO "Is current process the child:.*Yes"
13+
test_screen_content $LINENO "Is current process the child:.*No"

tests/app/shell_test.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ test_screen_content $LINENO "Simple Shell"
88
source tests/app/ls_test.sh
99
source tests/app/tictactoe_test.sh
1010
source tests/app/cat_test.sh
11+
source tests/app/multiprocessing_test.sh

0 commit comments

Comments
 (0)