Skip to content

Commit b15b4f7

Browse files
committed
(t)csh uses slightly different shell redirection syntax
1 parent 0b914fd commit b15b4f7

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

.github/workflows/scripts/test_init_scripts.sh

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,36 @@ for shell in ${SHELLS[@]}; do
3232
echo -e "\033[33mWe don't now how to test the shell '$shell', PRs are Welcome.\033[0m"
3333
else
3434
# TEST 1: Source Script and check Module Output
35-
assert "$shell -c 'source init/lmod/$shell' 2>&1 " "Module for EESSI/$EESSI_VERSION loaded successfully"
35+
expected="Module for EESSI/$EESSI_VERSION loaded successfully"
36+
if [ "$shell" = "csh" ]; then
37+
assert "$shell -c 'source init/lmod/$shell' |& " "${expected}"
38+
else
39+
assert "$shell -c 'source init/lmod/$shell' 2>&1 " "${expected}"
40+
fi
3641
# TEST 2: Check if module overviews first section is the loaded EESSI module
42+
if [ "$shell" = "csh" ]; then
43+
MODULE_SECTIONS=($($shell -c "source init/lmod/$shell >& /dev/null; module ov |& | grep -e '---'"))
44+
else
3745
MODULE_SECTIONS=($($shell -c "source init/lmod/$shell 2>/dev/null; module ov 2>&1 | grep -e '---'"))
46+
fi
3847
PATTERN="/cvmfs/software\.eessi\.io/versions/$EESSI_VERSION/software/linux/x86_64/(intel/haswell|amd/zen3)/modules/all"
3948
assert_raises 'echo "${MODULE_SECTIONS[1]}" | grep -E "$PATTERN"'
4049
# TEST 3: Check if module overviews second section is the EESSI init module
4150
assert "echo ${MODULE_SECTIONS[4]}" "/cvmfs/software.eessi.io/versions/$EESSI_VERSION/init/modules"
4251
# Test 4: Load EasyBuild module and check version
4352
# eb --version outputs: "This is EasyBuild 5.1.1 (framework: 5.1.1, easyblocks: 5.1.1) on host ..."
53+
if [ "$shell" = "csh" ]; then
54+
command="$shell -c 'source init/lmod/$shell >& /dev/null; module load EasyBuild/${EXPECTED_EASYBUILD_VERSION}; eb --version | cut -d \" \" -f4'"
55+
else
4456
command="$shell -c 'source init/lmod/$shell 2>/dev/null; module load EasyBuild/${EXPECTED_EASYBUILD_VERSION}; eb --version | cut -d \" \" -f4'"
57+
fi
4558
assert "$command" "$EXPECTED_EASYBUILD_VERSION"
4659
# Test 5: Load EasyBuild module and check path
60+
if [ "$shell" = "csh" ]; then
61+
EASYBUILD_PATH=$($shell -c "source init/lmod/$shell >& /dev/null; module load EasyBuild/${EXPECTED_EASYBUILD_VERSION}; which eb")
62+
else
4763
EASYBUILD_PATH=$($shell -c "source init/lmod/$shell 2>/dev/null; module load EasyBuild/${EXPECTED_EASYBUILD_VERSION}; which eb")
64+
fi
4865
# escape the dots in ${EASYBUILD_VERSION}
4966
PATTERN="/cvmfs/software\.eessi\.io/versions/$EESSI_VERSION/software/linux/x86_64/(intel/haswell|amd/zen3)/software/EasyBuild/${EXPECTED_EASYBUILD_VERSION//./\\.}/bin/eb"
5067
echo "$EASYBUILD_PATH" | grep -E "$PATTERN"

0 commit comments

Comments
 (0)