Most of the cases provided must be tested in valgrind with trace-children and track-fds flags to check for leaks and open fds in child processes, there should be no unclosed inherited fds from parent in child:
valgrind --trace-children=yes --track-fds=yes ./minishell
And use ps aux command to check if there is zombie processes
ps aux | grep Z
Syntax:
| Cases |
Expected Output |
$? |
Required |
| ls > |
minishell: syntax error near unexpected token `newline' |
2 |
YES |
| >>> |
minishell: syntax error near unexpected token `>' |
2 |
YES |
| <<< |
minishell: syntax error near unexpected token `<' |
2 |
YES |
|
|
minishell: syntax error near unexpected token `newline' |
2 |
|
|
|
minishell: syntax error near unexpected token ` |
| If Bonus: |
|
|
|
| minishell: syntax error near unexpected token `newline' |
2 |
YES |
|
| << |
minishell: syntax error near unexpected token `newline' |
2 |
YES |
| >> |
minishell: syntax error near unexpected token `newline' |
2 |
YES |
Expander:
| Cases |
Expected Output |
$? |
Required |
| $non_exist $SHELL |
shell> |
0 |
YES |
| export test=” ” |
|
|
|
| echo $test $test $test abcd $non_exist $test 123 $test |
abcd 123 |
0 |
YES |
| export test=” abcd 123 ” |
|
|
|
| echo $test “$test” |
abcd 123 abcd 123 |
0 |
YES |
| echo $0$1230$0 |
minishell230minishell |
0 |
YES |
| export test="ls -la” |
|
|
|
| $test |
ls with -la flag output |
0 |
YES |
Env:
| Cases |
Expected Output |
$? |
Required |
| echo $SHLVL |
|
|
|
| ./minishell |
|
|
|
| echo $SHLVL |
first echo will output current shell lvl second will output SHLVL + 1 |
0 |
DEBATABLE |
| export SHLVL=999 |
|
|
|
| ./minishell |
minishell: warning: shell level (1000) too high, resetting to 1 |
0 |
DEBATABLE |
| export SHLVL=-129139 |
|
|
|
| ./minishell |
|
|
|
| echo $SHLVL |
0 |
0 |
DEBATABLE |
| ls -la |
|
|
|
| echo $_ |
ls output |
|
|
| -la |
0 |
DEBATABLE |
|
Export:
| Cases |
Expected Output |
$? |
Required |
| export test1=”abcd” test2=”123” test3=”minishell” |
Must add test1 test2 test3 to envs |
0 |
YES |
| export 1test |
minishell: export: `1test': not a valid identifier |
1 |
YES |
| export test=”123” 1test=”test” test3=”abcd” |
Will add test and test3 to envs |
0 |
YES |
| export test_empty |
|
|
|
| bash |
|
|
|
| export |
All envs except test_empty |
0 |
YES |
PIPES:
| Cases |
Expected Output |
$? |
Required |
| cat |
cat |
cat |
echo |
minishell> | 0 | YES |
| cat Makefile | base64 | xxd -p | xxd -r -p | base64 --decode | Makefile code | 0 | YES |
| cat Makefile | cat -e | cat -e | cat -e | cat -e | cat -e | cat -e | cat -e | cat -e | cat -e | cat -e | include Include.mk $$$$$$$$$$
SRC_DIR = src$$$$$$$$$$
OBJ_DIR = build$$$$$$$$$
… | 0 | YES |
| yes yes | head -n 10000000 | wc | 10000000 10000000 40000000 | 0 | YES |
| echo | echo | echo | echo | echo | echo | echo | echo | echo | echo | echo | echo | echo |
./minishell | 0 | YES |
| . | .. | . | minishell> | 0 | YES |
| exit 1 | exit 255 | exit 2 | minishell> | 2 | YES |
Echo:
| Cases |
Expected Output |
$? |
Required |
| echo -n test |
testminishell> |
0 |
YES |
| echo -nnnnnnn -n -nnnnnnb test |
-nnnnnnb testminishell> |
0 |
YES |
| echo -nnnnnnn -n -nnnennE test |
testminishell> |
0 |
NO |
| echo test |
test |
|
|
| minishell> |
0 |
YES |
|
Unset:
| Cases |
Expected Output |
$? |
Required |
| unset USER |
Removes USER env |
0 |
YES |
| unset USER PATH |
Removes USER and PATH envs |
0 |
YES |
Cd:
| Cases |
Expected Output |
$? |
Required |
| cd test/ |
minishell: cd: No such file or directory |
1 |
YES |
| cd /dev/vboxusb |
minishell: cd: Permission denied |
1 |
YES |
| cd ../../ |
minishell> |
0 |
YES |
| cd a b |
minishell: cd: too many arguments |
1 |
YES |