inttests: add ability to manipulate environment for a single test

This commit is contained in:
Khaïs COLIN 2025-03-31 16:52:31 +02:00
parent d66ca10a0c
commit e046d151a2
Signed by: logistic-bot
SSH key fingerprint: SHA256:RlpiqKeXpcPFZZ4y9Ou4xi2M8OhRJovIwDlbCaMsuAo

View file

@ -7,6 +7,7 @@ declare -i SUCCEDED=0
declare -i TODTODO=0
declare -i RAN=0
NAME=""
EXTRAENV=""
MINISHELL=$PWD/minishell
report_header()
@ -71,8 +72,9 @@ when_run()
rm -rf /tmp/dir.minishell
mkdir -p /tmp/dir.minishell
pushd /tmp/dir.minishell > /dev/null
$MINISHELL &> /tmp/got.minishell < /tmp/input.minishell
env $EXTRAENV $MINISHELL &> /tmp/got.minishell < /tmp/input.minishell
popd > /dev/null
EXTRAENV=""
RAN+=1
NAME=$1
}
@ -188,7 +190,8 @@ minishell: cd: Permission denied
/tmp/dir.minishell
EOF
HOME=/tmp/dir.minishell/fakehome when_run <<EOF "cd with no arguments goes to \$HOME"
EXTRAENV="HOME=/tmp/dir.minishell/fakehome"
when_run <<EOF "cd with no arguments goes to \$HOME"
mkdir fakehome
cd
pwd