42-archive/42sh/42ShellTester/log
Antoine Riard 83d2bbad29 norme cd
2017-03-25 20:47:43 +01:00

18 KiB

...x...~......xx....~x.x~x.x.x~.....~.....~...........
 
----------------------------------------------------------------
 
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 "TOKEN201703252040"
 
STDOUT:
FAILURE expected_to match_regex `TOKEN201703252040`
(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.h7gvN9K1go/Render
09: TERM_PROGRAM_VERSION=3.0.10
10: TERM_SESSION_ID=w0t0p1:D7FAE8F0-DDCC-428E-AC84-622B27EDC123
11: ZSH=/Users/ariard/.oh-my-zsh
12: USER=ariard
13: SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.1T0c86pYlP/Listeners
14: __CF_USER_TEXT_ENCODING=0x4A15:0x0:0x0
15: PAGER=less
16: TMUX=/private/tmp/tmux-18965/default,23758,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=%16
26: XPC_SERVICE_NAME=0
27: SHLVL=4
28: HOME=/Users/ariard
29: COLORFGBG=7;0
30: ITERM_SESSION_ID=w0t0p1:D7FAE8F0-DDCC-428E-AC84-622B27EDC123
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.h7gvN9K1go/Render
09: TERM_PROGRAM_VERSION=3.0.10
10: TERM_SESSION_ID=w0t0p1:D7FAE8F0-DDCC-428E-AC84-622B27EDC123
11: ZSH=/Users/ariard/.oh-my-zsh
12: USER=ariard
13: SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.1T0c86pYlP/Listeners
14: __CF_USER_TEXT_ENCODING=0x4A15:0x0:0x0
15: PAGER=less
16: TMUX=/private/tmp/tmux-18965/default,23758,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=%16
26: XPC_SERVICE_NAME=0
27: SHLVL=4
28: HOME=/Users/ariard
29: COLORFGBG=7;0
30: ITERM_SESSION_ID=w0t0p1:D7FAE8F0-DDCC-428E-AC84-622B27EDC123
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 : ./not_a_directory: No such file or directory
 
----------------------------------------------------------------
 
minishell/builtins/cd/errors/002-not-a-directory-2 (FAILED)
 
Description:
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.
 
Before test:
01: touch "./not_a_directory"
 
STDIN:
01: cd not_a_directory
 
STDOUT:
(no output)
 
STDERR:
01: ../../42sh: cd : ./not_a_directory: No such file or directory
 
MISC:
FAILURE expected_to_not exit_with_status `0`
 
----------------------------------------------------------------
 
minishell/builtins/cd/errors/004-permission-denied-2 (FAILED)
 
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
 
STDOUT:
(no output)
 
STDERR:
01: ../../42sh: cd : ./permission_denied: Permission denied
 
MISC:
FAILURE expected_to_not exit_with_status `0`
 
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 : ./symbolic_link1: No such file or directory
 
----------------------------------------------------------------
 
minishell/builtins/cd/errors/006-too-many-symbolic-links-encountered-2 (FAILED)
 
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 a Shell termination with a failure exit status.
 
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
 
STDOUT:
(no output)
 
STDERR:
01: ../../42sh: cd : ./symbolic_link1: No such file or directory
 
MISC:
FAILURE expected_to_not exit_with_status `0`
 
----------------------------------------------------------------
 
minishell/builtins/cd/errors/008-no-such-file-or-directory-2 (FAILED)
 
Description:
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.
 
Before test:
01: rm -f "./no_such_file_or_directory"
 
STDIN:
01: cd no_such_file_or_directory
 
STDOUT:
(no output)
 
STDERR:
01: ../../42sh: cd : ./no_such_file_or_directory: No such file or directory
 
MISC:
FAILURE expected_to_not exit_with_status `0`
 
----------------------------------------------------------------
 
minishell/builtins/cd/errors/010-no-such-file-or-directory-symlink-2 (FAILED)
 
Description:
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.
 
Before test:
01: rm -rf "./enoent_symlink" "./enoent_directory"
02: ln -s "./enoent_directory" "./enoent_symlink"
 
STDIN:
01: cd ./enoent_symlink
 
STDOUT:
(no output)
 
STDERR:
01: ../../42sh: cd : /Users/ariard/Projects/42sh/42ShellTester/tmp/./enoent_symlink: No such file or directory
 
MISC:
FAILURE expected_to_not exit_with_status `0`
 
----------------------------------------------------------------
 
minishell/builtins/cd/options/001-not-following-links (WARNING)
 
Description:
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.
 
Before test:
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"
 
STDIN:
01: cd -P sub_directory_link
02: cd -P sub_sub_directory_link
03: /Users/ariard/Projects/42sh/42ShellTester/tmp/display_env
 
STDOUT:
SUCCESS expected_to match_regex `PWD=/Users/ariard/Projects/42sh/42ShellTester/tmp/sub_directory/sub_sub_directory`
01: ------------------------------
02: TERM_PROGRAM=iTerm.app
03: TERM=screen-256color
04: SHELL=/bin/zsh
05: HOMEBREW_TEMP=/tmp/ariard/Homebrew/Temp
06: TMPDIR=/var/folders/zz/zyxvpxvq6csfxvn_n0002_2m000khn/T/
07: Apple_PubSub_Socket_Render=/private/tmp/com.apple.launchd.h7gvN9K1go/Render
08: TERM_PROGRAM_VERSION=3.0.10
09: TERM_SESSION_ID=w0t0p1:D7FAE8F0-DDCC-428E-AC84-622B27EDC123
10: ZSH=/Users/ariard/.oh-my-zsh
11: USER=ariard
12: SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.1T0c86pYlP/Listeners
13: __CF_USER_TEXT_ENCODING=0x4A15:0x0:0x0
14: PAGER=less
15: TMUX=/private/tmp/tmux-18965/default,23758,2
16: HOMEBREW_CACHE=/tmp/ariard/Homebrew/Caches
17: LSCOLORS=Gxfxcxdxbxegedabagacad
18: PATH=/Users/ariard/.brew/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/munki://Users/ariard/local/bin
19: MAIL=ariard@student.42.fr
20: PWD=/Users/ariard/Projects/42sh/42ShellTester/tmp/sub_directory/sub_sub_directory
21: LANG=en_US.UTF-8
22: ITERM_PROFILE=Default
23: XPC_FLAGS=0x0
24: TMUX_PANE=%16
25: XPC_SERVICE_NAME=0
26: SHLVL=4
27: HOME=/Users/ariard
28: COLORFGBG=7;0
29: ITERM_SESSION_ID=w0t0p1:D7FAE8F0-DDCC-428E-AC84-622B27EDC123
30: LOGNAME=ariard
31: LESS=-R
32: LC_CTYPE=en_US.UTF-8
33: TMUX_PLUGIN_MANAGER_PATH=/Users/ariard/.tmux/plugins/
34: OLDPWD=/Users/ariard/Projects/42sh/42ShellTester/tmp/sub_directory
35: _=../../42sh
36: ?=0
37: ------------------------------
38: TOTAL ENVIRONMENT VARIABLES: 35
 
STDERR:
WARNING might be_empty
01: ../../42sh: cd : ./sub_directory_link: Permission denied
02: ../../42sh: cd : ./sub_sub_directory_link: Permission denied
 
----------------------------------------------------------------
 
minishell/builtins/env/errors/001-command-not-found (WARNING)
 
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:
SUCCESS expected_to_not exit_with_status `0`
 
----------------------------------------------------------------
 
minishell/builtins/exit/errors/001-too-many-args (WARNING)
 
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 TOKEN201703252040
 
STDOUT:
SUCCESS expected_to match_regex `TOKEN201703252040`
01: TOKEN201703252040
 
STDERR:
SUCCESS expected_to_not be_empty
WARNING might match_regex `([Tt]oo many arguments|[Aa]rgument list too long)`
01: ../../42sh: exit: too many argument required
 
MISC:
SUCCESS expected_to exit_with_status `0`
 
Total tests: 54
Total failed tests: 8
Total pending tests: 0