332 lines
14 KiB
Text
332 lines
14 KiB
Text
[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[1;33m~[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;34m.[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[1;33m~[0m[31m[38;5;34m.[0m[31m[1;33m~[0m[31m[38;5;34m.[0m[31m[1;33m~[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;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;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
|
||
|
||
----------------------------------------------------------------
|
||
|
||
[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 "TOKEN201703242314"[0m
|
||
|
||
STDOUT:
|
||
[31m[38;5;160m FAILURE expected_to match_regex `TOKEN201703242314`[0m
|
||
[38;5;239m (no output)[0m
|
||
|
||
STDERR:
|
||
[31m[38;5;160m FAILURE expected_to be_empty[0m
|
||
[38;5;239m 01: ../../42sh: command not found: write_on_stdout[0m
|
||
|
||
MISC:
|
||
[31m[38;5;160m FAILURE expected_to exit_with_status `0`[0m
|
||
|
||
----------------------------------------------------------------
|
||
|
||
[37;1mminishell/binary/008-binary-too-many-symbolic-links-encountered[0m [31m[1;33m(WARNING)[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: ../../42sh: ./symbolic_link1: no such file or directory[0m
|
||
|
||
MISC:
|
||
[31m[38;5;34m SUCCESS expected_to_not exit_with_status 0[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/42ShellTester/tmp/display_pwd
|
||
03: /Users/ariard/Projects/42sh/42ShellTester/tmp/display_env[0m
|
||
|
||
STDOUT:
|
||
[31m[38;5;34m SUCCESS expected_to match_regex `PWD:/Users/ariard/Projects/42sh/42ShellTester/tmp/sub_directory:PWD$`[0m
|
||
[31m[38;5;160m FAILURE expected_to match_regex `^PWD=/Users/ariard/Projects/42sh/42ShellTester/tmp/symbolic_link$`[0m
|
||
[38;5;239m 01: PWD:/Users/ariard/Projects/42sh/42ShellTester/tmp/sub_directory:PWD
|
||
02: ------------------------------
|
||
03: TERM_PROGRAM=iTerm.app
|
||
04: TERM=screen-256color
|
||
05: SHELL=/bin/zsh
|
||
06: HOMEBREW_TEMP=/tmp/ariard/Homebrew/Temp
|
||
07: TMPDIR=/var/folders/zz/zyxvpxvq6csfxvn_n0002_2m000khn/T/
|
||
08: Apple_PubSub_Socket_Render=/private/tmp/com.apple.launchd.UJksyURLXc/Render
|
||
09: TERM_PROGRAM_VERSION=3.0.10
|
||
10: TERM_SESSION_ID=w0t0p0:162D7F62-BEB1-405A-B3D5-E18A8A96E577
|
||
11: ZSH=/Users/ariard/.oh-my-zsh
|
||
12: USER=ariard
|
||
13: SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.zEo8Maujhn/Listeners
|
||
14: __CF_USER_TEXT_ENCODING=0x4A15:0x0:0x0
|
||
15: PAGER=less
|
||
16: TMUX=/private/tmp/tmux-18965/default,22653,2
|
||
17: HOMEBREW_CACHE=/tmp/ariard/Homebrew/Caches
|
||
18: LSCOLORS=Gxfxcxdxbxegedabagacad
|
||
19: PATH=/Users/ariard/.brew/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/munki://Users/ariard/local/bin
|
||
20: MAIL=ariard@student.42.fr
|
||
21: PWD=/Users/ariard/Projects/42sh/42ShellTester/tmp/sub_directory
|
||
22: LANG=en_US.UTF-8
|
||
23: ITERM_PROFILE=Default
|
||
24: XPC_FLAGS=0x0
|
||
25: TMUX_PANE=%9
|
||
26: XPC_SERVICE_NAME=0
|
||
27: SHLVL=4
|
||
28: HOME=/Users/ariard
|
||
29: COLORFGBG=7;0
|
||
30: ITERM_SESSION_ID=w0t0p0:162D7F62-BEB1-405A-B3D5-E18A8A96E577
|
||
31: LOGNAME=ariard
|
||
32: LESS=-R
|
||
33: LC_CTYPE=en_US.UTF-8
|
||
34: TMUX_PLUGIN_MANAGER_PATH=/Users/ariard/.tmux/plugins/
|
||
35: OLDPWD=/Users/ariard/Projects/42sh/42ShellTester/tmp
|
||
36: _=../../42sh
|
||
37: ?=0
|
||
38: ------------------------------
|
||
39: TOTAL ENVIRONMENT VARIABLES: 35[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/42ShellTester/tmp/display_pwd
|
||
03: /Users/ariard/Projects/42sh/42ShellTester/tmp/display_env[0m
|
||
|
||
STDOUT:
|
||
[31m[38;5;34m SUCCESS expected_to match_regex `PWD:/Users/ariard/Projects/42sh/42ShellTester/tmp/sub_directory:PWD$`[0m
|
||
[31m[38;5;160m FAILURE expected_to match_regex `^PWD=/Users/ariard/Projects/42sh/42ShellTester/tmp/symbolic_link2$`[0m
|
||
[38;5;239m 01: PWD:/Users/ariard/Projects/42sh/42ShellTester/tmp/sub_directory:PWD
|
||
02: ------------------------------
|
||
03: TERM_PROGRAM=iTerm.app
|
||
04: TERM=screen-256color
|
||
05: SHELL=/bin/zsh
|
||
06: HOMEBREW_TEMP=/tmp/ariard/Homebrew/Temp
|
||
07: TMPDIR=/var/folders/zz/zyxvpxvq6csfxvn_n0002_2m000khn/T/
|
||
08: Apple_PubSub_Socket_Render=/private/tmp/com.apple.launchd.UJksyURLXc/Render
|
||
09: TERM_PROGRAM_VERSION=3.0.10
|
||
10: TERM_SESSION_ID=w0t0p0:162D7F62-BEB1-405A-B3D5-E18A8A96E577
|
||
11: ZSH=/Users/ariard/.oh-my-zsh
|
||
12: USER=ariard
|
||
13: SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.zEo8Maujhn/Listeners
|
||
14: __CF_USER_TEXT_ENCODING=0x4A15:0x0:0x0
|
||
15: PAGER=less
|
||
16: TMUX=/private/tmp/tmux-18965/default,22653,2
|
||
17: HOMEBREW_CACHE=/tmp/ariard/Homebrew/Caches
|
||
18: LSCOLORS=Gxfxcxdxbxegedabagacad
|
||
19: PATH=/Users/ariard/.brew/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/munki://Users/ariard/local/bin
|
||
20: MAIL=ariard@student.42.fr
|
||
21: PWD=/Users/ariard/Projects/42sh/42ShellTester/tmp/sub_directory
|
||
22: LANG=en_US.UTF-8
|
||
23: ITERM_PROFILE=Default
|
||
24: XPC_FLAGS=0x0
|
||
25: TMUX_PANE=%9
|
||
26: XPC_SERVICE_NAME=0
|
||
27: SHLVL=4
|
||
28: HOME=/Users/ariard
|
||
29: COLORFGBG=7;0
|
||
30: ITERM_SESSION_ID=w0t0p0:162D7F62-BEB1-405A-B3D5-E18A8A96E577
|
||
31: LOGNAME=ariard
|
||
32: LESS=-R
|
||
33: LC_CTYPE=en_US.UTF-8
|
||
34: TMUX_PLUGIN_MANAGER_PATH=/Users/ariard/.tmux/plugins/
|
||
35: OLDPWD=/Users/ariard/Projects/42sh/42ShellTester/tmp
|
||
36: _=../../42sh
|
||
37: ?=0
|
||
38: ------------------------------
|
||
39: TOTAL ENVIRONMENT VARIABLES: 35[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[1;33m(WARNING)[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/42ShellTester/tmp/display_pwd[0m
|
||
|
||
STDOUT:
|
||
[31m[38;5;34m SUCCESS expected_to match_regex `PWD:/Users/ariard/Projects/42sh/42ShellTester/tmp:PWD`[0m
|
||
[38;5;239m 01: PWD:/Users/ariard/Projects/42sh/42ShellTester/tmp:PWD[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: ../../42sh: cd: no such file or directory: not_a_directory[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/42ShellTester/tmp/display_pwd[0m
|
||
|
||
STDOUT:
|
||
[31m[38;5;34m SUCCESS expected_to match_regex `PWD:/Users/ariard/Projects/42sh/42ShellTester/tmp:PWD`[0m
|
||
[38;5;239m 01: PWD:/Users/ariard/Projects/42sh/42ShellTester/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: ../../42sh: 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/005-too-many-symbolic-links-encountered[0m [31m[1;33m(WARNING)[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/42ShellTester/tmp/display_pwd[0m
|
||
|
||
STDOUT:
|
||
[31m[38;5;34m SUCCESS expected_to match_regex `PWD:/Users/ariard/Projects/42sh/42ShellTester/tmp:PWD`[0m
|
||
[38;5;239m 01: PWD:/Users/ariard/Projects/42sh/42ShellTester/tmp:PWD[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: ../../42sh: cd: no such file or directory: symbolic_link1[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/42ShellTester/tmp/display_pwd[0m
|
||
|
||
STDOUT:
|
||
[31m[38;5;160m FAILURE expected_to match_regex `PWD:/Users/ariard/Projects/42sh/42ShellTester/tmp:PWD`[0m
|
||
[38;5;239m 01: /Users/ariard
|
||
02: PWD:/Users/ariard:PWD[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;34m SUCCESS expected_to_not be_empty[0m
|
||
[31m[1;33m WARNING might match_regex `[Cc]ommand not found`[0m
|
||
[38;5;239m 01: ../../42sh: env: ./invalid_binary: No such file or directory[0m
|
||
|
||
MISC:
|
||
[31m[38;5;160m FAILURE expected_to_not exit_with_status `0`[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 TOKEN201703242314[0m
|
||
|
||
STDOUT:
|
||
[31m[38;5;160m FAILURE expected_to match_regex `TOKEN201703242314`[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
|
||
|
||
Total tests: 54
|
||
Total failed tests: 6
|
||
Total pending tests: 0
|