21 KiB
21 KiB
...x...~......xx....~.~.~..........xxx....xxx...~.xxx.
----------------------------------------------------------------
minishell/binary/004-binary-test-empty-path (FAILED)
Description:
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.
Before test:
01: export PATH=""
STDIN:
01: write_on_stdout "TOKEN201703241735"
STDOUT:
FAILURE expected_to match_regex `TOKEN201703241735`
(no output)
STDERR:
FAILURE expected_to be_empty
01: ../../42sh: command not found: write_on_stdout
MISC:
FAILURE expected_to exit_with_status `0`
----------------------------------------------------------------
minishell/binary/008-binary-too-many-symbolic-links-encountered (WARNING)
Description:
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.
Before test:
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
STDIN:
01: ./symbolic_link1
STDOUT:
SUCCESS might be_empty
(no output)
STDERR:
SUCCESS expected_to_not be_empty
WARNING might match_regex `[Tt]oo many.*symbolic links`
01: ../../42sh: ./symbolic_link1: no such file or directory
MISC:
SUCCESS expected_to_not exit_with_status 0
----------------------------------------------------------------
minishell/builtins/cd/007-symbolic-link (FAILED)
Description:
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.
Before test:
01: rm -f "./symbolic_link"
02: mkdir -p "./sub_directory"
03: ln -s "./sub_directory" "./symbolic_link"
STDIN:
01: cd symbolic_link
02: /Users/ariard/Projects/42sh/42ShellTester/tmp/display_pwd
03: /Users/ariard/Projects/42sh/42ShellTester/tmp/display_env
STDOUT:
SUCCESS expected_to match_regex `PWD:/Users/ariard/Projects/42sh/42ShellTester/tmp/sub_directory:PWD$`
FAILURE expected_to match_regex `^PWD=/Users/ariard/Projects/42sh/42ShellTester/tmp/symbolic_link$`
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.LmcFivfwkY/Render
09: TERM_PROGRAM_VERSION=3.0.10
10: TERM_SESSION_ID=w0t0p1:D3D230F7-7E75-4A5C-B793-6A5C4DAD3F83
11: ZSH=/Users/ariard/.oh-my-zsh
12: USER=ariard
13: SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.u4JR4EZzBG/Listeners
14: __CF_USER_TEXT_ENCODING=0x4A15:0x0:0x0
15: PAGER=less
16: TMUX=/private/tmp/tmux-18965/default,73780,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=w0t0p1:D3D230F7-7E75-4A5C-B793-6A5C4DAD3F83
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
STDERR:
SUCCESS expected_to be_empty
(no output)
----------------------------------------------------------------
minishell/builtins/cd/008-symbolic-link-2 (FAILED)
Description:
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.
Before test:
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"
STDIN:
01: cd symbolic_link2
02: /Users/ariard/Projects/42sh/42ShellTester/tmp/display_pwd
03: /Users/ariard/Projects/42sh/42ShellTester/tmp/display_env
STDOUT:
SUCCESS expected_to match_regex `PWD:/Users/ariard/Projects/42sh/42ShellTester/tmp/sub_directory:PWD$`
FAILURE expected_to match_regex `^PWD=/Users/ariard/Projects/42sh/42ShellTester/tmp/symbolic_link2$`
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.LmcFivfwkY/Render
09: TERM_PROGRAM_VERSION=3.0.10
10: TERM_SESSION_ID=w0t0p1:D3D230F7-7E75-4A5C-B793-6A5C4DAD3F83
11: ZSH=/Users/ariard/.oh-my-zsh
12: USER=ariard
13: SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.u4JR4EZzBG/Listeners
14: __CF_USER_TEXT_ENCODING=0x4A15:0x0:0x0
15: PAGER=less
16: TMUX=/private/tmp/tmux-18965/default,73780,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=w0t0p1:D3D230F7-7E75-4A5C-B793-6A5C4DAD3F83
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
STDERR:
SUCCESS expected_to be_empty
(no output)
----------------------------------------------------------------
minishell/builtins/cd/errors/001-not-a-directory (WARNING)
Description:
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.
Before test:
01: touch "./not_a_directory"
STDIN:
01: cd not_a_directory
02: /Users/ariard/Projects/42sh/42ShellTester/tmp/display_pwd
STDOUT:
SUCCESS expected_to match_regex `PWD:/Users/ariard/Projects/42sh/42ShellTester/tmp:PWD`
01: PWD:/Users/ariard/Projects/42sh/42ShellTester/tmp:PWD
STDERR:
SUCCESS expected_to_not be_empty
WARNING might match_regex `[Nn]ot a directory`
01: ../../42sh: cd: no such file or directory: not_a_directory
----------------------------------------------------------------
minishell/builtins/cd/errors/003-permission-denied (WARNING)
Description:
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.
Before test:
01: if [ -d "./permission_denied" ]; then chmod 777 "./permission_denied"; fi
02: rm -rf "./permission_denied"
03: mkdir -m 0 "./permission_denied"
STDIN:
01: cd permission_denied
02: /Users/ariard/Projects/42sh/42ShellTester/tmp/display_pwd
STDOUT:
SUCCESS expected_to match_regex `PWD:/Users/ariard/Projects/42sh/42ShellTester/tmp:PWD`
01: PWD:/Users/ariard/Projects/42sh/42ShellTester/tmp:PWD
STDERR:
SUCCESS expected_to_not be_empty
WARNING might match_regex `[Pp]ermission denied`
01: ../../42sh: cd: no such file or directory: permission_denied
After test:
01: if [ -d "./permission_denied" ]; then chmod 777 "./permission_denied"; fi
02: rm -rf "./permission_denied"
----------------------------------------------------------------
minishell/builtins/cd/errors/005-too-many-symbolic-links-encountered (WARNING)
Description:
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.
Before test:
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"
STDIN:
01: cd symbolic_link1
02: /Users/ariard/Projects/42sh/42ShellTester/tmp/display_pwd
STDOUT:
SUCCESS expected_to match_regex `PWD:/Users/ariard/Projects/42sh/42ShellTester/tmp:PWD`
01: PWD:/Users/ariard/Projects/42sh/42ShellTester/tmp:PWD
STDERR:
SUCCESS expected_to_not be_empty
WARNING might match_regex `[Tt]oo many.*symbolic links`
01: ../../42sh: cd: no such file or directory: symbolic_link1
----------------------------------------------------------------
minishell/builtins/env/005-set-variables (FAILED)
Description:
The purpose of this test is to check that the builtin `env` can modify or set multiple environment variables before executing the given command.
Before test:
01: export VARTEST1="OLD_VALUE"
STDIN:
01: env VARTEST1=TOKEN201703241735_1 VARTEST2=TOKEN201703241735_2 VARTEST3=TOKEN201703241735_3 ./display_env
STDOUT:
FAILURE expected_to match_regex `VARTEST1=TOKEN201703241735_1`
FAILURE expected_to match_regex `VARTEST2=TOKEN201703241735_2`
FAILURE expected_to match_regex `VARTEST3=TOKEN201703241735_3`
(no output)
STDERR:
FAILURE expected_to be_empty
01: ../../42sh: env: VARTEST1=TOKEN201703241735_1: No such file or directory
----------------------------------------------------------------
minishell/builtins/env/errors/001-command-not-found (FAILED)
Description:
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.
Before test:
01: rm -f "./invalid_binary"
STDIN:
01: env ./invalid_binary
STDOUT:
(no output)
STDERR:
SUCCESS expected_to_not be_empty
WARNING might match_regex `[Cc]ommand not found`
01: ../../42sh: env: ./invalid_binary: No such file or directory
MISC:
FAILURE expected_to_not exit_with_status `0`
----------------------------------------------------------------
minishell/builtins/env/errors/002-illegal-option (FAILED)
Description:
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.
Before test:
01: rm -f -- "-w"
STDIN:
01: env -w
STDOUT:
(no output)
STDERR:
SUCCESS expected_to_not be_empty
SUCCESS might match_regex `([Ii]nvalid|[Ii]llegal) (option|argument)`
01: env: invalid option -w
02: ../../42sh: usage: env [-i] [name=value]... [utility [argument...]]
MISC:
FAILURE expected_to_not exit_with_status `0`
----------------------------------------------------------------
minishell/builtins/exit/errors/001-too-many-args (FAILED)
Description:
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.
STDIN:
01: exit 21 42
02: ./write_on_stdout TOKEN201703241735
STDOUT:
FAILURE expected_to match_regex `TOKEN201703241735`
(no output)
STDERR:
FAILURE expected_to_not be_empty
WARNING might match_regex `([Tt]oo many arguments|[Aa]rgument list too long)`
(no output)
MISC:
FAILURE expected_to exit_with_status `0`
----------------------------------------------------------------
minishell/builtins/exit/errors/002-non-numeric-argument (FAILED)
Description:
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.
STDIN:
01: exit abc
02: ./write_on_stdout TOKEN201703241735
STDOUT:
SUCCESS expected_to_not match_regex `TOKEN201703241735`
(no output)
STDERR:
SUCCESS might_not be_empty
SUCCESS might match_regex `[Nn]umeric argument required`
01: ../../42sh: exit: numeric argument required
MISC:
FAILURE expected_to_not exit_with_status `0`
----------------------------------------------------------------
minishell/builtins/mixed/001-setenv-unsetenv (FAILED)
Description:
The purpose of this test is to check that setting and unsetting environment variable with the builtins `setenv` and `unsetenv` (or `export` and `unset`) works together.
Before test:
01: # unset all environment variables
02: for VARIABLE in $(env | awk 'BEGIN {FS="="} {print $1}'); do unset "${VARIABLE}"; done;
STDIN:
01: setenv TEST1
02: setenv TEST2
03: unsetenv TEST1
04: unsetenv TEST2
05: ./display_env
06:
07: export TEST1
08: export TEST2
09: unset TEST1
10: unset TEST2
11: ./display_env
STDOUT:
FAILURE expected_to_not match_regex `TEST1=`
FAILURE expected_to_not match_regex `TEST2=`
01: ------------------------------
02: _=../../42sh
03: ?=0
04: SHLVL=1
05: TEST1=
06: TEST2=
07: ------------------------------
08: TOTAL ENVIRONMENT VARIABLES: 5
09: ------------------------------
10: _=../../42sh
11: ?=0
12: SHLVL=1
13: TEST1=
14: TEST2=
15: ------------------------------
16: TOTAL ENVIRONMENT VARIABLES: 5
STDERR:
(no output)
----------------------------------------------------------------
minishell/builtins/setenv/004-invalid-identifier (WARNING)
Description:
The purpose of this test is to check that using a wrong variable name with the builtin `setenv` (or `export`) results in error.
STDIN:
01: setenv 42
02: export 42
STDOUT:
SUCCESS might be_empty
(no output)
STDERR:
SUCCESS expected_to_not be_empty
WARNING might match_regex `(not.*identifier|must begin.*letter)`
01: ../../42sh: setenv: 42: invalid variable name
02: ../../42sh: export: 42: invalid variable name
----------------------------------------------------------------
minishell/builtins/unsetenv/001-unsetenv-first-elem (FAILED)
Description:
This test was made to control if the Head of the env list was set correctly.
So we unset all the environment variables inside the tester environment and set a new one.
Thereafter we are unseting inside the tested shell. We are using env to check if the last head was remove correctly.
Before test:
01: # unset all environment variables
02: for VARIABLE in $(env | awk 'BEGIN {FS="="} {print $1}'); do unset "${VARIABLE}"; done;
03:
04: export VARTEST="TOKEN201703241735"
STDIN:
01: unsetenv VARTEST
02: unset VARTEST
03: ./display_env
STDOUT:
FAILURE expected_to_not match_regex `VARTEST=`
01: ------------------------------
02: VARTEST=TOKEN201703241735
03: _=../../42sh
04: ?=0
05: SHLVL=1
06: ------------------------------
07: TOTAL ENVIRONMENT VARIABLES: 4
STDERR:
(no output)
----------------------------------------------------------------
minishell/builtins/unsetenv/002-unsetenv-mult-envp (FAILED)
Description:
This test was made to check if we can unset multiple arguments.
So we unset all the environment variables inside the tester environment and set a 3 new variables.
Thereafter we are unseting all of them inside the tested shell.
Before test:
01: # unset all environment ariables
02: for VARIABLE in $(env | awk 'BEGIN {FS="="} {print $1}'); do unset "${VARIABLE}"; done;
03:
04: export ONE="TOKEN201703241735_1"
05: export TWO="TOKEN201703241735_2"
06: export THREE="TOKEN201703241735_3"
STDIN:
01: unsetenv ONE
02: unsetenv TWO
03: unsetenv THREE
04: unset ONE
05: unset TWO
06: unset THREE
07: ./display_env
STDOUT:
SUCCESS expected_to_not match_regex `ONE=`
SUCCESS expected_to_not match_regex `TWO=`
FAILURE expected_to_not match_regex `THREE=`
01: ------------------------------
02: THREE=TOKEN201703241735_3
03: _=../../42sh
04: ?=0
05: SHLVL=1
06: ------------------------------
07: TOTAL ENVIRONMENT VARIABLES: 4
STDERR:
(no output)
----------------------------------------------------------------
minishell/builtins/unsetenv/003-unsetenv-mult-envp-inline (FAILED)
Description:
This test was made to check if we can unset multiple arguments INLINE.
So we unset all the environment variables inside the tester environment and set a 3 new variables.
Thereafter we are unseting all of them INLINE inside the tested shell.
Before test:
01: # unset all variables
02: for VARIABLE in $(env | awk 'BEGIN {FS="="} {print $1}'); do unset "${VARIABLE}"; done;
03:
04: export ONE="TOKEN201703241735_1"
05: export TWO="TOKEN201703241735_2"
06: export THREE="TOKEN201703241735_3"
STDIN:
01: unsetenv ONE TWO THREE
02: unset ONE TWO THREE
03: ./display_env
STDOUT:
SUCCESS expected_to_not match_regex `ONE=`
FAILURE expected_to_not match_regex `TWO=`
FAILURE expected_to_not match_regex `THREE=`
01: ------------------------------
02: THREE=TOKEN201703241735_3
03: TWO=TOKEN201703241735_2
04: _=../../42sh
05: ?=0
06: SHLVL=1
07: ------------------------------
08: TOTAL ENVIRONMENT VARIABLES: 5
STDERR:
(no output)
Total tests: 54
Total failed tests: 12
Total pending tests: 0
----------------------------------------------------------------
minishell/binary/004-binary-test-empty-path (FAILED)
Description:
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.
Before test:
01: export PATH=""
STDIN:
01: write_on_stdout "TOKEN201703241735"
STDOUT:
FAILURE expected_to match_regex `TOKEN201703241735`
(no output)
STDERR:
FAILURE expected_to be_empty
01: ../../42sh: command not found: write_on_stdout
MISC:
FAILURE expected_to exit_with_status `0`
----------------------------------------------------------------
minishell/binary/008-binary-too-many-symbolic-links-encountered (WARNING)
Description:
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.
Before test:
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
STDIN:
01: ./symbolic_link1
STDOUT:
SUCCESS might be_empty
(no output)
STDERR:
SUCCESS expected_to_not be_empty
WARNING might match_regex `[Tt]oo many.*symbolic links`
01: ../../42sh: ./symbolic_link1: no such file or directory
MISC:
SUCCESS expected_to_not exit_with_status 0
----------------------------------------------------------------
minishell/builtins/cd/007-symbolic-link (FAILED)
Description:
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.
Before test:
01: rm -f "./symbolic_link"
02: mkdir -p "./sub_directory"
03: ln -s "./sub_directory" "./symbolic_link"
STDIN:
01: cd symbolic_link
02: /Users/ariard/Projects/42sh/42ShellTester/tmp/display_pwd
03: /Users/ariard/Projects/42sh/42ShellTester/tmp/display_env
STDOUT:
SUCCESS expected_to match_regex `PWD:/Users/ariard/Projects/42sh/42ShellTester/tmp/sub_directory:PWD$`
FAILURE expected_to match_regex `^PWD=/Users/ariard/Projects/42sh/42ShellTester/tmp/symbolic_link$`
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.LmcFivfwkY/Render
09: TERM_PROGRAM_VERSION=3.0.10
10: TERM_SESSION_ID=w0t0p1:D3D230F7-7E75-4A5C-B793-6A5C4DAD3F83
11: ZSH=/Users/ariard/.oh-my-zsh
12: USER=ariard
13: SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.u4JR4EZzBG/Listeners
14: __CF_USER_TEXT_ENCODING=0x4A15:0x0:0x0
15: PAGER=less
16: TMUX=/private/tmp/tmux-18965/default,73780,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=w0t0p1:D3D230F7-7E75-4A5C-B793-6A5C4DAD3F83
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
STDERR:
SUCCESS expected_to be_empty
(no output)
----------------------------------------------------------------
minishell/builtins/cd/008-symbolic-link-2 (FAILED)
Description:
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.
Before test:
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"
STDIN:
01: cd symbolic_link2
02: /Users/ariard/Projects/42sh/42ShellTester/tmp/display_pwd
03: /Users/ariard/Projects/42sh/42ShellTester/tmp/display_env
STDOUT:
SUCCESS expected_to match_regex `PWD:/Users/ariard/Projects/42sh/42ShellTester/tmp/sub_directory:PWD$`
FAILURE expected_to match_regex `^PWD=/Users/ariard/Projects/42sh/42ShellTester/tmp/symbolic_link2$`
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.LmcFivfwkY/Render
09: TERM_PROGRAM_VERSION=3.0.10
10: TERM_SESSION_ID=w0t0p1:D3D230F7-7E75-4A5C-B793-6A5C4DAD3F83
11: ZSH=/Users/ariard/.oh-my-zsh
12: USER=ariard
13: SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.u4JR4EZzBG/Listeners
14: __CF_USER_TEXT_ENCODING=0x4A15:0x0:0x0
15: PAGER=less
16: TMUX=/private/tmp/tmux-18965/default,73780,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=w0t0p1:D3D230F7-7E75-4A5C-B793-6A5C4DAD3F83
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
STDERR:
SUCCESS expected_to be_empty
(no output)
----------------------------------------------------------------
minishell/builtins/cd/errors/001-not-a-directory (WARNING)
Description:
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.
Before test:
01: touch "./not_a_directory"
STDIN:
01: cd not_a_directory
02: /Users/ariard/Projects/42sh/42ShellTester/tmp/display_pwd
STDOUT:
SUCCESS expected_to match_regex `PWD:/Users/ariard/Projects/42sh/42ShellTester/tmp:PWD`
01: PWD:/Users/ariard/Projects/42sh/42ShellTester/tmp:PWD
STDERR:
SUCCESS expected_to_not be_empty
WARNING might match_regex `[Nn]ot a directory`
01: ../../42sh: cd: no such file or directory: not_a_directory
----------------------------------------------------------------
minishell/builtins/cd/errors/003-permission-denied (WARNING)
Description:
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.
Before test:
01: if [ -d "./permission_denied" ]; then chmod 777 "./permission_denied"; fi
02: rm -rf "./permission_denied"
03: mkdir -m 0 "./permission_denied"
STDIN:
01: cd permission_denied
02: /Users/ariard/Projects/42sh/42ShellTester/tmp/display_pwd
STDOUT:
SUCCESS expected_to match_regex `PWD:/Users/ariard/Projects/42sh/42ShellTester/tmp:PWD`
01: PWD:/Users/ariard/Projects/42sh/42ShellTester/tmp:PWD
STDERR:
SUCCESS expected_to_not be_empty
WARNING might match_regex `[Pp]ermission denied`
01: ../../42sh: cd: no such file or directory: permission_denied
After test:
01: if [ -d "./permission_denied" ]; then chmod 777 "./permission_denied"; fi
02: rm -rf "./permission_denied"
----------------------------------------------------------------
minishell/builtins/cd/errors/005-too-many-symbolic-links-encountered (WARNING)
Description:
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.
Before test:
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"
STDIN:
01: cd symbolic_link1
02: /Users/ariard/Projects/42sh/42ShellTester/tmp/display_pwd
STDOUT:
SUCCESS expected_to match_regex `PWD:/Users/ariard/Projects/42sh/42ShellTester/tmp:PWD`
01: PWD:/Users/ariard/Projects/42sh/42ShellTester/tmp:PWD
STDERR:
SUCCESS expected_to_not be_empty
WARNING might match_regex `[Tt]oo many.*symbolic links`
01: ../../42sh: cd: no such file or directory: symbolic_link1
----------------------------------------------------------------
minishell/builtins/env/005-set-variables (FAILED)
Description:
The purpose of this test is to check that the builtin `env` can modify or set multiple environment variables before executing the given command.
Before test:
01: export VARTEST1="OLD_VALUE"
STDIN:
01: env VARTEST1=TOKEN201703241735_1 VARTEST2=TOKEN201703241735_2 VARTEST3=TOKEN201703241735_3 ./display_env
STDOUT:
FAILURE expected_to match_regex `VARTEST1=TOKEN201703241735_1`
FAILURE expected_to match_regex `VARTEST2=TOKEN201703241735_2`
FAILURE expected_to match_regex `VARTEST3=TOKEN201703241735_3`
(no output)
STDERR:
FAILURE expected_to be_empty
01: ../../42sh: env: VARTEST1=TOKEN201703241735_1: No such file or directory
----------------------------------------------------------------
minishell/builtins/env/errors/001-command-not-found (FAILED)
Description:
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.
Before test:
01: rm -f "./invalid_binary"
STDIN:
01: env ./invalid_binary
STDOUT:
(no output)
STDERR:
SUCCESS expected_to_not be_empty
WARNING might match_regex `[Cc]ommand not found`
01: ../../42sh: env: ./invalid_binary: No such file or directory
MISC:
FAILURE expected_to_not exit_with_status `0`
----------------------------------------------------------------
minishell/builtins/env/errors/002-illegal-option (FAILED)
Description:
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.
Before test:
01: rm -f -- "-w"
STDIN:
01: env -w
STDOUT:
(no output)
STDERR:
SUCCESS expected_to_not be_empty
SUCCESS might match_regex `([Ii]nvalid|[Ii]llegal) (option|argument)`
01: env: invalid option -w
02: ../../42sh: usage: env [-i] [name=value]... [utility [argument...]]
MISC:
FAILURE expected_to_not exit_with_status `0`
----------------------------------------------------------------
minishell/builtins/exit/errors/001-too-many-args (FAILED)
Description:
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.
STDIN:
01: exit 21 42
02: ./write_on_stdout TOKEN201703241735
STDOUT:
FAILURE expected_to match_regex `TOKEN201703241735`
(no output)
STDERR:
FAILURE expected_to_not be_empty
WARNING might match_regex `([Tt]oo many arguments|[Aa]rgument list too long)`
(no output)
MISC:
FAILURE expected_to exit_with_status `0`
----------------------------------------------------------------
minishell/builtins/exit/errors/002-non-numeric-argument (FAILED)
Description:
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.
STDIN:
01: exit abc
02: ./write_on_stdout TOKEN201703241735
STDOUT:
SUCCESS expected_to_not match_regex `TOKEN201703241735`
(no output)
STDERR:
SUCCESS might_not be_empty
SUCCESS might match_regex `[Nn]umeric argument required`
01: ../../42sh: exit: numeric argument required
MISC:
FAILURE expected_to_not exit_with_status `0`
----------------------------------------------------------------
minishell/builtins/mixed/001-setenv-unsetenv (FAILED)
Description:
The purpose of this test is to check that setting and unsetting environment variable with the builtins `setenv` and `unsetenv` (or `export` and `unset`) works together.
Before test:
01: # unset all environment variables
02: for VARIABLE in $(env | awk 'BEGIN {FS="="} {print $1}'); do unset "${VARIABLE}"; done;
STDIN:
01: setenv TEST1
02: setenv TEST2
03: unsetenv TEST1
04: unsetenv TEST2
05: ./display_env
06:
07: export TEST1
08: export TEST2
09: unset TEST1
10: unset TEST2
11: ./display_env
STDOUT:
FAILURE expected_to_not match_regex `TEST1=`
FAILURE expected_to_not match_regex `TEST2=`
01: ------------------------------
02: _=../../42sh
03: ?=0
04: SHLVL=1
05: TEST1=
06: TEST2=
07: ------------------------------
08: TOTAL ENVIRONMENT VARIABLES: 5
09: ------------------------------
10: _=../../42sh
11: ?=0
12: SHLVL=1
13: TEST1=
14: TEST2=
15: ------------------------------
16: TOTAL ENVIRONMENT VARIABLES: 5
STDERR:
(no output)
----------------------------------------------------------------
minishell/builtins/setenv/004-invalid-identifier (WARNING)
Description:
The purpose of this test is to check that using a wrong variable name with the builtin `setenv` (or `export`) results in error.
STDIN:
01: setenv 42
02: export 42
STDOUT:
SUCCESS might be_empty
(no output)
STDERR:
SUCCESS expected_to_not be_empty
WARNING might match_regex `(not.*identifier|must begin.*letter)`
01: ../../42sh: setenv: 42: invalid variable name
02: ../../42sh: export: 42: invalid variable name
----------------------------------------------------------------
minishell/builtins/unsetenv/001-unsetenv-first-elem (FAILED)
Description:
This test was made to control if the Head of the env list was set correctly.
So we unset all the environment variables inside the tester environment and set a new one.
Thereafter we are unseting inside the tested shell. We are using env to check if the last head was remove correctly.
Before test:
01: # unset all environment variables
02: for VARIABLE in $(env | awk 'BEGIN {FS="="} {print $1}'); do unset "${VARIABLE}"; done;
03:
04: export VARTEST="TOKEN201703241735"
STDIN:
01: unsetenv VARTEST
02: unset VARTEST
03: ./display_env
STDOUT:
FAILURE expected_to_not match_regex `VARTEST=`
01: ------------------------------
02: VARTEST=TOKEN201703241735
03: _=../../42sh
04: ?=0
05: SHLVL=1
06: ------------------------------
07: TOTAL ENVIRONMENT VARIABLES: 4
STDERR:
(no output)
----------------------------------------------------------------
minishell/builtins/unsetenv/002-unsetenv-mult-envp (FAILED)
Description:
This test was made to check if we can unset multiple arguments.
So we unset all the environment variables inside the tester environment and set a 3 new variables.
Thereafter we are unseting all of them inside the tested shell.
Before test:
01: # unset all environment ariables
02: for VARIABLE in $(env | awk 'BEGIN {FS="="} {print $1}'); do unset "${VARIABLE}"; done;
03:
04: export ONE="TOKEN201703241735_1"
05: export TWO="TOKEN201703241735_2"
06: export THREE="TOKEN201703241735_3"
STDIN:
01: unsetenv ONE
02: unsetenv TWO
03: unsetenv THREE
04: unset ONE
05: unset TWO
06: unset THREE
07: ./display_env
STDOUT:
SUCCESS expected_to_not match_regex `ONE=`
SUCCESS expected_to_not match_regex `TWO=`
FAILURE expected_to_not match_regex `THREE=`
01: ------------------------------
02: THREE=TOKEN201703241735_3
03: _=../../42sh
04: ?=0
05: SHLVL=1
06: ------------------------------
07: TOTAL ENVIRONMENT VARIABLES: 4
STDERR:
(no output)
----------------------------------------------------------------
minishell/builtins/unsetenv/003-unsetenv-mult-envp-inline (FAILED)
Description:
This test was made to check if we can unset multiple arguments INLINE.
So we unset all the environment variables inside the tester environment and set a 3 new variables.
Thereafter we are unseting all of them INLINE inside the tested shell.
Before test:
01: # unset all variables
02: for VARIABLE in $(env | awk 'BEGIN {FS="="} {print $1}'); do unset "${VARIABLE}"; done;
03:
04: export ONE="TOKEN201703241735_1"
05: export TWO="TOKEN201703241735_2"
06: export THREE="TOKEN201703241735_3"
STDIN:
01: unsetenv ONE TWO THREE
02: unset ONE TWO THREE
03: ./display_env
STDOUT:
SUCCESS expected_to_not match_regex `ONE=`
FAILURE expected_to_not match_regex `TWO=`
FAILURE expected_to_not match_regex `THREE=`
01: ------------------------------
02: THREE=TOKEN201703241735_3
03: TWO=TOKEN201703241735_2
04: _=../../42sh
05: ?=0
06: SHLVL=1
07: ------------------------------
08: TOTAL ENVIRONMENT VARIABLES: 5
STDERR:
(no output)
Total tests: 54
Total failed tests: 12
Total pending tests: 0