with 42shelltester error
235
42sh/21sh_error
Normal file
|
|
@ -0,0 +1,235 @@
|
|||
[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
|
||||
|
|
@ -8,7 +8,7 @@
|
|||
It brings you an easy way to **add**, **maintain** and **run** integration tests, helping you to work step by step on your Shell implementation.
|
||||
|
||||
<!--START_TOTAL_TESTS-->
|
||||
42ShellTester is currently packaged with **304 tests**.
|
||||
42ShellTester is currently packaged with **289 tests**.
|
||||
<!--END_TOTAL_TESTS-->
|
||||
|
||||
## Install
|
||||
|
|
@ -302,25 +302,6 @@ Also display tests that succeed (hidden by default).
|
|||
* [002-it-works-2](spec/42sh/quoting/simple-quotes/mixed/globbing/bracket-expansion/002-it-works-2)
|
||||
* **[variable-expansion/](spec/42sh/quoting/simple-quotes/mixed/variable-expansion)**
|
||||
* [001-expansion-disabled](spec/42sh/quoting/simple-quotes/mixed/variable-expansion/001-expansion-disabled)
|
||||
* **[shellscript/](spec/42sh/shellscript)**
|
||||
* **[if/](spec/42sh/shellscript/if)**
|
||||
* [001-simple-if-1](spec/42sh/shellscript/if/001-simple-if-1)
|
||||
* [002-simple-if-2](spec/42sh/shellscript/if/002-simple-if-2)
|
||||
* [003-simple-if-3](spec/42sh/shellscript/if/003-simple-if-3)
|
||||
* [004-nested-if](spec/42sh/shellscript/if/004-nested-if)
|
||||
* [005-hard-nested-if](spec/42sh/shellscript/if/005-hard-nested-if)
|
||||
* **[until/](spec/42sh/shellscript/until)**
|
||||
* [001-simple-until-1](spec/42sh/shellscript/until/001-simple-until-1)
|
||||
* [002-simple-until-2](spec/42sh/shellscript/until/002-simple-until-2)
|
||||
* [003-simple-until-3](spec/42sh/shellscript/until/003-simple-until-3)
|
||||
* [004-nested-until](spec/42sh/shellscript/until/004-nested-until)
|
||||
* [005-hard-nested-until](spec/42sh/shellscript/until/005-hard-nested-until)
|
||||
* **[while/](spec/42sh/shellscript/while)**
|
||||
* [001-simple-while-1](spec/42sh/shellscript/while/001-simple-while-1)
|
||||
* [002-simple-while-2](spec/42sh/shellscript/while/002-simple-while-2)
|
||||
* [003-simple-while-3](spec/42sh/shellscript/while/003-simple-while-3)
|
||||
* [004-nested-while](spec/42sh/shellscript/while/004-nested-while)
|
||||
* [005-hard-nested-while](spec/42sh/shellscript/while/005-hard-nested-while)
|
||||
* **[subshell/](spec/42sh/subshell)**
|
||||
* [001-tokens-are-recognized](spec/42sh/subshell/001-tokens-are-recognized)
|
||||
* [002-multiple-levels-of-subshells](spec/42sh/subshell/002-multiple-levels-of-subshells)
|
||||
|
|
@ -562,8 +543,6 @@ Find the available list of support binaries bellow:
|
|||
|
||||
<!--START_SUPPORT_BINARIES_LIST-->
|
||||
|
||||
* **[./create_file](http://github.com/we-sh/42ShellTester/tree/master/support/create-file)**: A binary that creates file named argv[1] + "_FILE" If argv[1] is not set, the file is named "TOKEN_FILE"
|
||||
* **[./delete_file](http://github.com/we-sh/42ShellTester/tree/master/support/delete-file)**: A binary that delete all files called in argument.
|
||||
* **[./display_env](http://github.com/we-sh/42ShellTester/tree/master/support/display-env)**: A binary that iterates on `**envp` and write each element on standard output.
|
||||
* **[./display_program_name](http://github.com/we-sh/42ShellTester/tree/master/support/display-program-name)**: A binary that writes its name on standard ouput.
|
||||
* **[./display_pwd](http://github.com/we-sh/42ShellTester/tree/master/support/display-pwd)**: A binary that writes on standard output the absolute path of the current directory returned by `getcwd(3)`, encountered with the strings `PWD:` and `:PWD`.
|
||||
|
|
@ -593,4 +572,3 @@ Find the available list of support binaries bellow:
|
|||
Edouard Audeguy
|
||||
Illustrateur / Infographiste
|
||||
https://edouardaudeguy.wix.com/portfolio
|
||||
# 42shelltest-tmp
|
||||
|
Before Width: | Height: | Size: 88 KiB After Width: | Height: | Size: 88 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 5 KiB After Width: | Height: | Size: 5 KiB |
|
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 5.2 KiB |
|
Before Width: | Height: | Size: 570 B After Width: | Height: | Size: 570 B |
|
Before Width: | Height: | Size: 725 B After Width: | Height: | Size: 725 B |
|
Before Width: | Height: | Size: 654 B After Width: | Height: | Size: 654 B |
235
42sh/42ShellTester/log
Normal file
|
|
@ -0,0 +1,235 @@
|
|||
[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 "TOKEN201703241733"
|
||||
03: echo '^'$(echo TOKEN201703241733_FILE_TOKEN201703241733_STDOUT | wc -c)'$' > "./size"[0m
|
||||
|
||||
STDIN:
|
||||
[38;5;239m 01: mkdir TOKEN201703241733 ; cd TOKEN201703241733 ; touch TOKEN201703241733_FILE ; ls -1 ; ls | cat | wc -c > TOKEN201703241733_STDOUT ; cat TOKEN201703241733_STDOUT[0m
|
||||
|
||||
STDOUT:
|
||||
[31m[38;5;34m SUCCESS expected_to match_regex `TOKEN201703241733_FILE$`[0m
|
||||
[31m[38;5;160m FAILURE expected_to match_each_regex_of_file `./size`[0m
|
||||
[38;5;239m 01: TOKEN201703241733_FILE
|
||||
02: 94296 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 TOKEN201703241733 >new_file[0m
|
||||
|
||||
STDOUT:
|
||||
[31m[38;5;34m SUCCESS expected_to_not match_regex `TOKEN201703241733`[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 `TOKEN201703241733`[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 TOKEN201703241733_first >truncated_file[0m
|
||||
|
||||
STDIN:
|
||||
[38;5;239m 01: ./write_on_stdout TOKEN201703241733_second >truncated_file[0m
|
||||
|
||||
STDOUT:
|
||||
[31m[38;5;34m SUCCESS expected_to_not match_regex TOKEN201703241733_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 `TOKEN201703241733_second`[0m
|
||||
[31m[38;5;34m SUCCESS expected_to create_file `truncated_file` not_matching_regex `TOKEN201703241733_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 TOKEN201703241733 > new_file[0m
|
||||
|
||||
STDOUT:
|
||||
[31m[38;5;34m SUCCESS expected_to_not match_regex `TOKEN201703241733`[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 `TOKEN201703241733`[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 TOKEN201703241733_1 TOKEN201703241733_2 &>new_file_stderr_and_stdout[0m
|
||||
|
||||
STDOUT:
|
||||
[31m[38;5;160m FAILURE expected_to_not match_regex `TOKEN201703241733_1`[0m
|
||||
[31m[38;5;34m SUCCESS expected_to_not match_regex `TOKEN201703241733_2`[0m
|
||||
[38;5;239m 01: TOKEN201703241733_1[0m
|
||||
|
||||
STDERR:
|
||||
[31m[38;5;34m SUCCESS expected_to_not match_regex `TOKEN201703241733_1`[0m
|
||||
[31m[38;5;160m FAILURE expected_to_not match_regex `TOKEN201703241733_2`[0m
|
||||
[38;5;239m 01: TOKEN201703241733_2[0m
|
||||
|
||||
MISC:
|
||||
[31m[38;5;160m FAILURE expected_to create_file `new_file_stderr_and_stdout` matching_regex `TOKEN201703241733_1$`[0m
|
||||
[31m[38;5;160m FAILURE expected_to create_file `new_file_stderr_and_stdout` matching_regex `TOKEN201703241733_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 TOKEN201703241733_1 TOKEN201703241733_2 &> new_file_stderr_and_stdout[0m
|
||||
|
||||
STDOUT:
|
||||
[31m[38;5;160m FAILURE expected_to_not match_regex `TOKEN201703241733_1`[0m
|
||||
[31m[38;5;34m SUCCESS expected_to_not match_regex `TOKEN201703241733_2`[0m
|
||||
[38;5;239m 01: TOKEN201703241733_1[0m
|
||||
|
||||
STDERR:
|
||||
[31m[38;5;34m SUCCESS expected_to_not match_regex `TOKEN201703241733_1`[0m
|
||||
[31m[38;5;160m FAILURE expected_to_not match_regex `TOKEN201703241733_2`[0m
|
||||
[38;5;239m 01: TOKEN201703241733_2[0m
|
||||
|
||||
MISC:
|
||||
[31m[38;5;160m FAILURE expected_to create_file `new_file_stderr_and_stdout` matching_regex `TOKEN201703241733_1$`[0m
|
||||
[31m[38;5;160m FAILURE expected_to create_file `new_file_stderr_and_stdout` matching_regex `TOKEN201703241733_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 TOKEN201703241733_STDOUT TOKEN201703241733_STDERR 2>new_file_stderr[0m
|
||||
|
||||
STDOUT:
|
||||
[31m[38;5;34m SUCCESS expected_to match_regex `TOKEN201703241733_STDOUT`[0m
|
||||
[38;5;239m 01: TOKEN201703241733_STDOUT[0m
|
||||
|
||||
STDERR:
|
||||
[31m[38;5;34m SUCCESS expected_to_not match_regex `TOKEN201703241733_STDERR`[0m
|
||||
[38;5;239m (no output)[0m
|
||||
|
||||
MISC:
|
||||
[31m[38;5;34m SUCCESS expected_to create_file `new_file_stderr` matching_regex `TOKEN201703241733_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 TOKEN201703241733 ; ; ./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
|
||||
|
|
@ -12,8 +12,6 @@ all:
|
|||
make TARGET_DIR=$(TARGET_DIR) -C ./write-on-stderr
|
||||
make TARGET_DIR=$(TARGET_DIR) -C ./write-on-stdout
|
||||
make TARGET_DIR=$(TARGET_DIR) -C ./write-on-stdout-and-stderr
|
||||
make TARGET_DIR=$(TARGET_DIR) -C ./create-file
|
||||
make TARGET_DIR=$(TARGET_DIR) -C ./delete-file
|
||||
|
||||
re: fclean all
|
||||
|
||||
|
|
@ -27,5 +25,5 @@ fclean:
|
|||
make TARGET_DIR=$(TARGET_DIR) fclean -C ./sleep-and-write-on-stderr
|
||||
make TARGET_DIR=$(TARGET_DIR) fclean -C ./write-all-arguments-on-stdout
|
||||
make TARGET_DIR=$(TARGET_DIR) fclean -C ./write-on-stderr
|
||||
make TARGET_DIR=$(TARGET_DIR) fclean -C ./create-file
|
||||
make TARGET_DIR=$(TARGET_DIR) fclean -C ./delete-file
|
||||
make TARGET_DIR=$(TARGET_DIR) fclean -C ./write-on-stdout
|
||||
make TARGET_DIR=$(TARGET_DIR) fclean -C ./write-on-stdout-and-stderr
|
||||
2501
42sh/42sh_error
Normal file
|
|
@ -1 +0,0 @@
|
|||
[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;160mx[0m
|
||||
|
|
@ -1,933 +0,0 @@
|
|||
[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;160mx[0m[31m[38;5;160mx[0m[31m[38;5;160mx[0m[31m[38;5;160mx[0m[31m[38;5;160mx[0m[31m[38;5;160mx[0m[31m[38;5;160mx[0m[31m[38;5;160mx[0m[31m[38;5;160mx[0m[31m[38;5;160mx[0m[31m[38;5;160mx[0m[31m[38;5;160mx[0m[31m[38;5;160mx[0m[31m[38;5;160mx[0m[31m[38;5;160mx[0m[31m[1;33m~[0m[31m[38;5;160mx[0m[31m[38;5;160mx[0m[31m[38;5;160mx[0m[31m[38;5;160mx[0m[31m[38;5;160mx[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;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;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;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;160mx[0m
|
||||
|
||||
----------------------------------------------------------------
|
||||
|
||||
[37;1mminishell/binary/004-binary-test-empty-path[0m [31m[38;5;160m(FAILED)[0m
|
||||
|
||||
Description:
|
||||
[38;5;239m The purpose of this test is to check that the Shell finds binaries that are located in the current directory when the environment variable PATH is empty.[0m
|
||||
|
||||
Before test:
|
||||
[38;5;239m 01: export PATH=""[0m
|
||||
|
||||
STDIN:
|
||||
[38;5;239m 01: write_on_stdout "TOKEN201703202355"[0m
|
||||
|
||||
STDOUT:
|
||||
[31m[38;5;160m FAILURE expected_to match_regex `TOKEN201703202355`[0m
|
||||
[38;5;239m (no output)[0m
|
||||
|
||||
STDERR:
|
||||
[31m[38;5;160m FAILURE expected_to be_empty[0m
|
||||
[38;5;239m 01: minishell: command not found: write_on_stdout[0m
|
||||
|
||||
MISC:
|
||||
[31m[38;5;34m SUCCESS expected_to exit_with_status `0`[0m
|
||||
|
||||
----------------------------------------------------------------
|
||||
|
||||
[37;1mminishell/binary/005-binary-test-wrong-path[0m [31m[38;5;160m(FAILED)[0m
|
||||
|
||||
Description:
|
||||
[38;5;239m This test purpose is to check if your shell is not able to use binary with a wrong PATH
|
||||
We are changing the actual PATH by PATH=NULL
|
||||
And executing the commande ls[0m
|
||||
|
||||
Before test:
|
||||
[38;5;239m 01: export PATH="/"[0m
|
||||
|
||||
STDIN:
|
||||
[38;5;239m 01: ls[0m
|
||||
|
||||
STDOUT:
|
||||
[31m[38;5;34m SUCCESS might 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 `[Cc]ommand not found`[0m
|
||||
[38;5;239m 01: minishell: command not found: ls[0m
|
||||
|
||||
MISC:
|
||||
[31m[38;5;160m FAILURE expected_to_not exit_with_status `0`[0m
|
||||
|
||||
----------------------------------------------------------------
|
||||
|
||||
[37;1mminishell/binary/006-binary-undefined-path[0m [31m[38;5;160m(FAILED)[0m
|
||||
|
||||
Description:
|
||||
[38;5;239m The purpose of this test is to check that the Shell retrieves the default value of the environment variable PATH if not set. This test depends on the presence of the UNIX binary `ls`, located in a path within the default environment variable PATH.[0m
|
||||
|
||||
Before test:
|
||||
[38;5;239m 01: rm -rf "TOKEN201703202355_006-BINARY-UNDEFINED-PATH"
|
||||
02: touch "TOKEN201703202355_006-BINARY-UNDEFINED-PATH"
|
||||
03: unset PATH[0m
|
||||
|
||||
STDIN:
|
||||
[38;5;239m 01: ls[0m
|
||||
|
||||
STDOUT:
|
||||
[31m[38;5;160m FAILURE expected_to match_regex `TOKEN201703202355_006-BINARY-UNDEFINED-PATH`[0m
|
||||
[38;5;239m (no output)[0m
|
||||
|
||||
STDERR:
|
||||
[31m[38;5;160m FAILURE expected_to be_empty[0m
|
||||
[38;5;239m 01: minishell: command not found: ls[0m
|
||||
|
||||
MISC:
|
||||
[31m[38;5;34m SUCCESS expected_to exit_with_status `0`[0m
|
||||
|
||||
----------------------------------------------------------------
|
||||
|
||||
[37;1mminishell/binary/007-binary-permission-denied[0m [31m[38;5;160m(FAILED)[0m
|
||||
|
||||
Description:
|
||||
[38;5;239m The purpose of this test is to check that trying to execute a non-permitted binary results in an error on standard error and a failure exit status.[0m
|
||||
|
||||
Before test:
|
||||
[38;5;239m 01: rm -rf ./permission_denied
|
||||
02: touch ./permission_denied
|
||||
03: chmod 0 ./permission_denied[0m
|
||||
|
||||
STDIN:
|
||||
[38;5;239m 01: ./permission_denied[0m
|
||||
|
||||
STDOUT:
|
||||
[31m[38;5;34m SUCCESS might 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 `[Pp]ermission denied`[0m
|
||||
[38;5;239m 01: minishell: permission denied: ./permission_denied[0m
|
||||
|
||||
MISC:
|
||||
[31m[38;5;160m FAILURE expected_to_not exit_with_status 0[0m
|
||||
|
||||
After test:
|
||||
[38;5;239m 01: if [ -d "./permission_denied" ]; then chmod 777 "./permission_denied"; fi
|
||||
02: rm -rf "./permission_denied"[0m
|
||||
|
||||
----------------------------------------------------------------
|
||||
|
||||
[37;1mminishell/binary/008-binary-too-many-symbolic-links-encountered[0m [31m[38;5;160m(FAILED)[0m
|
||||
|
||||
Description:
|
||||
[38;5;239m The purpose of this test is to check that trying to execute a path that encounters an infinite loop of symbolic link results in an error on standard error and a failure exit status.[0m
|
||||
|
||||
Before test:
|
||||
[38;5;239m 01: rm -rf ./symbolic_link1 ./symbolic_link2 ./symbolic_link3
|
||||
02: ln -s ./symbolic_link1 ./symbolic_link2
|
||||
03: ln -s ./symbolic_link2 ./symbolic_link3
|
||||
04: ln -s ./symbolic_link3 ./symbolic_link1[0m
|
||||
|
||||
STDIN:
|
||||
[38;5;239m 01: ./symbolic_link1[0m
|
||||
|
||||
STDOUT:
|
||||
[31m[38;5;34m SUCCESS might be_empty[0m
|
||||
[38;5;239m (no output)[0m
|
||||
|
||||
STDERR:
|
||||
[31m[38;5;34m SUCCESS expected_to_not be_empty[0m
|
||||
[31m[1;33m WARNING might match_regex `[Tt]oo many.*symbolic links`[0m
|
||||
[38;5;239m 01: minishell: ./symbolic_link1: no such file or directory[0m
|
||||
|
||||
MISC:
|
||||
[31m[38;5;160m FAILURE expected_to_not exit_with_status 0[0m
|
||||
|
||||
----------------------------------------------------------------
|
||||
|
||||
[37;1mminishell/builtins/cd/001-no-arg[0m [31m[38;5;160m(FAILED)[0m
|
||||
|
||||
Description:
|
||||
[38;5;239m The purpose of this test is to check that using the builtin `cd` without any argument results in moving to the HOME directory.[0m
|
||||
|
||||
STDIN:
|
||||
[38;5;239m 01: cd
|
||||
02: /Users/ariard/Projects/42sh/42shelltest-tmp/tmp/display_pwd[0m
|
||||
|
||||
STDOUT:
|
||||
[31m[38;5;34m SUCCESS expected_to_not match_regex `/Users/ariard/Projects/42sh/42shelltest-tmp/tmp$`[0m
|
||||
[31m[38;5;160m FAILURE expected_to match_regex `PWD:/Users/ariard:PWD`[0m
|
||||
[38;5;239m 01: /Users/ariard[0m
|
||||
|
||||
STDERR:
|
||||
[31m[38;5;34m SUCCESS expected_to be_empty[0m
|
||||
[38;5;239m (no output)[0m
|
||||
|
||||
----------------------------------------------------------------
|
||||
|
||||
[37;1mminishell/builtins/cd/002-current-directory[0m [31m[38;5;160m(FAILED)[0m
|
||||
|
||||
Description:
|
||||
[38;5;239m The purpose of this test is to check that using `.` as first argument with the builtin `cd` results in not changing current directory.[0m
|
||||
|
||||
STDIN:
|
||||
[38;5;239m 01: cd .
|
||||
02: /Users/ariard/Projects/42sh/42shelltest-tmp/tmp/display_pwd
|
||||
03: /Users/ariard/Projects/42sh/42shelltest-tmp/tmp/display_env[0m
|
||||
|
||||
STDOUT:
|
||||
[31m[38;5;34m SUCCESS expected_to match_regex `PWD:/Users/ariard/Projects/42sh/42shelltest-tmp/tmp:PWD`[0m
|
||||
[31m[38;5;160m FAILURE expected_to match_regex `^PWD=/Users/ariard/Projects/42sh/42shelltest-tmp/tmp$`[0m
|
||||
[38;5;239m 01: PWD:/Users/ariard/Projects/42sh/42shelltest-tmp/tmp:PWD[0m
|
||||
|
||||
STDERR:
|
||||
[31m[38;5;34m SUCCESS expected_to be_empty[0m
|
||||
[38;5;239m (no output)[0m
|
||||
|
||||
----------------------------------------------------------------
|
||||
|
||||
[37;1mminishell/builtins/cd/003-current-directory-2[0m [31m[38;5;160m(FAILED)[0m
|
||||
|
||||
Description:
|
||||
[38;5;239m The purpose of this test is to check that using a relative path to the current directory as argument with the builtin `cd` results in not changing the current directory. The environment variable must not be changed.[0m
|
||||
|
||||
STDIN:
|
||||
[38;5;239m 01: cd ../tmp
|
||||
02: /Users/ariard/Projects/42sh/42shelltest-tmp/tmp/display_pwd
|
||||
03: /Users/ariard/Projects/42sh/42shelltest-tmp/tmp/display_env[0m
|
||||
|
||||
STDOUT:
|
||||
[31m[38;5;34m SUCCESS expected_to match_regex `PWD:/Users/ariard/Projects/42sh/42shelltest-tmp/tmp:PWD`[0m
|
||||
[31m[38;5;160m FAILURE expected_to match_regex `^PWD=/Users/ariard/Projects/42sh/42shelltest-tmp/tmp$`[0m
|
||||
[38;5;239m 01: PWD:/Users/ariard/Projects/42sh/42shelltest-tmp/tmp:PWD[0m
|
||||
|
||||
STDERR:
|
||||
[31m[38;5;34m SUCCESS expected_to be_empty[0m
|
||||
[38;5;239m (no output)[0m
|
||||
|
||||
----------------------------------------------------------------
|
||||
|
||||
[37;1mminishell/builtins/cd/004-parent-directory[0m [31m[38;5;160m(FAILED)[0m
|
||||
|
||||
Description:
|
||||
[38;5;239m The purpose of this test is to check that using `..` as first argument with the builtin `cd` results in moving to the parent directory.[0m
|
||||
|
||||
STDIN:
|
||||
[38;5;239m 01: cd ..
|
||||
02: /Users/ariard/Projects/42sh/42shelltest-tmp/tmp/display_pwd
|
||||
03: /Users/ariard/Projects/42sh/42shelltest-tmp/tmp/display_env[0m
|
||||
|
||||
STDOUT:
|
||||
[31m[38;5;34m SUCCESS expected_to match_regex `PWD:/Users/ariard/Projects/42sh/42shelltest-tmp:PWD$`[0m
|
||||
[31m[38;5;160m FAILURE expected_to match_regex `^PWD=/Users/ariard/Projects/42sh/42shelltest-tmp$`[0m
|
||||
[38;5;239m 01: PWD:/Users/ariard/Projects/42sh/42shelltest-tmp:PWD[0m
|
||||
|
||||
STDERR:
|
||||
[31m[38;5;34m SUCCESS expected_to be_empty[0m
|
||||
[38;5;239m (no output)[0m
|
||||
|
||||
----------------------------------------------------------------
|
||||
|
||||
[37;1mminishell/builtins/cd/005-root-path[0m [31m[38;5;160m(FAILED)[0m
|
||||
|
||||
Description:
|
||||
[38;5;239m The purpose of this test is to check that using the root path as first argument with the builtin `cd` results in moving to the correct directory.[0m
|
||||
|
||||
STDIN:
|
||||
[38;5;239m 01: cd /
|
||||
02: /Users/ariard/Projects/42sh/42shelltest-tmp/tmp/display_pwd
|
||||
03: /Users/ariard/Projects/42sh/42shelltest-tmp/tmp/display_env[0m
|
||||
|
||||
STDOUT:
|
||||
[31m[38;5;34m SUCCESS expected_to match_regex `PWD:/:PWD`[0m
|
||||
[31m[38;5;160m FAILURE expected_to match_regex `^PWD=/$`[0m
|
||||
[38;5;239m 01: PWD:/:PWD[0m
|
||||
|
||||
STDERR:
|
||||
[31m[38;5;34m SUCCESS expected_to be_empty[0m
|
||||
[38;5;239m (no output)[0m
|
||||
|
||||
----------------------------------------------------------------
|
||||
|
||||
[37;1mminishell/builtins/cd/006-root-path-2[0m [31m[38;5;160m(FAILED)[0m
|
||||
|
||||
Description:
|
||||
[38;5;239m The purpose of this test is to check that using the root path as first argument with the builtin `cd` results in moving to the correct directory.[0m
|
||||
|
||||
STDIN:
|
||||
[38;5;239m 01: cd /.
|
||||
02: /Users/ariard/Projects/42sh/42shelltest-tmp/tmp/display_pwd
|
||||
03: /Users/ariard/Projects/42sh/42shelltest-tmp/tmp/display_env[0m
|
||||
|
||||
STDOUT:
|
||||
[31m[38;5;34m SUCCESS expected_to match_regex `PWD:/:PWD`[0m
|
||||
[31m[38;5;160m FAILURE expected_to match_regex `^PWD=/$`[0m
|
||||
[38;5;239m 01: PWD:/:PWD[0m
|
||||
|
||||
STDERR:
|
||||
[31m[38;5;34m SUCCESS expected_to be_empty[0m
|
||||
[38;5;239m (no output)[0m
|
||||
|
||||
----------------------------------------------------------------
|
||||
|
||||
[37;1mminishell/builtins/cd/007-symbolic-link[0m [31m[38;5;160m(FAILED)[0m
|
||||
|
||||
Description:
|
||||
[38;5;239m The purpose of this test is to check that using a symbolic link as first argument with the builtin `cd` results in moving the linked directory.[0m
|
||||
|
||||
Before test:
|
||||
[38;5;239m 01: rm -f "./symbolic_link"
|
||||
02: mkdir -p "./sub_directory"
|
||||
03: ln -s "./sub_directory" "./symbolic_link"[0m
|
||||
|
||||
STDIN:
|
||||
[38;5;239m 01: cd symbolic_link
|
||||
02: /Users/ariard/Projects/42sh/42shelltest-tmp/tmp/display_pwd
|
||||
03: /Users/ariard/Projects/42sh/42shelltest-tmp/tmp/display_env[0m
|
||||
|
||||
STDOUT:
|
||||
[31m[38;5;34m SUCCESS expected_to match_regex `PWD:/Users/ariard/Projects/42sh/42shelltest-tmp/tmp/sub_directory:PWD$`[0m
|
||||
[31m[38;5;160m FAILURE expected_to match_regex `^PWD=/Users/ariard/Projects/42sh/42shelltest-tmp/tmp/symbolic_link$`[0m
|
||||
[38;5;239m 01: PWD:/Users/ariard/Projects/42sh/42shelltest-tmp/tmp/sub_directory:PWD[0m
|
||||
|
||||
STDERR:
|
||||
[31m[38;5;34m SUCCESS expected_to be_empty[0m
|
||||
[38;5;239m (no output)[0m
|
||||
|
||||
----------------------------------------------------------------
|
||||
|
||||
[37;1mminishell/builtins/cd/008-symbolic-link-2[0m [31m[38;5;160m(FAILED)[0m
|
||||
|
||||
Description:
|
||||
[38;5;239m The purpose of this test is to check that using a symbolic link as first argument with the builtin `cd` results in moving to the linked directory. In this test, the directory is linked with to chained symbolic links.[0m
|
||||
|
||||
Before test:
|
||||
[38;5;239m 01: rm -f "./symbolic_link1" "./symbolic_link2"
|
||||
02: mkdir -p "./sub_directory"
|
||||
03: ln -s "./sub_directory" "./symbolic_link1"
|
||||
04: ln -s "./symbolic_link1" "./symbolic_link2"[0m
|
||||
|
||||
STDIN:
|
||||
[38;5;239m 01: cd symbolic_link2
|
||||
02: /Users/ariard/Projects/42sh/42shelltest-tmp/tmp/display_pwd
|
||||
03: /Users/ariard/Projects/42sh/42shelltest-tmp/tmp/display_env[0m
|
||||
|
||||
STDOUT:
|
||||
[31m[38;5;34m SUCCESS expected_to match_regex `PWD:/Users/ariard/Projects/42sh/42shelltest-tmp/tmp/sub_directory:PWD$`[0m
|
||||
[31m[38;5;160m FAILURE expected_to match_regex `^PWD=/Users/ariard/Projects/42sh/42shelltest-tmp/tmp/symbolic_link2$`[0m
|
||||
[38;5;239m 01: PWD:/Users/ariard/Projects/42sh/42shelltest-tmp/tmp/sub_directory:PWD[0m
|
||||
|
||||
STDERR:
|
||||
[31m[38;5;34m SUCCESS expected_to be_empty[0m
|
||||
[38;5;239m (no output)[0m
|
||||
|
||||
----------------------------------------------------------------
|
||||
|
||||
[37;1mminishell/builtins/cd/010-update-OLDPWD[0m [31m[38;5;160m(FAILED)[0m
|
||||
|
||||
Description:
|
||||
[38;5;239m The purpose of this test is to check that using the builtin `cd` results in a modified environment variable `PWD`.[0m
|
||||
|
||||
Before test:
|
||||
[38;5;239m 01: rm -rf "TOKEN201703202355"
|
||||
02: mkdir -p "./TOKEN201703202355/TOKEN201703202355"[0m
|
||||
|
||||
STDIN:
|
||||
[38;5;239m 01: cd TOKEN201703202355
|
||||
02: cd TOKEN201703202355
|
||||
03: ../../display_env[0m
|
||||
|
||||
STDOUT:
|
||||
[31m[38;5;160m FAILURE expected_to match_regex `^PWD=/Users/ariard/Projects/42sh/42shelltest-tmp/tmp/TOKEN201703202355/TOKEN201703202355$`[0m
|
||||
[31m[38;5;160m FAILURE expected_to match_regex `^OLDPWD=/Users/ariard/Projects/42sh/42shelltest-tmp/tmp/TOKEN201703202355$`[0m
|
||||
[38;5;239m (no output)[0m
|
||||
|
||||
STDERR:
|
||||
[31m[38;5;34m SUCCESS expected_to be_empty[0m
|
||||
[38;5;239m (no output)[0m
|
||||
|
||||
----------------------------------------------------------------
|
||||
|
||||
[37;1mminishell/builtins/cd/011-dotdot[0m [31m[38;5;160m(FAILED)[0m
|
||||
|
||||
Description:
|
||||
[38;5;239m The purpose of this test is to check that playing with relative paths with the builtin `cd` results in correctly changing the current directory.[0m
|
||||
|
||||
Before test:
|
||||
[38;5;239m 01: rm -rf "playing_with_dotdot"
|
||||
02: mkdir -p "playing_with_dotdot/1/2/3/4/5/6/7/8/9/10"[0m
|
||||
|
||||
STDIN:
|
||||
[38;5;239m 01: cd playing_with_dotdot
|
||||
02: cd ../playing_with_dotdot
|
||||
03: cd 1/2/3/4/../4/../4/../../3/4/5/6/7/8/9/10
|
||||
04: cd ../../../../../../../../../../1/2/3/4/5
|
||||
05: /Users/ariard/Projects/42sh/42shelltest-tmp/tmp/display_pwd
|
||||
06: /Users/ariard/Projects/42sh/42shelltest-tmp/tmp/display_env[0m
|
||||
|
||||
STDOUT:
|
||||
[31m[38;5;160m FAILURE expected_to match_regex `PWD:/Users/ariard/Projects/42sh/42shelltest-tmp/tmp/playing_with_dotdot/1/2/3/4/5:PWD`[0m
|
||||
[31m[38;5;160m FAILURE expected_to match_regex `^PWD=/Users/ariard/Projects/42sh/42shelltest-tmp/tmp/playing_with_dotdot/1/2/3/4/5$`[0m
|
||||
[38;5;239m (no output)[0m
|
||||
|
||||
STDERR:
|
||||
[31m[38;5;34m SUCCESS expected_to be_empty[0m
|
||||
[38;5;239m (no output)[0m
|
||||
|
||||
----------------------------------------------------------------
|
||||
|
||||
[37;1mminishell/builtins/cd/012-dot[0m [31m[38;5;160m(FAILED)[0m
|
||||
|
||||
Description:
|
||||
[38;5;239m The purpose of this test is to check that playing with relative paths to the current directory with the builtin `cd` results in not changing the current directory.[0m
|
||||
|
||||
STDIN:
|
||||
[38;5;239m 01: cd .
|
||||
02: cd ./
|
||||
03: cd ./.
|
||||
04: cd ././
|
||||
05: cd ./././././././././.
|
||||
06: /Users/ariard/Projects/42sh/42shelltest-tmp/tmp/display_pwd
|
||||
07: /Users/ariard/Projects/42sh/42shelltest-tmp/tmp/display_env[0m
|
||||
|
||||
STDOUT:
|
||||
[31m[38;5;34m SUCCESS expected_to match_regex `PWD:/Users/ariard/Projects/42sh/42shelltest-tmp/tmp:PWD`[0m
|
||||
[31m[38;5;160m FAILURE expected_to match_regex `^PWD=/Users/ariard/Projects/42sh/42shelltest-tmp/tmp$`[0m
|
||||
[38;5;239m 01: PWD:/Users/ariard/Projects/42sh/42shelltest-tmp/tmp:PWD[0m
|
||||
|
||||
STDERR:
|
||||
[31m[38;5;34m SUCCESS expected_to be_empty[0m
|
||||
[38;5;239m (no output)[0m
|
||||
|
||||
----------------------------------------------------------------
|
||||
|
||||
[37;1mminishell/builtins/cd/013-absolute-path[0m [31m[38;5;160m(FAILED)[0m
|
||||
|
||||
Description:
|
||||
[38;5;239m The purpose of this test is to check that using an absolute path as first argument with the builtin `cd` results in moving to the correct directory.[0m
|
||||
|
||||
Before test:
|
||||
[38;5;239m 01: rm -rf "./my_sub_directory"
|
||||
02: mkdir -p "./my_sub_directory/and_another_one/"[0m
|
||||
|
||||
STDIN:
|
||||
[38;5;239m 01: cd /Users/ariard/Projects/42sh/42shelltest-tmp/tmp/my_sub_directory/and_another_one
|
||||
02: /Users/ariard/Projects/42sh/42shelltest-tmp/tmp/display_pwd
|
||||
03: /Users/ariard/Projects/42sh/42shelltest-tmp/tmp/display_env[0m
|
||||
|
||||
STDOUT:
|
||||
[31m[38;5;34m SUCCESS expected_to match_regex `PWD:/Users/ariard/Projects/42sh/42shelltest-tmp/tmp/my_sub_directory/and_another_one:PWD`[0m
|
||||
[31m[38;5;160m FAILURE expected_to match_regex `^PWD=/Users/ariard/Projects/42sh/42shelltest-tmp/tmp/my_sub_directory/and_another_one$`[0m
|
||||
[38;5;239m 01: PWD:/Users/ariard/Projects/42sh/42shelltest-tmp/tmp/my_sub_directory/and_another_one:PWD[0m
|
||||
|
||||
STDERR:
|
||||
[31m[38;5;34m SUCCESS expected_to be_empty[0m
|
||||
[38;5;239m (no output)[0m
|
||||
|
||||
----------------------------------------------------------------
|
||||
|
||||
[37;1mminishell/builtins/cd/errors/001-not-a-directory[0m [31m[38;5;160m(FAILED)[0m
|
||||
|
||||
Description:
|
||||
[38;5;239m The purpose of this test is to check that using a file name as first argument with the builtin `cd` results in error and not changing current directory.[0m
|
||||
|
||||
Before test:
|
||||
[38;5;239m 01: touch "./not_a_directory"[0m
|
||||
|
||||
STDIN:
|
||||
[38;5;239m 01: cd not_a_directory
|
||||
02: /Users/ariard/Projects/42sh/42shelltest-tmp/tmp/display_pwd[0m
|
||||
|
||||
STDOUT:
|
||||
[31m[38;5;160m FAILURE expected_to match_regex `PWD:/Users/ariard/Projects/42sh/42shelltest-tmp/tmp:PWD`[0m
|
||||
[38;5;239m (no output)[0m
|
||||
|
||||
STDERR:
|
||||
[31m[38;5;34m SUCCESS expected_to_not be_empty[0m
|
||||
[31m[1;33m WARNING might match_regex `[Nn]ot a directory`[0m
|
||||
[38;5;239m 01: cd: no such file or directory: not_a_directory[0m
|
||||
|
||||
----------------------------------------------------------------
|
||||
|
||||
[37;1mminishell/builtins/cd/errors/002-not-a-directory-2[0m [31m[38;5;160m(FAILED)[0m
|
||||
|
||||
Description:
|
||||
[38;5;239m The purpose of this test is to check that using a file name as first argument with the builtin `cd` results in a Shell termination with a failure exit status.[0m
|
||||
|
||||
Before test:
|
||||
[38;5;239m 01: touch "./not_a_directory"[0m
|
||||
|
||||
STDIN:
|
||||
[38;5;239m 01: cd not_a_directory[0m
|
||||
|
||||
STDOUT:
|
||||
[38;5;239m (no output)[0m
|
||||
|
||||
STDERR:
|
||||
[38;5;239m 01: cd: no such file or directory: not_a_directory[0m
|
||||
|
||||
MISC:
|
||||
[31m[38;5;160m FAILURE expected_to_not exit_with_status `0`[0m
|
||||
|
||||
----------------------------------------------------------------
|
||||
|
||||
[37;1mminishell/builtins/cd/errors/003-permission-denied[0m [31m[1;33m(WARNING)[0m
|
||||
|
||||
Description:
|
||||
[38;5;239m The purpose of this test is to check that using a directory without any permission as first argument with the builtin `cd` results in error and not changing current directory.[0m
|
||||
|
||||
Before test:
|
||||
[38;5;239m 01: if [ -d "./permission_denied" ]; then chmod 777 "./permission_denied"; fi
|
||||
02: rm -rf "./permission_denied"
|
||||
03: mkdir -m 0 "./permission_denied"[0m
|
||||
|
||||
STDIN:
|
||||
[38;5;239m 01: cd permission_denied
|
||||
02: /Users/ariard/Projects/42sh/42shelltest-tmp/tmp/display_pwd[0m
|
||||
|
||||
STDOUT:
|
||||
[31m[38;5;34m SUCCESS expected_to match_regex `PWD:/Users/ariard/Projects/42sh/42shelltest-tmp/tmp:PWD`[0m
|
||||
[38;5;239m 01: PWD:/Users/ariard/Projects/42sh/42shelltest-tmp/tmp:PWD[0m
|
||||
|
||||
STDERR:
|
||||
[31m[38;5;34m SUCCESS expected_to_not be_empty[0m
|
||||
[31m[1;33m WARNING might match_regex `[Pp]ermission denied`[0m
|
||||
[38;5;239m 01: cd: no such file or directory: permission_denied[0m
|
||||
|
||||
After test:
|
||||
[38;5;239m 01: if [ -d "./permission_denied" ]; then chmod 777 "./permission_denied"; fi
|
||||
02: rm -rf "./permission_denied"[0m
|
||||
|
||||
----------------------------------------------------------------
|
||||
|
||||
[37;1mminishell/builtins/cd/errors/004-permission-denied-2[0m [31m[38;5;160m(FAILED)[0m
|
||||
|
||||
Description:
|
||||
[38;5;239m The purpose of this test is to check that using a directory without any permission as first argument with the builtin `cd` results in error and not changing current directory.[0m
|
||||
|
||||
Before test:
|
||||
[38;5;239m 01: if [ -d "./permission_denied" ]; then chmod 777 "./permission_denied"; fi
|
||||
02: rm -rf "./permission_denied"
|
||||
03: mkdir -m 0 "./permission_denied"[0m
|
||||
|
||||
STDIN:
|
||||
[38;5;239m 01: cd permission_denied[0m
|
||||
|
||||
STDOUT:
|
||||
[38;5;239m (no output)[0m
|
||||
|
||||
STDERR:
|
||||
[38;5;239m 01: cd: no such file or directory: permission_denied[0m
|
||||
|
||||
MISC:
|
||||
[31m[38;5;160m FAILURE expected_to_not exit_with_status `0`[0m
|
||||
|
||||
After test:
|
||||
[38;5;239m 01: if [ -d "./permission_denied" ]; then chmod 777 "./permission_denied"; fi
|
||||
02: rm -rf "./permission_denied"[0m
|
||||
|
||||
----------------------------------------------------------------
|
||||
|
||||
[37;1mminishell/builtins/cd/errors/005-too-many-symbolic-links-encountered[0m [31m[38;5;160m(FAILED)[0m
|
||||
|
||||
Description:
|
||||
[38;5;239m The purpose of this test is to check that using a symbolic link resulting in ELOOP error as first argument with the builtin `cd` results in error and not changing current directory.[0m
|
||||
|
||||
Before test:
|
||||
[38;5;239m 01: rm -f "./symbolic_link1" "./symbolic_link2" "./symbolic_link3"
|
||||
02: ln -s "./symbolic_link1" "./symbolic_link2"
|
||||
03: ln -s "./symbolic_link2" "./symbolic_link3"
|
||||
04: ln -s "./symbolic_link3" "./symbolic_link1"[0m
|
||||
|
||||
STDIN:
|
||||
[38;5;239m 01: cd symbolic_link1
|
||||
02: /Users/ariard/Projects/42sh/42shelltest-tmp/tmp/display_pwd[0m
|
||||
|
||||
STDOUT:
|
||||
[31m[38;5;160m FAILURE expected_to match_regex `PWD:/Users/ariard/Projects/42sh/42shelltest-tmp/tmp:PWD`[0m
|
||||
[38;5;239m (no output)[0m
|
||||
|
||||
STDERR:
|
||||
[31m[38;5;34m SUCCESS expected_to_not be_empty[0m
|
||||
[31m[1;33m WARNING might match_regex `[Tt]oo many.*symbolic links`[0m
|
||||
[38;5;239m 01: cd: no such file or directory: symbolic_link1[0m
|
||||
|
||||
----------------------------------------------------------------
|
||||
|
||||
[37;1mminishell/builtins/cd/errors/006-too-many-symbolic-links-encountered-2[0m [31m[38;5;160m(FAILED)[0m
|
||||
|
||||
Description:
|
||||
[38;5;239m The purpose of this test is to check that using a symbolic link resulting in ELOOP error as first argument with the builtin `cd` results in a Shell termination with a failure exit status.[0m
|
||||
|
||||
Before test:
|
||||
[38;5;239m 01: rm -f "./symbolic_link1" "./symbolic_link2" "./symbolic_link3"
|
||||
02: ln -s "./symbolic_link1" "./symbolic_link2"
|
||||
03: ln -s "./symbolic_link2" "./symbolic_link3"
|
||||
04: ln -s "./symbolic_link3" "./symbolic_link1"[0m
|
||||
|
||||
STDIN:
|
||||
[38;5;239m 01: cd symbolic_link1[0m
|
||||
|
||||
STDOUT:
|
||||
[38;5;239m (no output)[0m
|
||||
|
||||
STDERR:
|
||||
[38;5;239m 01: cd: no such file or directory: symbolic_link1[0m
|
||||
|
||||
MISC:
|
||||
[31m[38;5;160m FAILURE expected_to_not exit_with_status `0`[0m
|
||||
|
||||
----------------------------------------------------------------
|
||||
|
||||
[37;1mminishell/builtins/cd/errors/007-no-such-file-or-directory[0m [31m[38;5;160m(FAILED)[0m
|
||||
|
||||
Description:
|
||||
[38;5;239m The purpose of this test is to check that using a non-existing path as first argument with the builtin `cd` results in error and not changing current directory.[0m
|
||||
|
||||
Before test:
|
||||
[38;5;239m 01: rm -f "./no_such_file_or_directory"[0m
|
||||
|
||||
STDIN:
|
||||
[38;5;239m 01: cd no_such_file_or_directory
|
||||
02: /Users/ariard/Projects/42sh/42shelltest-tmp/tmp/display_pwd[0m
|
||||
|
||||
STDOUT:
|
||||
[31m[38;5;160m FAILURE expected_to match_regex `PWD:/Users/ariard/Projects/42sh/42shelltest-tmp/tmp:PWD`[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 `[Nn]o such file or directory`[0m
|
||||
[38;5;239m 01: cd: no such file or directory: no_such_file_or_directory[0m
|
||||
|
||||
----------------------------------------------------------------
|
||||
|
||||
[37;1mminishell/builtins/cd/errors/008-no-such-file-or-directory-2[0m [31m[38;5;160m(FAILED)[0m
|
||||
|
||||
Description:
|
||||
[38;5;239m The purpose of this test is to check that using a non-existing path as first argument with the builtin `cd` results in a Shell termination with an error status code.[0m
|
||||
|
||||
Before test:
|
||||
[38;5;239m 01: rm -f "./no_such_file_or_directory"[0m
|
||||
|
||||
STDIN:
|
||||
[38;5;239m 01: cd no_such_file_or_directory[0m
|
||||
|
||||
STDOUT:
|
||||
[38;5;239m (no output)[0m
|
||||
|
||||
STDERR:
|
||||
[38;5;239m 01: cd: no such file or directory: no_such_file_or_directory[0m
|
||||
|
||||
MISC:
|
||||
[31m[38;5;160m FAILURE expected_to_not exit_with_status `0`[0m
|
||||
|
||||
----------------------------------------------------------------
|
||||
|
||||
[37;1mminishell/builtins/cd/errors/009-no-such-file-or-directory-symlink[0m [31m[38;5;160m(FAILED)[0m
|
||||
|
||||
Description:
|
||||
[38;5;239m The purpose of this test is to check that using a symbolic link that targets to a non-existing directory with the builtin `cd` results in error and not changing current directory.[0m
|
||||
|
||||
Before test:
|
||||
[38;5;239m 01: rm -rf "./enoent_symlink" "./enoent_directory"
|
||||
02: ln -s "./enoent_directory" "./enoent_symlink"[0m
|
||||
|
||||
STDIN:
|
||||
[38;5;239m 01: cd ./enoent_symlink
|
||||
02: /Users/ariard/Projects/42sh/42shelltest-tmp/tmp/display_pwd[0m
|
||||
|
||||
STDOUT:
|
||||
[31m[38;5;160m FAILURE expected_to match_regex `PWD:/Users/ariard/Projects/42sh/42shelltest-tmp/tmp:PWD`[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 `[Nn]o such file or directory`[0m
|
||||
[38;5;239m 01: cd: no such file or directory: ./enoent_symlink[0m
|
||||
|
||||
----------------------------------------------------------------
|
||||
|
||||
[37;1mminishell/builtins/cd/errors/010-no-such-file-or-directory-symlink-2[0m [31m[38;5;160m(FAILED)[0m
|
||||
|
||||
Description:
|
||||
[38;5;239m The purpose of this test is to check that using a symbolic link that targets to a non-existing directory with the builtin `cd` results in error and not changing current directory.[0m
|
||||
|
||||
Before test:
|
||||
[38;5;239m 01: rm -rf "./enoent_symlink" "./enoent_directory"
|
||||
02: ln -s "./enoent_directory" "./enoent_symlink"[0m
|
||||
|
||||
STDIN:
|
||||
[38;5;239m 01: cd ./enoent_symlink[0m
|
||||
|
||||
STDOUT:
|
||||
[38;5;239m (no output)[0m
|
||||
|
||||
STDERR:
|
||||
[38;5;239m 01: cd: no such file or directory: ./enoent_symlink[0m
|
||||
|
||||
MISC:
|
||||
[31m[38;5;160m FAILURE expected_to_not exit_with_status `0`[0m
|
||||
|
||||
----------------------------------------------------------------
|
||||
|
||||
[37;1mminishell/builtins/cd/options/001-not-following-links[0m [31m[38;5;160m(FAILED)[0m
|
||||
|
||||
Description:
|
||||
[38;5;239m The purpose of this test is to check that using symbolic links twice with the builtin `cd` and the option `-P` results in a correct environment variable PWD. The option `-P` makes the Shell to resolve symbolic links.[0m
|
||||
|
||||
Before test:
|
||||
[38;5;239m 01: rm -fr "./sub_directory_link" "./sub_directory"
|
||||
02: mkdir -p "./sub_directory/sub_sub_directory"
|
||||
03: ln -s "./sub_directory" "./sub_directory_link"
|
||||
04: ln -s "./sub_sub_directory" "./sub_directory/sub_sub_directory_link"[0m
|
||||
|
||||
STDIN:
|
||||
[38;5;239m 01: cd -P sub_directory_link
|
||||
02: cd -P sub_sub_directory_link
|
||||
03: /Users/ariard/Projects/42sh/42shelltest-tmp/tmp/display_env[0m
|
||||
|
||||
STDOUT:
|
||||
[31m[38;5;160m FAILURE expected_to match_regex `PWD=/Users/ariard/Projects/42sh/42shelltest-tmp/tmp/sub_directory/sub_sub_directory`[0m
|
||||
[38;5;239m (no output)[0m
|
||||
|
||||
STDERR:
|
||||
[31m[38;5;34m SUCCESS might be_empty[0m
|
||||
[38;5;239m (no output)[0m
|
||||
|
||||
----------------------------------------------------------------
|
||||
|
||||
[37;1mminishell/builtins/cd/options/002-oldpwd[0m [31m[38;5;160m(FAILED)[0m
|
||||
|
||||
Description:
|
||||
[38;5;239m The purpose of this test is to check that using `-` as first argument with the builtin `cd` results in moving the previous current directory.[0m
|
||||
|
||||
STDIN:
|
||||
[38;5;239m 01: cd /
|
||||
02: cd -
|
||||
03: /Users/ariard/Projects/42sh/42shelltest-tmp/tmp/display_pwd[0m
|
||||
|
||||
STDOUT:
|
||||
[31m[38;5;160m FAILURE expected_to match_regex `PWD:/Users/ariard/Projects/42sh/42shelltest-tmp/tmp:PWD`[0m
|
||||
[38;5;239m 01: /Users/ariard/Projects/42sh/42shelltest-tmp/tmp[0m
|
||||
|
||||
STDERR:
|
||||
[31m[38;5;34m SUCCESS expected_to be_empty[0m
|
||||
[38;5;239m (no output)[0m
|
||||
|
||||
----------------------------------------------------------------
|
||||
|
||||
[37;1mminishell/builtins/env/003-ignore-environment[0m [31m[38;5;160m(FAILED)[0m
|
||||
|
||||
Description:
|
||||
[38;5;239m The purpose of this test is to check that using the option `-i` with the builtin `env` results in an empty environment sent to the given command.[0m
|
||||
|
||||
STDIN:
|
||||
[38;5;239m 01: env -i ./display_env[0m
|
||||
|
||||
STDOUT:
|
||||
[31m[38;5;160m FAILURE expected_to match_regex `TOTAL ENVIRONMENT VARIABLES: 0`[0m
|
||||
[38;5;239m (no output)[0m
|
||||
|
||||
STDERR:
|
||||
[31m[38;5;34m SUCCESS expected_to be_empty[0m
|
||||
[38;5;239m (no output)[0m
|
||||
|
||||
----------------------------------------------------------------
|
||||
|
||||
[37;1mminishell/builtins/env/005-set-variables[0m [31m[38;5;160m(FAILED)[0m
|
||||
|
||||
Description:
|
||||
[38;5;239m The purpose of this test is to check that the builtin `env` can modify or set multiple environment variables before executing the given command.[0m
|
||||
|
||||
Before test:
|
||||
[38;5;239m 01: export VARTEST1="OLD_VALUE"[0m
|
||||
|
||||
STDIN:
|
||||
[38;5;239m 01: env VARTEST1=TOKEN201703202355_1 VARTEST2=TOKEN201703202355_2 VARTEST3=TOKEN201703202355_3 ./display_env[0m
|
||||
|
||||
STDOUT:
|
||||
[31m[38;5;160m FAILURE expected_to match_regex `VARTEST1=TOKEN201703202355_1`[0m
|
||||
[31m[38;5;160m FAILURE expected_to match_regex `VARTEST2=TOKEN201703202355_2`[0m
|
||||
[31m[38;5;160m FAILURE expected_to match_regex `VARTEST3=TOKEN201703202355_3`[0m
|
||||
[38;5;239m (no output)[0m
|
||||
|
||||
STDERR:
|
||||
[31m[38;5;34m SUCCESS expected_to be_empty[0m
|
||||
[38;5;239m (no output)[0m
|
||||
|
||||
----------------------------------------------------------------
|
||||
|
||||
[37;1mminishell/builtins/env/errors/001-command-not-found[0m [31m[38;5;160m(FAILED)[0m
|
||||
|
||||
Description:
|
||||
[38;5;239m The purpose of this test is to check that using the builtin `env` with an invalid binary as argument results in an error and failure exit status.[0m
|
||||
|
||||
Before test:
|
||||
[38;5;239m 01: rm -f "./invalid_binary"[0m
|
||||
|
||||
STDIN:
|
||||
[38;5;239m 01: env ./invalid_binary[0m
|
||||
|
||||
STDOUT:
|
||||
[38;5;239m (no output)[0m
|
||||
|
||||
STDERR:
|
||||
[31m[38;5;160m FAILURE expected_to_not be_empty[0m
|
||||
[31m[1;33m WARNING might match_regex `[Cc]ommand not found`[0m
|
||||
[38;5;239m (no output)[0m
|
||||
|
||||
MISC:
|
||||
[31m[38;5;34m SUCCESS expected_to_not exit_with_status `0`[0m
|
||||
|
||||
----------------------------------------------------------------
|
||||
|
||||
[37;1mminishell/builtins/env/errors/002-illegal-option[0m [31m[38;5;160m(FAILED)[0m
|
||||
|
||||
Description:
|
||||
[38;5;239m The purpose of this test is to check that using the builtin `env` with an invalid option results in an error and failure exit status.[0m
|
||||
|
||||
Before test:
|
||||
[38;5;239m 01: rm -f -- "-w"[0m
|
||||
|
||||
STDIN:
|
||||
[38;5;239m 01: env -w[0m
|
||||
|
||||
STDOUT:
|
||||
[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 `([Ii]nvalid|[Ii]llegal) (option|argument)`[0m
|
||||
[38;5;239m 01: env: illegal option -- w
|
||||
02: usage: env [-i] [-u name] [name=value]... [utility [argument...]][0m
|
||||
|
||||
MISC:
|
||||
[31m[38;5;160m FAILURE expected_to_not exit_with_status `0`[0m
|
||||
|
||||
----------------------------------------------------------------
|
||||
|
||||
[37;1mminishell/builtins/env/multiple-options/001-ignore-environment-and-set-variable[0m [31m[38;5;160m(FAILED)[0m
|
||||
|
||||
Description:
|
||||
[38;5;239m The purpose of this test is to check that `env -i` works if we use a second argument to set an environment variable, we are also checking if this command unset environments variables for a given binary.[0m
|
||||
|
||||
STDIN:
|
||||
[38;5;239m 01: env -i TESTVARIABLE=TOKEN201703202355 ./display_env[0m
|
||||
|
||||
STDOUT:
|
||||
[31m[38;5;160m FAILURE expected_to match_regex `TESTVARIABLE=TOKEN201703202355`[0m
|
||||
[31m[38;5;160m FAILURE expected_to match_regex `TOTAL ENVIRONMENT VARIABLES: 1`[0m
|
||||
[38;5;239m (no output)[0m
|
||||
|
||||
STDERR:
|
||||
[31m[38;5;34m SUCCESS expected_to be_empty[0m
|
||||
[38;5;239m (no output)[0m
|
||||
|
||||
----------------------------------------------------------------
|
||||
|
||||
[37;1mminishell/builtins/exit/003-status-of-last-command[0m [31m[38;5;160m(FAILED)[0m
|
||||
|
||||
Description:
|
||||
[38;5;239m The purpose of this test is to check that using the builtin `exit` without any argument results in a Shell termination and the exit status of the previous command.[0m
|
||||
|
||||
STDIN:
|
||||
[38;5;239m 01: ./exit_with_status 42
|
||||
02: exit[0m
|
||||
|
||||
STDOUT:
|
||||
[31m[38;5;34m SUCCESS might be_empty[0m
|
||||
[38;5;239m (no output)[0m
|
||||
|
||||
STDERR:
|
||||
[38;5;239m (no output)[0m
|
||||
|
||||
MISC:
|
||||
[31m[38;5;160m FAILURE expected_to exit_with_status `42`[0m
|
||||
|
||||
----------------------------------------------------------------
|
||||
|
||||
[37;1mminishell/builtins/exit/errors/001-too-many-args[0m [31m[38;5;160m(FAILED)[0m
|
||||
|
||||
Description:
|
||||
[38;5;239m The purpose of this test is to check that using a wrong number of arguments with the builtin `exit` does not result in the Shell termination but an error on standard error.[0m
|
||||
|
||||
STDIN:
|
||||
[38;5;239m 01: exit 21 42
|
||||
02: ./write_on_stdout TOKEN201703202355[0m
|
||||
|
||||
STDOUT:
|
||||
[31m[38;5;160m FAILURE expected_to match_regex `TOKEN201703202355`[0m
|
||||
[38;5;239m (no output)[0m
|
||||
|
||||
STDERR:
|
||||
[31m[38;5;160m FAILURE expected_to_not be_empty[0m
|
||||
[31m[1;33m WARNING might match_regex `([Tt]oo many arguments|[Aa]rgument list too long)`[0m
|
||||
[38;5;239m (no output)[0m
|
||||
|
||||
MISC:
|
||||
[31m[38;5;160m FAILURE expected_to exit_with_status `0`[0m
|
||||
|
||||
----------------------------------------------------------------
|
||||
|
||||
[37;1mminishell/builtins/exit/errors/002-non-numeric-argument[0m [31m[38;5;160m(FAILED)[0m
|
||||
|
||||
Description:
|
||||
[38;5;239m The purpose of this test is to check that using a non-numeric argument with the builtin `exit` results in the Shell termination and an error on standard error.[0m
|
||||
|
||||
STDIN:
|
||||
[38;5;239m 01: exit abc
|
||||
02: ./write_on_stdout TOKEN201703202355[0m
|
||||
|
||||
STDOUT:
|
||||
[31m[38;5;34m SUCCESS expected_to_not match_regex `TOKEN201703202355`[0m
|
||||
[38;5;239m (no output)[0m
|
||||
|
||||
STDERR:
|
||||
[31m[1;33m WARNING might_not be_empty[0m
|
||||
[31m[1;33m WARNING might match_regex `[Nn]umeric argument required`[0m
|
||||
[38;5;239m (no output)[0m
|
||||
|
||||
MISC:
|
||||
[31m[38;5;160m FAILURE expected_to_not exit_with_status `0`[0m
|
||||
|
||||
----------------------------------------------------------------
|
||||
|
||||
[37;1mminishell/builtins/setenv/004-invalid-identifier[0m [31m[38;5;160m(FAILED)[0m
|
||||
|
||||
Description:
|
||||
[38;5;239m The purpose of this test is to check that using a wrong variable name with the builtin `setenv` (or `export`) results in error.[0m
|
||||
|
||||
STDIN:
|
||||
[38;5;239m 01: setenv 42
|
||||
02: export 42[0m
|
||||
|
||||
STDOUT:
|
||||
[31m[38;5;34m SUCCESS might be_empty[0m
|
||||
[38;5;239m (no output)[0m
|
||||
|
||||
STDERR:
|
||||
[31m[38;5;160m FAILURE expected_to_not be_empty[0m
|
||||
[31m[1;33m WARNING might match_regex `(not.*identifier|must begin.*letter)`[0m
|
||||
[38;5;239m (no output)[0m
|
||||
|
||||
----------------------------------------------------------------
|
||||
|
||||
[37;1mminishell/misc/001-copy-of-environment[0m [31m[38;5;160m(FAILED)[0m
|
||||
|
||||
Description:
|
||||
[38;5;239m A Shell must send a copy of the environment to its child processes.[0m
|
||||
|
||||
Before test:
|
||||
[38;5;239m 01: export COPYENV_VAR1="TOKEN201703202355_VAR1"
|
||||
02: export COPYENV_VAR2="TOKEN201703202355_VAR2"
|
||||
03: export COPYENV_VAR3="TOKEN201703202355_VAR3"[0m
|
||||
|
||||
STDIN:
|
||||
[38;5;239m 01: ./display_env[0m
|
||||
|
||||
STDOUT:
|
||||
[31m[38;5;160m FAILURE expected_to match_regex `COPYENV_VAR1=TOKEN201703202355_VAR1`[0m
|
||||
[31m[38;5;160m FAILURE expected_to match_regex `COPYENV_VAR2=TOKEN201703202355_VAR2`[0m
|
||||
[31m[38;5;160m FAILURE expected_to match_regex `COPYENV_VAR3=TOKEN201703202355_VAR3`[0m
|
||||
[38;5;239m (no output)[0m
|
||||
|
||||
STDERR:
|
||||
[38;5;239m (no output)[0m
|
||||
|
||||
Total tests: 54
|
||||
Total failed tests: 38
|
||||
Total pending tests: 0
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
# bonuses
|
||||
|
||||
*[spec](..) > bonuses*
|
||||
|
||||
* [builtins](./builtins)
|
||||
* [inline-environment-variable](./inline-environment-variable)
|
||||
* [redirections](./redirections)
|
||||
* [separators](./separators)
|
||||
* [tilde-expansion](./tilde-expansion)
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
# builtins
|
||||
|
||||
*[spec > bonuses](..) > builtins*
|
||||
|
||||
* [env](./env)
|
||||
|
|
@ -1,63 +0,0 @@
|
|||
# 001-unset-variables
|
||||
|
||||
*[spec > bonuses > builtins > env](..) > 001-unset-variables*
|
||||
|
||||
The purpose of this test is to check that the builtin `env` implement the option `-u` to unset environment variables.
|
||||
### What is done before test
|
||||
|
||||
```bash
|
||||
export TESTVARIABLE="${GLOBAL_TOKEN}"
|
||||
|
||||
```
|
||||
|
||||
### Shell commands that are sent to the standard entry
|
||||
|
||||
```bash
|
||||
env -u HOME -u PATH -u TESTVARIABLE ./display_env
|
||||
|
||||
```
|
||||
|
||||
### What is expected on standard output
|
||||
|
||||
```bash
|
||||
expected_to_not match_regex "HOME="
|
||||
expected_to_not match_regex "PATH="
|
||||
expected_to_not match_regex "TESTVARIABLE="
|
||||
|
||||
```
|
||||
|
||||
### What is expected on error output
|
||||
|
||||
```bash
|
||||
expected_to be_empty
|
||||
|
||||
```
|
||||
|
||||
### Variables
|
||||
|
||||
The following variables may appear in this test:
|
||||
|
||||
* ${**GLOBAL_INSTALLDIR**} -> The installation directory of 42ShellTester
|
||||
* ${**GLOBAL_TMP_DIRECTORY**} -> The temporary directory in which tests are executed
|
||||
* ${**GLOBAL_TOKEN**} -> A token that changes value at launch time
|
||||
* ${**PATH**} -> The standard environment variable PATH
|
||||
* ${**HOME**} -> The standard environment variable HOME
|
||||
|
||||
### Support binaries
|
||||
|
||||
The following binaries may appear in this test:
|
||||
|
||||
|
||||
* **[./create_file](http://github.com/we-sh/42ShellTester/tree/master/support/create-file)** -> A binary that creates file named argv[1] + "_FILE" If argv[1] is not set, the file is named "TOKEN_FILE"
|
||||
* **[./delete_file](http://github.com/we-sh/42ShellTester/tree/master/support/delete-file)** -> A binary that delete all files called in argument.
|
||||
* **[./display_env](http://github.com/we-sh/42ShellTester/tree/master/support/display-env)** -> A binary that iterates on `**envp` and write each element on standard output.
|
||||
* **[./display_program_name](http://github.com/we-sh/42ShellTester/tree/master/support/display-program-name)** -> A binary that writes its name on standard ouput.
|
||||
* **[./display_pwd](http://github.com/we-sh/42ShellTester/tree/master/support/display-pwd)** -> A binary that writes on standard output the absolute path of the current directory returned by `getcwd(3)`, encountered with the strings `PWD:` and `:PWD`.
|
||||
* **[./exit_with_status](http://github.com/we-sh/42ShellTester/tree/master/support/exit-with-status)** -> A binary that immediately exits with the status given as first argument.
|
||||
* **[./read_on_stdin](http://github.com/we-sh/42ShellTester/tree/master/support/read-on-stdin)** -> A binary that reads on standard entry and write each line on standard output suffixed with the character `@` (e.g. same behavior as `cat -e` and the *newline* character). When `read(2)` returns `-1`, then the string `STDIN READ ERROR` is written on standard error.
|
||||
* **[./sleep_and_exit_with_status](http://github.com/we-sh/42ShellTester/tree/master/support/sleep-and-exit-with-status)** -> A binary that sleeps for a duration in seconds given as first argument and then exits with status given as second argument.
|
||||
* **[./sleep_and_write_on_stderr](http://github.com/we-sh/42ShellTester/tree/master/support/sleep-and-write-on-stderr)** -> A binary that sleeps for a duration in seconds given as first argument and then writes on STDERR the string given as second argument without EOL.
|
||||
* **[./write_all_arguments_on_stdout](http://github.com/we-sh/42ShellTester/tree/master/support/write-all-arguments-on-stdout)** -> A binary that writes on standard output each argument separated by the symbol `@`. If no argument is given, it writes the string "nothing to be written on stdout".
|
||||
* **[./write_on_stderr](http://github.com/we-sh/42ShellTester/tree/master/support/write-on-stderr)** -> A binary that writes on standard error the first given argument (the same behavior as `echo` but with only one argument) and exits with an error status code given as second argument. If no argument is given, it writes the string "write on stderr" and exit with status `1`.
|
||||
* **[./write_on_stdout](http://github.com/we-sh/42ShellTester/tree/master/support/write-on-stdout)** -> A binary that writes on standard output the first given argument (the same behavior as `echo` but with only one argument). If no argument is given, it writes the string "write on stdout".
|
||||
* **[./write_on_stdout_and_stderr](http://github.com/we-sh/42ShellTester/tree/master/support/write-on-stdout-and-stderr)** -> A binary that writes on standard output the first given argument, and writes on standard error the second given argument. If an argument is missing, it writes the strings "write on stdout" and "write on stderr".
|
||||
|
|
@ -1 +0,0 @@
|
|||
export TESTVARIABLE="${GLOBAL_TOKEN}"
|
||||
|
|
@ -1 +0,0 @@
|
|||
The purpose of this test is to check that the builtin `env` implement the option `-u` to unset environment variables.
|
||||
|
|
@ -1 +0,0 @@
|
|||
`env -u` is not registered in the POSIX standard.
|
||||
|
|
@ -1 +0,0 @@
|
|||
expected_to be_empty
|
||||
|
|
@ -1 +0,0 @@
|
|||
env -u HOME -u PATH -u TESTVARIABLE ./display_env
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
expected_to_not match_regex "HOME="
|
||||
expected_to_not match_regex "PATH="
|
||||
expected_to_not match_regex "TESTVARIABLE="
|
||||
|
|
@ -1,63 +0,0 @@
|
|||
# 002-unset-and-set-variable
|
||||
|
||||
*[spec > bonuses > builtins > env](..) > 002-unset-and-set-variable*
|
||||
|
||||
The purpose of this test is to check if env -u works to unset variables for a given binary, we are also checking if an argument not prefix with -u is add to the environment of the given binary.### What is done before test
|
||||
|
||||
```bash
|
||||
# unset all environment variables except PATH
|
||||
for VARIABLE in $(env | awk 'BEGIN {FS="="} $0 !~ /^PATH/ {print $1}'); do unset "${VARIABLE}"; done;
|
||||
|
||||
export HOME="/my/home"
|
||||
|
||||
```
|
||||
|
||||
### Shell commands that are sent to the standard entry
|
||||
|
||||
```bash
|
||||
env -u HOME TESTVARIABLE=${GLOBAL_TOKEN} ./display_env
|
||||
|
||||
```
|
||||
|
||||
### What is expected on standard output
|
||||
|
||||
```bash
|
||||
expected_to match_regex "^TESTVARIABLE=${GLOBAL_TOKEN}$"
|
||||
expected_to_not match_regex "^HOME="
|
||||
|
||||
```
|
||||
|
||||
### What is expected on error output
|
||||
|
||||
```bash
|
||||
expected_to be_empty
|
||||
```
|
||||
|
||||
### Variables
|
||||
|
||||
The following variables may appear in this test:
|
||||
|
||||
* ${**GLOBAL_INSTALLDIR**} -> The installation directory of 42ShellTester
|
||||
* ${**GLOBAL_TMP_DIRECTORY**} -> The temporary directory in which tests are executed
|
||||
* ${**GLOBAL_TOKEN**} -> A token that changes value at launch time
|
||||
* ${**PATH**} -> The standard environment variable PATH
|
||||
* ${**HOME**} -> The standard environment variable HOME
|
||||
|
||||
### Support binaries
|
||||
|
||||
The following binaries may appear in this test:
|
||||
|
||||
|
||||
* **[./create_file](http://github.com/we-sh/42ShellTester/tree/master/support/create-file)** -> A binary that creates file named argv[1] + "_FILE" If argv[1] is not set, the file is named "TOKEN_FILE"
|
||||
* **[./delete_file](http://github.com/we-sh/42ShellTester/tree/master/support/delete-file)** -> A binary that delete all files called in argument.
|
||||
* **[./display_env](http://github.com/we-sh/42ShellTester/tree/master/support/display-env)** -> A binary that iterates on `**envp` and write each element on standard output.
|
||||
* **[./display_program_name](http://github.com/we-sh/42ShellTester/tree/master/support/display-program-name)** -> A binary that writes its name on standard ouput.
|
||||
* **[./display_pwd](http://github.com/we-sh/42ShellTester/tree/master/support/display-pwd)** -> A binary that writes on standard output the absolute path of the current directory returned by `getcwd(3)`, encountered with the strings `PWD:` and `:PWD`.
|
||||
* **[./exit_with_status](http://github.com/we-sh/42ShellTester/tree/master/support/exit-with-status)** -> A binary that immediately exits with the status given as first argument.
|
||||
* **[./read_on_stdin](http://github.com/we-sh/42ShellTester/tree/master/support/read-on-stdin)** -> A binary that reads on standard entry and write each line on standard output suffixed with the character `@` (e.g. same behavior as `cat -e` and the *newline* character). When `read(2)` returns `-1`, then the string `STDIN READ ERROR` is written on standard error.
|
||||
* **[./sleep_and_exit_with_status](http://github.com/we-sh/42ShellTester/tree/master/support/sleep-and-exit-with-status)** -> A binary that sleeps for a duration in seconds given as first argument and then exits with status given as second argument.
|
||||
* **[./sleep_and_write_on_stderr](http://github.com/we-sh/42ShellTester/tree/master/support/sleep-and-write-on-stderr)** -> A binary that sleeps for a duration in seconds given as first argument and then writes on STDERR the string given as second argument without EOL.
|
||||
* **[./write_all_arguments_on_stdout](http://github.com/we-sh/42ShellTester/tree/master/support/write-all-arguments-on-stdout)** -> A binary that writes on standard output each argument separated by the symbol `@`. If no argument is given, it writes the string "nothing to be written on stdout".
|
||||
* **[./write_on_stderr](http://github.com/we-sh/42ShellTester/tree/master/support/write-on-stderr)** -> A binary that writes on standard error the first given argument (the same behavior as `echo` but with only one argument) and exits with an error status code given as second argument. If no argument is given, it writes the string "write on stderr" and exit with status `1`.
|
||||
* **[./write_on_stdout](http://github.com/we-sh/42ShellTester/tree/master/support/write-on-stdout)** -> A binary that writes on standard output the first given argument (the same behavior as `echo` but with only one argument). If no argument is given, it writes the string "write on stdout".
|
||||
* **[./write_on_stdout_and_stderr](http://github.com/we-sh/42ShellTester/tree/master/support/write-on-stdout-and-stderr)** -> A binary that writes on standard output the first given argument, and writes on standard error the second given argument. If an argument is missing, it writes the strings "write on stdout" and "write on stderr".
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
# unset all environment variables except PATH
|
||||
for VARIABLE in $(env | awk 'BEGIN {FS="="} $0 !~ /^PATH/ {print $1}'); do unset "${VARIABLE}"; done;
|
||||
|
||||
export HOME="/my/home"
|
||||
|
|
@ -1 +0,0 @@
|
|||
The purpose of this test is to check if env -u works to unset variables for a given binary, we are also checking if an argument not prefix with -u is add to the environment of the given binary.
|
||||
|
|
@ -1 +0,0 @@
|
|||
expected_to be_empty
|
||||
|
|
@ -1 +0,0 @@
|
|||
env -u HOME TESTVARIABLE=${GLOBAL_TOKEN} ./display_env
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
expected_to match_regex "^TESTVARIABLE=${GLOBAL_TOKEN}$"
|
||||
expected_to_not match_regex "^HOME="
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
# env
|
||||
|
||||
*[spec > bonuses > builtins](..) > env*
|
||||
|
||||
* [001-unset-variables](./001-unset-variables)
|
||||
* [002-unset-and-set-variable](./002-unset-and-set-variable)
|
||||
|
|
@ -1,62 +0,0 @@
|
|||
# 001-modifies-child-environment-1
|
||||
|
||||
*[spec > bonuses > inline-environment-variable](..) > 001-modifies-child-environment-1*
|
||||
|
||||
The purpose of this test is to check that a binary may have its environment to be modified by appending variables inline.
|
||||
### What is done before test
|
||||
|
||||
```bash
|
||||
unset "${GLOBAL_TOKEN}_VARIABLE"
|
||||
|
||||
```
|
||||
|
||||
### Shell commands that are sent to the standard entry
|
||||
|
||||
```bash
|
||||
${GLOBAL_TOKEN}_VARIABLE=${GLOBAL_TOKEN}_VALUE ./display_env
|
||||
./display_env
|
||||
|
||||
```
|
||||
|
||||
### What is expected on standard output
|
||||
|
||||
```bash
|
||||
expected_to match_regex "^${GLOBAL_TOKEN}_VARIABLE=${GLOBAL_TOKEN}_VALUE$" once
|
||||
|
||||
```
|
||||
|
||||
### What is expected on error output
|
||||
|
||||
```bash
|
||||
expected_to be_empty
|
||||
|
||||
```
|
||||
|
||||
### Variables
|
||||
|
||||
The following variables may appear in this test:
|
||||
|
||||
* ${**GLOBAL_INSTALLDIR**} -> The installation directory of 42ShellTester
|
||||
* ${**GLOBAL_TMP_DIRECTORY**} -> The temporary directory in which tests are executed
|
||||
* ${**GLOBAL_TOKEN**} -> A token that changes value at launch time
|
||||
* ${**PATH**} -> The standard environment variable PATH
|
||||
* ${**HOME**} -> The standard environment variable HOME
|
||||
|
||||
### Support binaries
|
||||
|
||||
The following binaries may appear in this test:
|
||||
|
||||
|
||||
* **[./create_file](http://github.com/we-sh/42ShellTester/tree/master/support/create-file)** -> A binary that creates file named argv[1] + "_FILE" If argv[1] is not set, the file is named "TOKEN_FILE"
|
||||
* **[./delete_file](http://github.com/we-sh/42ShellTester/tree/master/support/delete-file)** -> A binary that delete all files called in argument.
|
||||
* **[./display_env](http://github.com/we-sh/42ShellTester/tree/master/support/display-env)** -> A binary that iterates on `**envp` and write each element on standard output.
|
||||
* **[./display_program_name](http://github.com/we-sh/42ShellTester/tree/master/support/display-program-name)** -> A binary that writes its name on standard ouput.
|
||||
* **[./display_pwd](http://github.com/we-sh/42ShellTester/tree/master/support/display-pwd)** -> A binary that writes on standard output the absolute path of the current directory returned by `getcwd(3)`, encountered with the strings `PWD:` and `:PWD`.
|
||||
* **[./exit_with_status](http://github.com/we-sh/42ShellTester/tree/master/support/exit-with-status)** -> A binary that immediately exits with the status given as first argument.
|
||||
* **[./read_on_stdin](http://github.com/we-sh/42ShellTester/tree/master/support/read-on-stdin)** -> A binary that reads on standard entry and write each line on standard output suffixed with the character `@` (e.g. same behavior as `cat -e` and the *newline* character). When `read(2)` returns `-1`, then the string `STDIN READ ERROR` is written on standard error.
|
||||
* **[./sleep_and_exit_with_status](http://github.com/we-sh/42ShellTester/tree/master/support/sleep-and-exit-with-status)** -> A binary that sleeps for a duration in seconds given as first argument and then exits with status given as second argument.
|
||||
* **[./sleep_and_write_on_stderr](http://github.com/we-sh/42ShellTester/tree/master/support/sleep-and-write-on-stderr)** -> A binary that sleeps for a duration in seconds given as first argument and then writes on STDERR the string given as second argument without EOL.
|
||||
* **[./write_all_arguments_on_stdout](http://github.com/we-sh/42ShellTester/tree/master/support/write-all-arguments-on-stdout)** -> A binary that writes on standard output each argument separated by the symbol `@`. If no argument is given, it writes the string "nothing to be written on stdout".
|
||||
* **[./write_on_stderr](http://github.com/we-sh/42ShellTester/tree/master/support/write-on-stderr)** -> A binary that writes on standard error the first given argument (the same behavior as `echo` but with only one argument) and exits with an error status code given as second argument. If no argument is given, it writes the string "write on stderr" and exit with status `1`.
|
||||
* **[./write_on_stdout](http://github.com/we-sh/42ShellTester/tree/master/support/write-on-stdout)** -> A binary that writes on standard output the first given argument (the same behavior as `echo` but with only one argument). If no argument is given, it writes the string "write on stdout".
|
||||
* **[./write_on_stdout_and_stderr](http://github.com/we-sh/42ShellTester/tree/master/support/write-on-stdout-and-stderr)** -> A binary that writes on standard output the first given argument, and writes on standard error the second given argument. If an argument is missing, it writes the strings "write on stdout" and "write on stderr".
|
||||
|
|
@ -1 +0,0 @@
|
|||
unset "${GLOBAL_TOKEN}_VARIABLE"
|
||||
|
|
@ -1 +0,0 @@
|
|||
The purpose of this test is to check that a binary may have its environment to be modified by appending variables inline.
|
||||
|
|
@ -1 +0,0 @@
|
|||
expected_to be_empty
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
${GLOBAL_TOKEN}_VARIABLE=${GLOBAL_TOKEN}_VALUE ./display_env
|
||||
./display_env
|
||||
|
|
@ -1 +0,0 @@
|
|||
expected_to match_regex "^${GLOBAL_TOKEN}_VARIABLE=${GLOBAL_TOKEN}_VALUE$" once
|
||||
|
|
@ -1,64 +0,0 @@
|
|||
# 002-modifies-child-environment-2
|
||||
|
||||
*[spec > bonuses > inline-environment-variable](..) > 002-modifies-child-environment-2*
|
||||
|
||||
The purpose of this test is to check that a binary may have its environment to be modified by appending variables inline.
|
||||
### What is done before test
|
||||
|
||||
```bash
|
||||
unset "${GLOBAL_TOKEN}_VARIABLE"
|
||||
|
||||
```
|
||||
|
||||
### Shell commands that are sent to the standard entry
|
||||
|
||||
```bash
|
||||
${GLOBAL_TOKEN}_VARIABLE1=${GLOBAL_TOKEN}_VALUE1 ${GLOBAL_TOKEN}_VARIABLE2=${GLOBAL_TOKEN}_VALUE2 ${GLOBAL_TOKEN}_VARIABLE3=${GLOBAL_TOKEN}_VALUE3 ./display_env
|
||||
./display_env
|
||||
|
||||
```
|
||||
|
||||
### What is expected on standard output
|
||||
|
||||
```bash
|
||||
expected_to match_regex "^${GLOBAL_TOKEN}_VARIABLE1=${GLOBAL_TOKEN}_VALUE1$" once
|
||||
expected_to match_regex "^${GLOBAL_TOKEN}_VARIABLE2=${GLOBAL_TOKEN}_VALUE2$" once
|
||||
expected_to match_regex "^${GLOBAL_TOKEN}_VARIABLE3=${GLOBAL_TOKEN}_VALUE3$" once
|
||||
|
||||
```
|
||||
|
||||
### What is expected on error output
|
||||
|
||||
```bash
|
||||
expected_to be_empty
|
||||
|
||||
```
|
||||
|
||||
### Variables
|
||||
|
||||
The following variables may appear in this test:
|
||||
|
||||
* ${**GLOBAL_INSTALLDIR**} -> The installation directory of 42ShellTester
|
||||
* ${**GLOBAL_TMP_DIRECTORY**} -> The temporary directory in which tests are executed
|
||||
* ${**GLOBAL_TOKEN**} -> A token that changes value at launch time
|
||||
* ${**PATH**} -> The standard environment variable PATH
|
||||
* ${**HOME**} -> The standard environment variable HOME
|
||||
|
||||
### Support binaries
|
||||
|
||||
The following binaries may appear in this test:
|
||||
|
||||
|
||||
* **[./create_file](http://github.com/we-sh/42ShellTester/tree/master/support/create-file)** -> A binary that creates file named argv[1] + "_FILE" If argv[1] is not set, the file is named "TOKEN_FILE"
|
||||
* **[./delete_file](http://github.com/we-sh/42ShellTester/tree/master/support/delete-file)** -> A binary that delete all files called in argument.
|
||||
* **[./display_env](http://github.com/we-sh/42ShellTester/tree/master/support/display-env)** -> A binary that iterates on `**envp` and write each element on standard output.
|
||||
* **[./display_program_name](http://github.com/we-sh/42ShellTester/tree/master/support/display-program-name)** -> A binary that writes its name on standard ouput.
|
||||
* **[./display_pwd](http://github.com/we-sh/42ShellTester/tree/master/support/display-pwd)** -> A binary that writes on standard output the absolute path of the current directory returned by `getcwd(3)`, encountered with the strings `PWD:` and `:PWD`.
|
||||
* **[./exit_with_status](http://github.com/we-sh/42ShellTester/tree/master/support/exit-with-status)** -> A binary that immediately exits with the status given as first argument.
|
||||
* **[./read_on_stdin](http://github.com/we-sh/42ShellTester/tree/master/support/read-on-stdin)** -> A binary that reads on standard entry and write each line on standard output suffixed with the character `@` (e.g. same behavior as `cat -e` and the *newline* character). When `read(2)` returns `-1`, then the string `STDIN READ ERROR` is written on standard error.
|
||||
* **[./sleep_and_exit_with_status](http://github.com/we-sh/42ShellTester/tree/master/support/sleep-and-exit-with-status)** -> A binary that sleeps for a duration in seconds given as first argument and then exits with status given as second argument.
|
||||
* **[./sleep_and_write_on_stderr](http://github.com/we-sh/42ShellTester/tree/master/support/sleep-and-write-on-stderr)** -> A binary that sleeps for a duration in seconds given as first argument and then writes on STDERR the string given as second argument without EOL.
|
||||
* **[./write_all_arguments_on_stdout](http://github.com/we-sh/42ShellTester/tree/master/support/write-all-arguments-on-stdout)** -> A binary that writes on standard output each argument separated by the symbol `@`. If no argument is given, it writes the string "nothing to be written on stdout".
|
||||
* **[./write_on_stderr](http://github.com/we-sh/42ShellTester/tree/master/support/write-on-stderr)** -> A binary that writes on standard error the first given argument (the same behavior as `echo` but with only one argument) and exits with an error status code given as second argument. If no argument is given, it writes the string "write on stderr" and exit with status `1`.
|
||||
* **[./write_on_stdout](http://github.com/we-sh/42ShellTester/tree/master/support/write-on-stdout)** -> A binary that writes on standard output the first given argument (the same behavior as `echo` but with only one argument). If no argument is given, it writes the string "write on stdout".
|
||||
* **[./write_on_stdout_and_stderr](http://github.com/we-sh/42ShellTester/tree/master/support/write-on-stdout-and-stderr)** -> A binary that writes on standard output the first given argument, and writes on standard error the second given argument. If an argument is missing, it writes the strings "write on stdout" and "write on stderr".
|
||||