Skip to content

Commit 66f1bc0

Browse files
authored
Use EESSI module from repo for all PS1 tests
This could probably be done even more widely, but would require a separate PR.
1 parent 680f29a commit 66f1bc0

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

.github/workflows/scripts/test_init_scripts.sh

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -154,22 +154,23 @@ for shell in ${SHELLS[@]}; do
154154

155155
# Optional test 11, check if the prompt has been updated
156156
if [ "$shell" = "bash" ] || [ "$shell" = "ksh" ] || [ "$shell" = "zsh" ] || [ "$shell" = "sh" ]; then
157+
# Let's configure things to use the EESSI module within the PR
158+
sed 's|export MODULEPATH=.*|export MODULEPATH=init/modules|' init/lmod/sh >init/lmod/sh.test
159+
ln -srf init/lmod/sh.test init/lmod/bash.test
160+
ln -srf init/lmod/sh.test init/lmod/ksh.test
161+
ln -srf init/lmod/sh.test init/lmod/zsh.test
157162
# Typically this is a non-interactive shell, so manually unset PS1 and reset to a non-exported variable when testing
158-
TEST_EESSI_PS1_UPDATE=$($shell -c "unset PS1 ; PS1='$ ' ; . init/lmod/$shell 2>/dev/null ; echo \"\$PS1\"")
159-
TEST_EESSI_NO_PS1_UPDATE=$($shell -c "unset PS1 ; . init/lmod/$shell 2>/dev/null ; echo \"\$PS1\"")
163+
TEST_EESSI_PS1_UPDATE=$($shell -c "unset PS1 ; PS1='$ ' ; . init/lmod/$shell.test 2>/dev/null ; echo \"\$PS1\"")
164+
TEST_EESSI_NO_PS1_UPDATE=$($shell -c "unset PS1 ; . init/lmod/$shell.test 2>/dev/null ; echo \"\$PS1\"")
160165
pattern="{EESSI/${EESSI_VERSION}} "
161166
assert_raises 'echo "$TEST_EESSI_PS1_UPDATE" | grep "$pattern"'
162167
assert_raises 'echo "$TEST_EESSI_NO_PS1_UPDATE" | grep "$pattern"' 1
163168
# Also check when we explicitly ask for it not to be updated
164-
TEST_EESSI_EXPLICIT_NO_PS1_UPDATE=$($shell -c "unset PS1 ; PS1='test> ' ; export EESSI_MODULE_UPDATE_PS1=0 ; . init/lmod/$shell 2>/dev/null ; echo \"\$PS1\"")
165-
TEST_EESSI_EXPLICIT_NO_PS1_UPDATE_CALLED_TWICE=$($shell -c "unset PS1 ; PS1='$ ' ; export EESSI_MODULE_UPDATE_PS1=0 ; . init/lmod/$shell 2>/dev/null ; . init/lmod/$shell 2>/dev/null ; echo \"\$PS1\"")
169+
TEST_EESSI_EXPLICIT_NO_PS1_UPDATE=$($shell -c "unset PS1 ; PS1='test> ' ; export EESSI_MODULE_UPDATE_PS1=0 ; . init/lmod/$shell.test 2>/dev/null ; echo \"\$PS1\"")
170+
TEST_EESSI_EXPLICIT_NO_PS1_UPDATE_CALLED_TWICE=$($shell -c "unset PS1 ; PS1='$ ' ; export EESSI_MODULE_UPDATE_PS1=0 ; . init/lmod/$shell.test 2>/dev/null ; . init/lmod/$shell.test 2>/dev/null ; echo \"\$PS1\"")
166171
assert_raises 'echo "$TEST_EESSI_EXPLICIT_NO_PS1_UPDATE" | grep "$pattern"' 1
167172
assert_raises 'echo "$TEST_EESSI_EXPLICIT_NO_PS1_UPDATE_CALLED_TWICE" | grep "$pattern"' 1
168173
# Also check complex prompts, and unloading/purging the EESSI module
169-
sed 's|export MODULEPATH=.*|export MODULEPATH=init/modules|' init/lmod/sh >init/lmod/sh.test
170-
ln -srf init/lmod/sh.test init/lmod/bash.test
171-
ln -srf init/lmod/sh.test init/lmod/ksh.test
172-
ln -srf init/lmod/sh.test init/lmod/zsh.test
173174
prompt="\$(echo '\['✘) $ "
174175
promptstr="\[✘ $ "
175176
updated_promptstr="{EESSI/${EESSI_VERSION}} \[✘ $ "

0 commit comments

Comments
 (0)