235 lines
9.8 KiB
Text
235 lines
9.8 KiB
Text
[31m[38;5;34m.[0m[31m[38;5;160mx[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;160mx[0m[31m[38;5;160mx[0m[31m[38;5;160mx[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;160mx[0m[31m[38;5;160mx[0m[31m[38;5;160mx[0m[31m[38;5;160mx[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;160mx[0m[31m[38;5;34m.[0m
|
||
|
||
----------------------------------------------------------------
|
||
|
||
[37;1m21sh/misc/002-simple-command-line[0m [31m[38;5;160m(FAILED)[0m
|
||
|
||
Description:
|
||
[38;5;239m The purpose of this test is to check that the Shell is able to execute a simple command line that contains separators `;`, pipes `|`, and a right redirection `>`.[0m
|
||
|
||
Before test:
|
||
[38;5;239m 01: rm -rf "./size"
|
||
02: rm -rf "TOKEN201703241734"
|
||
03: echo '^'$(echo TOKEN201703241734_FILE_TOKEN201703241734_STDOUT | wc -c)'$' > "./size"[0m
|
||
|
||
STDIN:
|
||
[38;5;239m 01: mkdir TOKEN201703241734 ; cd TOKEN201703241734 ; touch TOKEN201703241734_FILE ; ls -1 ; ls | cat | wc -c > TOKEN201703241734_STDOUT ; cat TOKEN201703241734_STDOUT[0m
|
||
|
||
STDOUT:
|
||
[31m[38;5;34m SUCCESS expected_to match_regex `TOKEN201703241734_FILE$`[0m
|
||
[31m[38;5;160m FAILURE expected_to match_each_regex_of_file `./size`[0m
|
||
[38;5;239m 01: TOKEN201703241734_FILE
|
||
02: 98839 redirect_great.c 24 3 1
|
||
03: 23[0m
|
||
|
||
STDERR:
|
||
[31m[38;5;34m SUCCESS expected_to be_empty[0m
|
||
[38;5;239m (no output)[0m
|
||
|
||
----------------------------------------------------------------
|
||
|
||
[37;1m21sh/redirections/outputs/truncating/001-creates-file-if-not-exits[0m [31m[38;5;160m(FAILED)[0m
|
||
|
||
Description:
|
||
[38;5;239m The right redirection `>` opens the file with the oflag `O_CREAT` so that the file is created if it does not exists.[0m
|
||
|
||
Before test:
|
||
[38;5;239m 01: rm -f new_file[0m
|
||
|
||
STDIN:
|
||
[38;5;239m 01: ./write_on_stdout TOKEN201703241734 >new_file[0m
|
||
|
||
STDOUT:
|
||
[31m[38;5;34m SUCCESS expected_to_not match_regex `TOKEN201703241734`[0m
|
||
[38;5;239m (no output)[0m
|
||
|
||
STDERR:
|
||
[31m[38;5;34m SUCCESS expected_to be_empty[0m
|
||
[38;5;239m (no output)[0m
|
||
|
||
MISC:
|
||
[31m[38;5;34m SUCCESS expected_to create_file `new_file` matching_regex `TOKEN201703241734`[0m
|
||
[31m[38;5;160m FAILURE expected_to create_file `new_file` with_nb_of_lines `1`[0m
|
||
|
||
----------------------------------------------------------------
|
||
|
||
[37;1m21sh/redirections/outputs/truncating/002-truncates-file-if-exists[0m [31m[38;5;160m(FAILED)[0m
|
||
|
||
Description:
|
||
[38;5;239m The right redirection `>` opens the file with the oflag `O_TRUNC` so that the file size is truncated to 0 before writing in it.[0m
|
||
|
||
Before test:
|
||
[38;5;239m 01: ./write_on_stdout TOKEN201703241734_first >truncated_file[0m
|
||
|
||
STDIN:
|
||
[38;5;239m 01: ./write_on_stdout TOKEN201703241734_second >truncated_file[0m
|
||
|
||
STDOUT:
|
||
[31m[38;5;34m SUCCESS expected_to_not match_regex TOKEN201703241734_second[0m
|
||
[38;5;239m (no output)[0m
|
||
|
||
STDERR:
|
||
[31m[38;5;34m SUCCESS expected_to be_empty[0m
|
||
[38;5;239m (no output)[0m
|
||
|
||
MISC:
|
||
[31m[38;5;34m SUCCESS expected_to create_file `truncated_file` matching_regex `TOKEN201703241734_second`[0m
|
||
[31m[38;5;34m SUCCESS expected_to create_file `truncated_file` not_matching_regex `TOKEN201703241734_first`[0m
|
||
[31m[38;5;160m FAILURE expected_to create_file `truncated_file` with_nb_of_lines `1`[0m
|
||
|
||
----------------------------------------------------------------
|
||
|
||
[37;1m21sh/redirections/outputs/truncating/003-whitespace-before-filename[0m [31m[38;5;160m(FAILED)[0m
|
||
|
||
Description:
|
||
[38;5;239m The file name for a right redirection can be specified closely to the character `>` or in a separated field.[0m
|
||
|
||
Before test:
|
||
[38;5;239m 01: rm -f "new_file"[0m
|
||
|
||
STDIN:
|
||
[38;5;239m 01: ./write_on_stdout TOKEN201703241734 > new_file[0m
|
||
|
||
STDOUT:
|
||
[31m[38;5;34m SUCCESS expected_to_not match_regex `TOKEN201703241734`[0m
|
||
[38;5;239m (no output)[0m
|
||
|
||
STDERR:
|
||
[31m[38;5;34m SUCCESS expected_to be_empty[0m
|
||
[38;5;239m (no output)[0m
|
||
|
||
MISC:
|
||
[31m[38;5;34m SUCCESS expected_to create_file `new_file` matching_regex `TOKEN201703241734`[0m
|
||
[31m[38;5;160m FAILURE expected_to create_file `new_file` with_nb_of_lines `1`[0m
|
||
|
||
----------------------------------------------------------------
|
||
|
||
[37;1m21sh/redirections/outputs/truncating/multiple/004-together[0m [31m[38;5;160m(FAILED)[0m
|
||
|
||
Description:
|
||
[38;5;239m A right redirection can be associated to the twice outputs by using `&>...`, that means `redirect stdout and stderr to ...`.[0m
|
||
|
||
Before test:
|
||
[38;5;239m 01: rm -f "new_file_stderr_and_stdout"[0m
|
||
|
||
STDIN:
|
||
[38;5;239m 01: ./write_on_stdout_and_stderr TOKEN201703241734_1 TOKEN201703241734_2 &>new_file_stderr_and_stdout[0m
|
||
|
||
STDOUT:
|
||
[31m[38;5;160m FAILURE expected_to_not match_regex `TOKEN201703241734_1`[0m
|
||
[31m[38;5;34m SUCCESS expected_to_not match_regex `TOKEN201703241734_2`[0m
|
||
[38;5;239m 01: TOKEN201703241734_1[0m
|
||
|
||
STDERR:
|
||
[31m[38;5;34m SUCCESS expected_to_not match_regex `TOKEN201703241734_1`[0m
|
||
[31m[38;5;160m FAILURE expected_to_not match_regex `TOKEN201703241734_2`[0m
|
||
[38;5;239m 01: TOKEN201703241734_2[0m
|
||
|
||
MISC:
|
||
[31m[38;5;160m FAILURE expected_to create_file `new_file_stderr_and_stdout` matching_regex `TOKEN201703241734_1$`[0m
|
||
[31m[38;5;160m FAILURE expected_to create_file `new_file_stderr_and_stdout` matching_regex `TOKEN201703241734_2$`[0m
|
||
|
||
----------------------------------------------------------------
|
||
|
||
[37;1m21sh/redirections/outputs/truncating/multiple/005-together-with-whitespaces[0m [31m[38;5;160m(FAILED)[0m
|
||
|
||
Description:
|
||
[38;5;239m A right redirection can be associated to the twice outputs by using `&>...`, that means `redirect stdout and stderr to ...`.
|
||
In this test, we specify the file name in a separate field.[0m
|
||
|
||
Before test:
|
||
[38;5;239m 01: rm -f new_file_stderr_and_stdout[0m
|
||
|
||
STDIN:
|
||
[38;5;239m 01: ./write_on_stdout_and_stderr TOKEN201703241734_1 TOKEN201703241734_2 &> new_file_stderr_and_stdout[0m
|
||
|
||
STDOUT:
|
||
[31m[38;5;160m FAILURE expected_to_not match_regex `TOKEN201703241734_1`[0m
|
||
[31m[38;5;34m SUCCESS expected_to_not match_regex `TOKEN201703241734_2`[0m
|
||
[38;5;239m 01: TOKEN201703241734_1[0m
|
||
|
||
STDERR:
|
||
[31m[38;5;34m SUCCESS expected_to_not match_regex `TOKEN201703241734_1`[0m
|
||
[31m[38;5;160m FAILURE expected_to_not match_regex `TOKEN201703241734_2`[0m
|
||
[38;5;239m 01: TOKEN201703241734_2[0m
|
||
|
||
MISC:
|
||
[31m[38;5;160m FAILURE expected_to create_file `new_file_stderr_and_stdout` matching_regex `TOKEN201703241734_1$`[0m
|
||
[31m[38;5;160m FAILURE expected_to create_file `new_file_stderr_and_stdout` matching_regex `TOKEN201703241734_2$`[0m
|
||
|
||
----------------------------------------------------------------
|
||
|
||
[37;1m21sh/redirections/outputs/truncating/stderr/001-works[0m [31m[38;5;160m(FAILED)[0m
|
||
|
||
Description:
|
||
[38;5;239m The purpose of this test is to check that redirecting the standard error STDERR to a file `2>` works. In this test, the binary writes a token on each standard and error output, so that only the STDOUT is outputted and STDERR is written in a file `new_file_stderr`.[0m
|
||
|
||
Before test:
|
||
[38;5;239m 01: rm -f "./new_file_stderr"[0m
|
||
|
||
STDIN:
|
||
[38;5;239m 01: ./write_on_stdout_and_stderr TOKEN201703241734_STDOUT TOKEN201703241734_STDERR 2>new_file_stderr[0m
|
||
|
||
STDOUT:
|
||
[31m[38;5;34m SUCCESS expected_to match_regex `TOKEN201703241734_STDOUT`[0m
|
||
[38;5;239m 01: TOKEN201703241734_STDOUT[0m
|
||
|
||
STDERR:
|
||
[31m[38;5;34m SUCCESS expected_to_not match_regex `TOKEN201703241734_STDERR`[0m
|
||
[38;5;239m (no output)[0m
|
||
|
||
MISC:
|
||
[31m[38;5;34m SUCCESS expected_to create_file `new_file_stderr` matching_regex `TOKEN201703241734_STDERR`[0m
|
||
[31m[38;5;160m FAILURE expected_to create_file `new_file_stderr` with_nb_of_lines 1[0m
|
||
|
||
----------------------------------------------------------------
|
||
|
||
[37;1m21sh/redirections/outputs/truncating/stdout/001-with-explicit-fd[0m [31m[38;5;160m(FAILED)[0m
|
||
|
||
Description:
|
||
[38;5;239m The purpose of this test is to check if '1>' redirect STDIN to a file.
|
||
We are using echo with one argument. The output should NOT return anything on the standard output.[0m
|
||
|
||
Before test:
|
||
[38;5;239m 01: rm -f new_file[0m
|
||
|
||
STDIN:
|
||
[38;5;239m 01: /bin/echo TOKEN1 1>new_file[0m
|
||
|
||
STDOUT:
|
||
[31m[38;5;34m SUCCESS expected_to_not match_regex TOKEN1[0m
|
||
[38;5;239m (no output)[0m
|
||
|
||
STDERR:
|
||
[38;5;239m (no output)[0m
|
||
|
||
MISC:
|
||
[31m[38;5;34m SUCCESS expected_to create_file new_file matching_regex TOKEN1[0m
|
||
[31m[38;5;160m FAILURE expected_to create_file new_file with_nb_of_lines 1[0m
|
||
|
||
----------------------------------------------------------------
|
||
|
||
[37;1m21sh/separators/semicolon/003-parse-error-empty-inline-command[0m [31m[38;5;160m(FAILED)[0m
|
||
|
||
Description:
|
||
[38;5;239m The purpose of this test is to check that using the simicolon separator `;` with empty commands results in error.[0m
|
||
|
||
STDIN:
|
||
[38;5;239m 01: ./write_on_stdout TOKEN201703241734 ; ; ./exit_with_status 42[0m
|
||
|
||
STDOUT:
|
||
[31m[38;5;34m SUCCESS expected_to be_empty[0m
|
||
[38;5;239m (no output)[0m
|
||
|
||
STDERR:
|
||
[31m[38;5;34m SUCCESS expected_to_not be_empty[0m
|
||
[31m[38;5;34m SUCCESS might match_regex `([Ss]yntax|[Pp]arse) error`[0m
|
||
[38;5;239m 01: syntax error near unexpected token `;'[0m
|
||
|
||
MISC:
|
||
[31m[38;5;34m SUCCESS expected_to_not exit_with_status `42`[0m
|
||
[31m[38;5;160m FAILURE expected_to_not exit_with_status `0`[0m
|
||
|
||
Total tests: 36
|
||
Total failed tests: 9
|
||
Total pending tests: 0
|