From 3e8d2fec895b52456761c2c8fe780ec84227b010 Mon Sep 17 00:00:00 2001 From: Thomas Roeblitz Date: Sun, 5 Oct 2025 17:02:44 +0200 Subject: [PATCH 01/21] also test init for csh --- .github/workflows/scripts/test_init_scripts.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/scripts/test_init_scripts.sh b/.github/workflows/scripts/test_init_scripts.sh index bbf424a6..b372d22c 100755 --- a/.github/workflows/scripts/test_init_scripts.sh +++ b/.github/workflows/scripts/test_init_scripts.sh @@ -20,7 +20,7 @@ if [ ! -d assert.sh ]; then fi . assert.sh/assert.sh -TEST_SHELLS=("bash" "zsh" "fish" "ksh") +TEST_SHELLS=("bash" "zsh" "fish" "ksh" "csh") SHELLS=$@ for shell in ${SHELLS[@]}; do From fbd268945f9f3409f8d8b856a463f79e15baf00a Mon Sep 17 00:00:00 2001 From: Thomas Roeblitz Date: Sun, 5 Oct 2025 17:12:00 +0200 Subject: [PATCH 02/21] install (t)csh too --- .github/workflows/tests_init_module.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests_init_module.yml b/.github/workflows/tests_init_module.yml index f0694a92..bf3bfa2f 100644 --- a/.github/workflows/tests_init_module.yml +++ b/.github/workflows/tests_init_module.yml @@ -46,7 +46,7 @@ jobs: - name: Install missing shells run: | sudo apt update - sudo apt install zsh ksh fish + sudo apt install zsh ksh fish tcsh echo "# INIT ZSH" > ~/.zshrc - name: Run tests for available shells From 5120a61228645232295343b811203f1ee9d19855 Mon Sep 17 00:00:00 2001 From: Thomas Roeblitz Date: Sun, 5 Oct 2025 17:26:57 +0200 Subject: [PATCH 03/21] format csh file to follow syntax + 4 spaces indentation --- init/lmod/csh | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/init/lmod/csh b/init/lmod/csh index 28ad59e8..427c5164 100644 --- a/init/lmod/csh +++ b/init/lmod/csh @@ -1,19 +1,24 @@ # Choose an EESSI CVMFS repository -if (! $?EESSI_CVMFS_REPO) then; set EESSI_CVMFS_REPO = "/cvmfs/software.eessi.io"; endif +if (! $?EESSI_CVMFS_REPO) then + set EESSI_CVMFS_REPO = "/cvmfs/software.eessi.io" +endif # Choose an EESSI version setenv EESSI_VERSION_DEFAULT "__EESSI_VERSION_DEFAULT__" -if (! $?EESSI_VERSION) then; set EESSI_VERSION = "${EESSI_VERSION_DEFAULT}"; endif +if (! $?EESSI_VERSION) then + set EESSI_VERSION = "${EESSI_VERSION_DEFAULT}" +endif # Path to top-level module tree setenv MODULEPATH "${EESSI_CVMFS_REPO}/versions/${EESSI_VERSION}/init/modules" source "${EESSI_CVMFS_REPO}/versions/${EESSI_VERSION}/compat/linux/$(uname -m)/usr/share/Lmod/init/csh" if (! $?__Init_Default_Modules ) then - setenv __Init_Default_Modules 1; + setenv __Init_Default_Modules 1; - ## ability to predefine elsewhere the default list - if (! $?LMOD_SYSTEM_DEFAULT_MODULES) then; setenv LMOD_SYSTEM_DEFAULT_MODULES "EESSI/$EESSI_VERSION"; endif - module --initial_load --no_redirect restore + ## ability to predefine elsewhere the default list + if (! $?LMOD_SYSTEM_DEFAULT_MODULES) then + setenv LMOD_SYSTEM_DEFAULT_MODULES "EESSI/$EESSI_VERSION" + endif + module --initial_load --no_redirect restore else - module refresh + module refresh endif - From a952a16380417b5cbbf2502c4074ccb9a0c50737 Mon Sep 17 00:00:00 2001 From: Thomas Roeblitz Date: Sun, 5 Oct 2025 17:46:47 +0200 Subject: [PATCH 04/21] use backticks in csh + some polishing --- init/lmod/csh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/init/lmod/csh b/init/lmod/csh index 427c5164..2adb314c 100644 --- a/init/lmod/csh +++ b/init/lmod/csh @@ -9,14 +9,14 @@ if (! $?EESSI_VERSION) then endif # Path to top-level module tree setenv MODULEPATH "${EESSI_CVMFS_REPO}/versions/${EESSI_VERSION}/init/modules" -source "${EESSI_CVMFS_REPO}/versions/${EESSI_VERSION}/compat/linux/$(uname -m)/usr/share/Lmod/init/csh" +source "${EESSI_CVMFS_REPO}/versions/${EESSI_VERSION}/compat/linux/`uname -m`/usr/share/Lmod/init/csh" if (! $?__Init_Default_Modules ) then - setenv __Init_Default_Modules 1; + setenv __Init_Default_Modules 1 - ## ability to predefine elsewhere the default list + # ability to predefine elsewhere the default list if (! $?LMOD_SYSTEM_DEFAULT_MODULES) then - setenv LMOD_SYSTEM_DEFAULT_MODULES "EESSI/$EESSI_VERSION" + setenv LMOD_SYSTEM_DEFAULT_MODULES "EESSI/${EESSI_VERSION}" endif module --initial_load --no_redirect restore else From 5b5bc10b7c818286f04adcb3118ac23a655517bc Mon Sep 17 00:00:00 2001 From: Thomas Roeblitz Date: Sun, 5 Oct 2025 17:57:46 +0200 Subject: [PATCH 05/21] avoid some apt triggers --- .github/workflows/tests_init_module.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/tests_init_module.yml b/.github/workflows/tests_init_module.yml index bf3bfa2f..638c7c67 100644 --- a/.github/workflows/tests_init_module.yml +++ b/.github/workflows/tests_init_module.yml @@ -45,6 +45,9 @@ jobs: - name: Install missing shells run: | + # avoid processing triggers for man-db (seems to slow down installation) + echo "set man-db/auto-update false" | sudo debconf-communicate + sudo dpkg-reconfigure man-db sudo apt update sudo apt install zsh ksh fish tcsh echo "# INIT ZSH" > ~/.zshrc From 0b914fd18a21448693858de2655e6fe2f82938cf Mon Sep 17 00:00:00 2001 From: Thomas Roeblitz Date: Sun, 5 Oct 2025 18:07:37 +0200 Subject: [PATCH 06/21] ensure trigger for man-db is not triggered earlier --- .github/workflows/tests_init_module.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests_init_module.yml b/.github/workflows/tests_init_module.yml index 638c7c67..b4d31435 100644 --- a/.github/workflows/tests_init_module.yml +++ b/.github/workflows/tests_init_module.yml @@ -27,6 +27,12 @@ jobs: - name: Check out software-layer repository uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + - name: Avoid processing man-db trigger + run: | + # avoid processing trigger for man-db (seems to slow down installation) + echo "set man-db/auto-update false" | sudo debconf-communicate + sudo dpkg-reconfigure man-db + - name: Mount EESSI CernVM-FS pilot repository uses: cvmfs-contrib/github-action-cvmfs@55899ca74cf78ab874bdf47f5a804e47c198743c # v4.0 with: @@ -45,9 +51,6 @@ jobs: - name: Install missing shells run: | - # avoid processing triggers for man-db (seems to slow down installation) - echo "set man-db/auto-update false" | sudo debconf-communicate - sudo dpkg-reconfigure man-db sudo apt update sudo apt install zsh ksh fish tcsh echo "# INIT ZSH" > ~/.zshrc From b15b4f7d5ea01d1d05b780eb2fcd9bf04f585c8c Mon Sep 17 00:00:00 2001 From: Thomas Roeblitz Date: Sun, 5 Oct 2025 18:56:48 +0200 Subject: [PATCH 07/21] (t)csh uses slightly different shell redirection syntax --- .../workflows/scripts/test_init_scripts.sh | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/.github/workflows/scripts/test_init_scripts.sh b/.github/workflows/scripts/test_init_scripts.sh index b372d22c..2fd0fb2f 100755 --- a/.github/workflows/scripts/test_init_scripts.sh +++ b/.github/workflows/scripts/test_init_scripts.sh @@ -32,19 +32,36 @@ for shell in ${SHELLS[@]}; do echo -e "\033[33mWe don't now how to test the shell '$shell', PRs are Welcome.\033[0m" else # TEST 1: Source Script and check Module Output - assert "$shell -c 'source init/lmod/$shell' 2>&1 " "Module for EESSI/$EESSI_VERSION loaded successfully" + expected="Module for EESSI/$EESSI_VERSION loaded successfully" + if [ "$shell" = "csh" ]; then + assert "$shell -c 'source init/lmod/$shell' |& " "${expected}" + else + assert "$shell -c 'source init/lmod/$shell' 2>&1 " "${expected}" + fi # TEST 2: Check if module overviews first section is the loaded EESSI module + if [ "$shell" = "csh" ]; then + MODULE_SECTIONS=($($shell -c "source init/lmod/$shell >& /dev/null; module ov |& | grep -e '---'")) + else MODULE_SECTIONS=($($shell -c "source init/lmod/$shell 2>/dev/null; module ov 2>&1 | grep -e '---'")) + fi PATTERN="/cvmfs/software\.eessi\.io/versions/$EESSI_VERSION/software/linux/x86_64/(intel/haswell|amd/zen3)/modules/all" assert_raises 'echo "${MODULE_SECTIONS[1]}" | grep -E "$PATTERN"' # TEST 3: Check if module overviews second section is the EESSI init module assert "echo ${MODULE_SECTIONS[4]}" "/cvmfs/software.eessi.io/versions/$EESSI_VERSION/init/modules" # Test 4: Load EasyBuild module and check version # eb --version outputs: "This is EasyBuild 5.1.1 (framework: 5.1.1, easyblocks: 5.1.1) on host ..." + if [ "$shell" = "csh" ]; then + command="$shell -c 'source init/lmod/$shell >& /dev/null; module load EasyBuild/${EXPECTED_EASYBUILD_VERSION}; eb --version | cut -d \" \" -f4'" + else command="$shell -c 'source init/lmod/$shell 2>/dev/null; module load EasyBuild/${EXPECTED_EASYBUILD_VERSION}; eb --version | cut -d \" \" -f4'" + fi assert "$command" "$EXPECTED_EASYBUILD_VERSION" # Test 5: Load EasyBuild module and check path + if [ "$shell" = "csh" ]; then + EASYBUILD_PATH=$($shell -c "source init/lmod/$shell >& /dev/null; module load EasyBuild/${EXPECTED_EASYBUILD_VERSION}; which eb") + else EASYBUILD_PATH=$($shell -c "source init/lmod/$shell 2>/dev/null; module load EasyBuild/${EXPECTED_EASYBUILD_VERSION}; which eb") + fi # escape the dots in ${EASYBUILD_VERSION} PATTERN="/cvmfs/software\.eessi\.io/versions/$EESSI_VERSION/software/linux/x86_64/(intel/haswell|amd/zen3)/software/EasyBuild/${EXPECTED_EASYBUILD_VERSION//./\\.}/bin/eb" echo "$EASYBUILD_PATH" | grep -E "$PATTERN" From b56da622468226d6d59cd02d51db055fa550dcff Mon Sep 17 00:00:00 2001 From: Thomas Roeblitz Date: Sun, 5 Oct 2025 20:33:12 +0200 Subject: [PATCH 08/21] using module alias in non-interactive csh is a little tricky --- .github/workflows/scripts/test_init_scripts.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/scripts/test_init_scripts.sh b/.github/workflows/scripts/test_init_scripts.sh index 2fd0fb2f..89c9da0c 100755 --- a/.github/workflows/scripts/test_init_scripts.sh +++ b/.github/workflows/scripts/test_init_scripts.sh @@ -33,14 +33,16 @@ for shell in ${SHELLS[@]}; do else # TEST 1: Source Script and check Module Output expected="Module for EESSI/$EESSI_VERSION loaded successfully" - if [ "$shell" = "csh" ]; then - assert "$shell -c 'source init/lmod/$shell' |& " "${expected}" - else assert "$shell -c 'source init/lmod/$shell' 2>&1 " "${expected}" - fi # TEST 2: Check if module overviews first section is the loaded EESSI module if [ "$shell" = "csh" ]; then - MODULE_SECTIONS=($($shell -c "source init/lmod/$shell >& /dev/null; module ov |& | grep -e '---'")) + # module is defined as alias, but aliases are only retained in interactive shells + # we work around this by running 'csh -l', however with '-l' we cannot add '-c' + # we work around this by creating a temporary .cshrc file (which sources + # the init script), and then use a here-string to specify the command to + # be run; the output is then processed as for other shells + echo "source init/lmod/$shell 2> /dev/null" > .cshrc + MODULE_SECTIONS=($($shell -l <<< "module ov" 2>&1 | grep -e '---'")) else MODULE_SECTIONS=($($shell -c "source init/lmod/$shell 2>/dev/null; module ov 2>&1 | grep -e '---'")) fi From c315cdc74ca1b95bed0a350eb622eb23aac46c33 Mon Sep 17 00:00:00 2001 From: Thomas Roeblitz Date: Sun, 5 Oct 2025 20:37:02 +0200 Subject: [PATCH 09/21] fix syntax glitch --- .github/workflows/scripts/test_init_scripts.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/scripts/test_init_scripts.sh b/.github/workflows/scripts/test_init_scripts.sh index 89c9da0c..b723d1db 100755 --- a/.github/workflows/scripts/test_init_scripts.sh +++ b/.github/workflows/scripts/test_init_scripts.sh @@ -42,7 +42,7 @@ for shell in ${SHELLS[@]}; do # the init script), and then use a here-string to specify the command to # be run; the output is then processed as for other shells echo "source init/lmod/$shell 2> /dev/null" > .cshrc - MODULE_SECTIONS=($($shell -l <<< "module ov" 2>&1 | grep -e '---'")) + MODULE_SECTIONS=($($shell -l <<< "module ov" 2>&1 | grep -e '---')) else MODULE_SECTIONS=($($shell -c "source init/lmod/$shell 2>/dev/null; module ov 2>&1 | grep -e '---'")) fi From 05016f6173df06b5ff63bea52a508ed28c271e52 Mon Sep 17 00:00:00 2001 From: Thomas Roeblitz Date: Sun, 5 Oct 2025 20:42:38 +0200 Subject: [PATCH 10/21] show test script to be run --- .github/workflows/tests_init_module.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/tests_init_module.yml b/.github/workflows/tests_init_module.yml index b4d31435..7728f132 100644 --- a/.github/workflows/tests_init_module.yml +++ b/.github/workflows/tests_init_module.yml @@ -59,5 +59,8 @@ jobs: run: | export EESSI_VERSION=${{matrix.EESSI_VERSION}} export EXPECTED_EASYBUILD_VERSION=${{matrix.EXPECTED_EASYBUILD_VERSION}} + echo "===============================================" + cat .github/workflows/scripts/test_init_scripts.sh + echo "===============================================" .github/workflows/scripts/test_init_scripts.sh "bash" "zsh" "ksh" "fish" "csh" From e4fa51dd2aab304a2dc24fc053d60544a742f061 Mon Sep 17 00:00:00 2001 From: Thomas Roeblitz Date: Sun, 5 Oct 2025 20:45:30 +0200 Subject: [PATCH 11/21] create, cat and test .cshrc in HOME dir --- .github/workflows/scripts/test_init_scripts.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/scripts/test_init_scripts.sh b/.github/workflows/scripts/test_init_scripts.sh index b723d1db..9ac498fa 100755 --- a/.github/workflows/scripts/test_init_scripts.sh +++ b/.github/workflows/scripts/test_init_scripts.sh @@ -41,7 +41,9 @@ for shell in ${SHELLS[@]}; do # we work around this by creating a temporary .cshrc file (which sources # the init script), and then use a here-string to specify the command to # be run; the output is then processed as for other shells - echo "source init/lmod/$shell 2> /dev/null" > .cshrc + echo "source init/lmod/$shell 2> /dev/null" > ~/.cshrc + cat ~/.cshrc + $shell -l <<< "alias" MODULE_SECTIONS=($($shell -l <<< "module ov" 2>&1 | grep -e '---')) else MODULE_SECTIONS=($($shell -c "source init/lmod/$shell 2>/dev/null; module ov 2>&1 | grep -e '---'")) From 56cb0d7ceea73ad121b66149c351f214d075fe36 Mon Sep 17 00:00:00 2001 From: Thomas Roeblitz Date: Sun, 5 Oct 2025 20:50:25 +0200 Subject: [PATCH 12/21] use csh workaround for other tests --- .github/workflows/scripts/test_init_scripts.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/scripts/test_init_scripts.sh b/.github/workflows/scripts/test_init_scripts.sh index 9ac498fa..6b615be0 100755 --- a/.github/workflows/scripts/test_init_scripts.sh +++ b/.github/workflows/scripts/test_init_scripts.sh @@ -55,14 +55,20 @@ for shell in ${SHELLS[@]}; do # Test 4: Load EasyBuild module and check version # eb --version outputs: "This is EasyBuild 5.1.1 (framework: 5.1.1, easyblocks: 5.1.1) on host ..." if [ "$shell" = "csh" ]; then - command="$shell -c 'source init/lmod/$shell >& /dev/null; module load EasyBuild/${EXPECTED_EASYBUILD_VERSION}; eb --version | cut -d \" \" -f4'" + echo "source init/lmod/$shell 2> /dev/null" > ~/.cshrc + cat ~/.cshrc + $shell -l <<< "alias" + command="$shell -l <<< 'module load EasyBuild/${EXPECTED_EASYBUILD_VERSION}; eb --version | cut -d \" \" -f4'" else command="$shell -c 'source init/lmod/$shell 2>/dev/null; module load EasyBuild/${EXPECTED_EASYBUILD_VERSION}; eb --version | cut -d \" \" -f4'" fi assert "$command" "$EXPECTED_EASYBUILD_VERSION" # Test 5: Load EasyBuild module and check path if [ "$shell" = "csh" ]; then - EASYBUILD_PATH=$($shell -c "source init/lmod/$shell >& /dev/null; module load EasyBuild/${EXPECTED_EASYBUILD_VERSION}; which eb") + echo "source init/lmod/$shell 2> /dev/null" > ~/.cshrc + cat ~/.cshrc + $shell -l <<< "alias" + EASYBUILD_PATH=$($shell -l "module load EasyBuild/${EXPECTED_EASYBUILD_VERSION}; which eb") else EASYBUILD_PATH=$($shell -c "source init/lmod/$shell 2>/dev/null; module load EasyBuild/${EXPECTED_EASYBUILD_VERSION}; which eb") fi From 90f3e8d8e9f444be450fa59b3badb5681dcebfe0 Mon Sep 17 00:00:00 2001 From: Thomas Roeblitz Date: Sun, 5 Oct 2025 21:03:45 +0200 Subject: [PATCH 13/21] discard some error messages + use here-string in last test too --- .github/workflows/scripts/test_init_scripts.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/scripts/test_init_scripts.sh b/.github/workflows/scripts/test_init_scripts.sh index 6b615be0..2176fe5b 100755 --- a/.github/workflows/scripts/test_init_scripts.sh +++ b/.github/workflows/scripts/test_init_scripts.sh @@ -43,7 +43,7 @@ for shell in ${SHELLS[@]}; do # be run; the output is then processed as for other shells echo "source init/lmod/$shell 2> /dev/null" > ~/.cshrc cat ~/.cshrc - $shell -l <<< "alias" + $shell -l <<< "alias" 2> /dev/null MODULE_SECTIONS=($($shell -l <<< "module ov" 2>&1 | grep -e '---')) else MODULE_SECTIONS=($($shell -c "source init/lmod/$shell 2>/dev/null; module ov 2>&1 | grep -e '---'")) @@ -57,7 +57,7 @@ for shell in ${SHELLS[@]}; do if [ "$shell" = "csh" ]; then echo "source init/lmod/$shell 2> /dev/null" > ~/.cshrc cat ~/.cshrc - $shell -l <<< "alias" + $shell -l <<< "alias" 2> /dev/null command="$shell -l <<< 'module load EasyBuild/${EXPECTED_EASYBUILD_VERSION}; eb --version | cut -d \" \" -f4'" else command="$shell -c 'source init/lmod/$shell 2>/dev/null; module load EasyBuild/${EXPECTED_EASYBUILD_VERSION}; eb --version | cut -d \" \" -f4'" @@ -67,8 +67,8 @@ for shell in ${SHELLS[@]}; do if [ "$shell" = "csh" ]; then echo "source init/lmod/$shell 2> /dev/null" > ~/.cshrc cat ~/.cshrc - $shell -l <<< "alias" - EASYBUILD_PATH=$($shell -l "module load EasyBuild/${EXPECTED_EASYBUILD_VERSION}; which eb") + $shell -l <<< "alias" 2> /dev/null + EASYBUILD_PATH=$($shell -l <<< "module load EasyBuild/${EXPECTED_EASYBUILD_VERSION}; which eb") else EASYBUILD_PATH=$($shell -c "source init/lmod/$shell 2>/dev/null; module load EasyBuild/${EXPECTED_EASYBUILD_VERSION}; which eb") fi From bb8ac18ad3a17f3009e40e590a3757ffbaf6aaec Mon Sep 17 00:00:00 2001 From: Thomas Roeblitz Date: Sun, 5 Oct 2025 21:12:02 +0200 Subject: [PATCH 14/21] fix stderr redirection for .cshrc --- .github/workflows/scripts/test_init_scripts.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/scripts/test_init_scripts.sh b/.github/workflows/scripts/test_init_scripts.sh index 2176fe5b..ef30e6ee 100755 --- a/.github/workflows/scripts/test_init_scripts.sh +++ b/.github/workflows/scripts/test_init_scripts.sh @@ -41,7 +41,7 @@ for shell in ${SHELLS[@]}; do # we work around this by creating a temporary .cshrc file (which sources # the init script), and then use a here-string to specify the command to # be run; the output is then processed as for other shells - echo "source init/lmod/$shell 2> /dev/null" > ~/.cshrc + echo "source init/lmod/$shell >& /dev/null" > ~/.cshrc cat ~/.cshrc $shell -l <<< "alias" 2> /dev/null MODULE_SECTIONS=($($shell -l <<< "module ov" 2>&1 | grep -e '---')) @@ -55,7 +55,7 @@ for shell in ${SHELLS[@]}; do # Test 4: Load EasyBuild module and check version # eb --version outputs: "This is EasyBuild 5.1.1 (framework: 5.1.1, easyblocks: 5.1.1) on host ..." if [ "$shell" = "csh" ]; then - echo "source init/lmod/$shell 2> /dev/null" > ~/.cshrc + echo "source init/lmod/$shell >& /dev/null" > ~/.cshrc cat ~/.cshrc $shell -l <<< "alias" 2> /dev/null command="$shell -l <<< 'module load EasyBuild/${EXPECTED_EASYBUILD_VERSION}; eb --version | cut -d \" \" -f4'" @@ -65,7 +65,7 @@ for shell in ${SHELLS[@]}; do assert "$command" "$EXPECTED_EASYBUILD_VERSION" # Test 5: Load EasyBuild module and check path if [ "$shell" = "csh" ]; then - echo "source init/lmod/$shell 2> /dev/null" > ~/.cshrc + echo "source init/lmod/$shell >& /dev/null" > ~/.cshrc cat ~/.cshrc $shell -l <<< "alias" 2> /dev/null EASYBUILD_PATH=$($shell -l <<< "module load EasyBuild/${EXPECTED_EASYBUILD_VERSION}; which eb") From 056d6be5759fde7e7b9ddf01171919bb8f3176e7 Mon Sep 17 00:00:00 2001 From: Thomas Roeblitz Date: Sun, 5 Oct 2025 21:19:52 +0200 Subject: [PATCH 15/21] clean up some debug output and add new for test 4 --- .github/workflows/scripts/test_init_scripts.sh | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/scripts/test_init_scripts.sh b/.github/workflows/scripts/test_init_scripts.sh index ef30e6ee..fb160abf 100755 --- a/.github/workflows/scripts/test_init_scripts.sh +++ b/.github/workflows/scripts/test_init_scripts.sh @@ -42,8 +42,6 @@ for shell in ${SHELLS[@]}; do # the init script), and then use a here-string to specify the command to # be run; the output is then processed as for other shells echo "source init/lmod/$shell >& /dev/null" > ~/.cshrc - cat ~/.cshrc - $shell -l <<< "alias" 2> /dev/null MODULE_SECTIONS=($($shell -l <<< "module ov" 2>&1 | grep -e '---')) else MODULE_SECTIONS=($($shell -c "source init/lmod/$shell 2>/dev/null; module ov 2>&1 | grep -e '---'")) @@ -56,8 +54,10 @@ for shell in ${SHELLS[@]}; do # eb --version outputs: "This is EasyBuild 5.1.1 (framework: 5.1.1, easyblocks: 5.1.1) on host ..." if [ "$shell" = "csh" ]; then echo "source init/lmod/$shell >& /dev/null" > ~/.cshrc - cat ~/.cshrc - $shell -l <<< "alias" 2> /dev/null + echo "TEST COMMANDS (just module load)" + $shell -l <<< 'module load EasyBuild/${EXPECTED_EASYBUILD_VERSION}' + echo "TEST COMMANDS (module load and eb --version ...)" + $shell -l <<< 'module load EasyBuild/${EXPECTED_EASYBUILD_VERSION}; eb --version | cut -d \" \" -f4' command="$shell -l <<< 'module load EasyBuild/${EXPECTED_EASYBUILD_VERSION}; eb --version | cut -d \" \" -f4'" else command="$shell -c 'source init/lmod/$shell 2>/dev/null; module load EasyBuild/${EXPECTED_EASYBUILD_VERSION}; eb --version | cut -d \" \" -f4'" @@ -66,8 +66,6 @@ for shell in ${SHELLS[@]}; do # Test 5: Load EasyBuild module and check path if [ "$shell" = "csh" ]; then echo "source init/lmod/$shell >& /dev/null" > ~/.cshrc - cat ~/.cshrc - $shell -l <<< "alias" 2> /dev/null EASYBUILD_PATH=$($shell -l <<< "module load EasyBuild/${EXPECTED_EASYBUILD_VERSION}; which eb") else EASYBUILD_PATH=$($shell -c "source init/lmod/$shell 2>/dev/null; module load EasyBuild/${EXPECTED_EASYBUILD_VERSION}; which eb") From 0c60458ba9fe1642b222f46d2306222e4b002f7b Mon Sep 17 00:00:00 2001 From: Thomas Roeblitz Date: Sun, 5 Oct 2025 21:23:43 +0200 Subject: [PATCH 16/21] fix string quoting --- .github/workflows/scripts/test_init_scripts.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/scripts/test_init_scripts.sh b/.github/workflows/scripts/test_init_scripts.sh index fb160abf..3e7ead0e 100755 --- a/.github/workflows/scripts/test_init_scripts.sh +++ b/.github/workflows/scripts/test_init_scripts.sh @@ -55,9 +55,9 @@ for shell in ${SHELLS[@]}; do if [ "$shell" = "csh" ]; then echo "source init/lmod/$shell >& /dev/null" > ~/.cshrc echo "TEST COMMANDS (just module load)" - $shell -l <<< 'module load EasyBuild/${EXPECTED_EASYBUILD_VERSION}' + $shell -l <<< "module load EasyBuild/${EXPECTED_EASYBUILD_VERSION}" echo "TEST COMMANDS (module load and eb --version ...)" - $shell -l <<< 'module load EasyBuild/${EXPECTED_EASYBUILD_VERSION}; eb --version | cut -d \" \" -f4' + $shell -l <<< "module load EasyBuild/${EXPECTED_EASYBUILD_VERSION}; eb --version | cut -d \" \" -f4" command="$shell -l <<< 'module load EasyBuild/${EXPECTED_EASYBUILD_VERSION}; eb --version | cut -d \" \" -f4'" else command="$shell -c 'source init/lmod/$shell 2>/dev/null; module load EasyBuild/${EXPECTED_EASYBUILD_VERSION}; eb --version | cut -d \" \" -f4'" From a9c5dc3c41842b72f4d3d7a2cf17b115db5c6a01 Mon Sep 17 00:00:00 2001 From: Thomas Roeblitz Date: Sun, 5 Oct 2025 21:31:39 +0200 Subject: [PATCH 17/21] discard output when loading EasyBuild --- .github/workflows/scripts/test_init_scripts.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/scripts/test_init_scripts.sh b/.github/workflows/scripts/test_init_scripts.sh index 3e7ead0e..f28aa61b 100755 --- a/.github/workflows/scripts/test_init_scripts.sh +++ b/.github/workflows/scripts/test_init_scripts.sh @@ -55,10 +55,10 @@ for shell in ${SHELLS[@]}; do if [ "$shell" = "csh" ]; then echo "source init/lmod/$shell >& /dev/null" > ~/.cshrc echo "TEST COMMANDS (just module load)" - $shell -l <<< "module load EasyBuild/${EXPECTED_EASYBUILD_VERSION}" + $shell -l <<< "module load EasyBuild/${EXPECTED_EASYBUILD_VERSION} >& /dev/null" echo "TEST COMMANDS (module load and eb --version ...)" - $shell -l <<< "module load EasyBuild/${EXPECTED_EASYBUILD_VERSION}; eb --version | cut -d \" \" -f4" - command="$shell -l <<< 'module load EasyBuild/${EXPECTED_EASYBUILD_VERSION}; eb --version | cut -d \" \" -f4'" + $shell -l <<< "module load EasyBuild/${EXPECTED_EASYBUILD_VERSION} >& /dev/null; eb --version | cut -d \" \" -f4" + command="$shell -l <<< 'module load EasyBuild/${EXPECTED_EASYBUILD_VERSION} >& /dev/null; eb --version | cut -d \" \" -f4'" else command="$shell -c 'source init/lmod/$shell 2>/dev/null; module load EasyBuild/${EXPECTED_EASYBUILD_VERSION}; eb --version | cut -d \" \" -f4'" fi From cac110087261948fcc0aa9e5e2e47a19fe52b95a Mon Sep 17 00:00:00 2001 From: Thomas Roeblitz Date: Sun, 5 Oct 2025 21:44:07 +0200 Subject: [PATCH 18/21] try running in non-login shell --- .github/workflows/scripts/test_init_scripts.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/scripts/test_init_scripts.sh b/.github/workflows/scripts/test_init_scripts.sh index f28aa61b..d7b143e1 100755 --- a/.github/workflows/scripts/test_init_scripts.sh +++ b/.github/workflows/scripts/test_init_scripts.sh @@ -50,20 +50,20 @@ for shell in ${SHELLS[@]}; do assert_raises 'echo "${MODULE_SECTIONS[1]}" | grep -E "$PATTERN"' # TEST 3: Check if module overviews second section is the EESSI init module assert "echo ${MODULE_SECTIONS[4]}" "/cvmfs/software.eessi.io/versions/$EESSI_VERSION/init/modules" - # Test 4: Load EasyBuild module and check version + # TEST 4: Load EasyBuild module and check version # eb --version outputs: "This is EasyBuild 5.1.1 (framework: 5.1.1, easyblocks: 5.1.1) on host ..." if [ "$shell" = "csh" ]; then echo "source init/lmod/$shell >& /dev/null" > ~/.cshrc echo "TEST COMMANDS (just module load)" - $shell -l <<< "module load EasyBuild/${EXPECTED_EASYBUILD_VERSION} >& /dev/null" + $shell -c "module load EasyBuild/${EXPECTED_EASYBUILD_VERSION}" echo "TEST COMMANDS (module load and eb --version ...)" - $shell -l <<< "module load EasyBuild/${EXPECTED_EASYBUILD_VERSION} >& /dev/null; eb --version | cut -d \" \" -f4" - command="$shell -l <<< 'module load EasyBuild/${EXPECTED_EASYBUILD_VERSION} >& /dev/null; eb --version | cut -d \" \" -f4'" + $shell -c "module load EasyBuild/${EXPECTED_EASYBUILD_VERSION}; eb --version | cut -d \" \" -f4" + command="$shell -c 'module load EasyBuild/${EXPECTED_EASYBUILD_VERSION} >& /dev/null; eb --version | cut -d \" \" -f4'" else command="$shell -c 'source init/lmod/$shell 2>/dev/null; module load EasyBuild/${EXPECTED_EASYBUILD_VERSION}; eb --version | cut -d \" \" -f4'" fi assert "$command" "$EXPECTED_EASYBUILD_VERSION" - # Test 5: Load EasyBuild module and check path + # TEST 5: Load EasyBuild module and check path if [ "$shell" = "csh" ]; then echo "source init/lmod/$shell >& /dev/null" > ~/.cshrc EASYBUILD_PATH=$($shell -l <<< "module load EasyBuild/${EXPECTED_EASYBUILD_VERSION}; which eb") From 5b93cd809b723a583fba7d11d8507d2dca5b9fa5 Mon Sep 17 00:00:00 2001 From: Thomas Roeblitz Date: Sun, 5 Oct 2025 21:51:25 +0200 Subject: [PATCH 19/21] clean up some debug output and rearrange output processing --- .github/workflows/scripts/test_init_scripts.sh | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/scripts/test_init_scripts.sh b/.github/workflows/scripts/test_init_scripts.sh index d7b143e1..dc11498d 100755 --- a/.github/workflows/scripts/test_init_scripts.sh +++ b/.github/workflows/scripts/test_init_scripts.sh @@ -53,12 +53,8 @@ for shell in ${SHELLS[@]}; do # TEST 4: Load EasyBuild module and check version # eb --version outputs: "This is EasyBuild 5.1.1 (framework: 5.1.1, easyblocks: 5.1.1) on host ..." if [ "$shell" = "csh" ]; then - echo "source init/lmod/$shell >& /dev/null" > ~/.cshrc - echo "TEST COMMANDS (just module load)" - $shell -c "module load EasyBuild/${EXPECTED_EASYBUILD_VERSION}" - echo "TEST COMMANDS (module load and eb --version ...)" - $shell -c "module load EasyBuild/${EXPECTED_EASYBUILD_VERSION}; eb --version | cut -d \" \" -f4" - command="$shell -c 'module load EasyBuild/${EXPECTED_EASYBUILD_VERSION} >& /dev/null; eb --version | cut -d \" \" -f4'" + echo "source init/lmod/$shell" > ~/.cshrc + command="$shell -c 'module load EasyBuild/${EXPECTED_EASYBUILD_VERSION}; eb --version' | cut -d \" \" -f4" else command="$shell -c 'source init/lmod/$shell 2>/dev/null; module load EasyBuild/${EXPECTED_EASYBUILD_VERSION}; eb --version | cut -d \" \" -f4'" fi From 9da386396d87d30ddb8d870f8589bd9b57717e4f Mon Sep 17 00:00:00 2001 From: Thomas Roeblitz Date: Sun, 5 Oct 2025 22:36:42 +0200 Subject: [PATCH 20/21] replacing tabs with spaces and final polishing/cleanup --- .../workflows/scripts/test_init_scripts.sh | 91 ++++++++++--------- 1 file changed, 46 insertions(+), 45 deletions(-) diff --git a/.github/workflows/scripts/test_init_scripts.sh b/.github/workflows/scripts/test_init_scripts.sh index dc11498d..f543835c 100755 --- a/.github/workflows/scripts/test_init_scripts.sh +++ b/.github/workflows/scripts/test_init_scripts.sh @@ -2,21 +2,21 @@ export LMOD_PAGER=cat if [ -z ${EESSI_VERSION} ] || [ ! -d /cvmfs/software.eessi.io/versions/${EESSI_VERSION} ]; then - echo "\$EESSI_VERSION has to be set to a valid EESSI version." - exit 1 + echo "\$EESSI_VERSION has to be set to a valid EESSI version." + exit 1 fi if [ -z ${EXPECTED_EASYBUILD_VERSION} ]; then - echo "\$EXPECTED_EASYBUILD_VERSION has to be set to an EasyBuild version that is expected to be available in EESSI version ${EESSI_VERSION}." - exit 1 + echo "\$EXPECTED_EASYBUILD_VERSION has to be set to an EasyBuild version that is expected to be available in EESSI version ${EESSI_VERSION}." + exit 1 fi # initialize assert framework if [ ! -d assert.sh ]; then - echo "assert.sh not cloned." - echo "" - echo "run \`git clone https://github.com/lehmannro/assert.sh.git\`" - exit 1 + echo "assert.sh not cloned." + echo "" + echo "run \`git clone https://github.com/lehmannro/assert.sh.git\`" + exit 1 fi . assert.sh/assert.sh @@ -24,58 +24,59 @@ TEST_SHELLS=("bash" "zsh" "fish" "ksh" "csh") SHELLS=$@ for shell in ${SHELLS[@]}; do - echo = | awk 'NF += (OFS = $_) + 100' - echo RUNNING TESTS FOR SHELL: $shell - echo = | awk 'NF += (OFS = $_) + 100' + echo = | awk 'NF += (OFS = $_) + 100' + echo RUNNING TESTS FOR SHELL: $shell + echo = | awk 'NF += (OFS = $_) + 100' if [[ ! " ${TEST_SHELLS[*]} " =~ [[:space:]]${shell}[[:space:]] ]]; then - ### EXCEPTION FOR CSH ### - echo -e "\033[33mWe don't now how to test the shell '$shell', PRs are Welcome.\033[0m" + ### EXCEPTION FOR CSH ### + echo -e "\033[33mWe don't now how to test the shell '$shell', PRs are Welcome.\033[0m" else - # TEST 1: Source Script and check Module Output + # TEST 1: Source Script and check Module Output expected="Module for EESSI/$EESSI_VERSION loaded successfully" - assert "$shell -c 'source init/lmod/$shell' 2>&1 " "${expected}" - # TEST 2: Check if module overviews first section is the loaded EESSI module + assert "$shell -c 'source init/lmod/$shell' 2>&1 " "${expected}" + + # TEST 2: Check if module overviews first section is the loaded EESSI module if [ "$shell" = "csh" ]; then - # module is defined as alias, but aliases are only retained in interactive shells - # we work around this by running 'csh -l', however with '-l' we cannot add '-c' - # we work around this by creating a temporary .cshrc file (which sources - # the init script), and then use a here-string to specify the command to - # be run; the output is then processed as for other shells - echo "source init/lmod/$shell >& /dev/null" > ~/.cshrc - MODULE_SECTIONS=($($shell -l <<< "module ov" 2>&1 | grep -e '---')) + # module is defined as alias, but aliases are only retained in interactive + # shells we work around this by creating a .cshrc file (which sources the + # init script), and then simply run the remaining commands + echo "source init/lmod/$shell" > ~/.cshrc + MODULE_SECTIONS=($($shell -c "module ov" 2>&1 | grep -e '---')) else - MODULE_SECTIONS=($($shell -c "source init/lmod/$shell 2>/dev/null; module ov 2>&1 | grep -e '---'")) + MODULE_SECTIONS=($($shell -c "source init/lmod/$shell 2>/dev/null; module ov 2>&1 | grep -e '---'")) fi - PATTERN="/cvmfs/software\.eessi\.io/versions/$EESSI_VERSION/software/linux/x86_64/(intel/haswell|amd/zen3)/modules/all" - assert_raises 'echo "${MODULE_SECTIONS[1]}" | grep -E "$PATTERN"' - # TEST 3: Check if module overviews second section is the EESSI init module - assert "echo ${MODULE_SECTIONS[4]}" "/cvmfs/software.eessi.io/versions/$EESSI_VERSION/init/modules" - # TEST 4: Load EasyBuild module and check version - # eb --version outputs: "This is EasyBuild 5.1.1 (framework: 5.1.1, easyblocks: 5.1.1) on host ..." + PATTERN="/cvmfs/software\.eessi\.io/versions/$EESSI_VERSION/software/linux/x86_64/(intel/haswell|amd/zen3)/modules/all" + assert_raises 'echo "${MODULE_SECTIONS[1]}" | grep -E "$PATTERN"' + + # TEST 3: Check if module overviews second section is the EESSI init module + assert "echo ${MODULE_SECTIONS[4]}" "/cvmfs/software.eessi.io/versions/$EESSI_VERSION/init/modules" + + # TEST 4: Load EasyBuild module and check version + # eb --version outputs: "This is EasyBuild 5.1.1 (framework: 5.1.1, easyblocks: 5.1.1) on host ..." if [ "$shell" = "csh" ]; then echo "source init/lmod/$shell" > ~/.cshrc command="$shell -c 'module load EasyBuild/${EXPECTED_EASYBUILD_VERSION}; eb --version' | cut -d \" \" -f4" else - command="$shell -c 'source init/lmod/$shell 2>/dev/null; module load EasyBuild/${EXPECTED_EASYBUILD_VERSION}; eb --version | cut -d \" \" -f4'" + command="$shell -c 'source init/lmod/$shell 2>/dev/null; module load EasyBuild/${EXPECTED_EASYBUILD_VERSION}; eb --version | cut -d \" \" -f4'" fi - assert "$command" "$EXPECTED_EASYBUILD_VERSION" - # TEST 5: Load EasyBuild module and check path + assert "$command" "$EXPECTED_EASYBUILD_VERSION" + + # TEST 5: Load EasyBuild module and check path if [ "$shell" = "csh" ]; then - echo "source init/lmod/$shell >& /dev/null" > ~/.cshrc - EASYBUILD_PATH=$($shell -l <<< "module load EasyBuild/${EXPECTED_EASYBUILD_VERSION}; which eb") + echo "source init/lmod/$shell" > ~/.cshrc + EASYBUILD_PATH=$($shell -c "module load EasyBuild/${EXPECTED_EASYBUILD_VERSION}; which eb") else - EASYBUILD_PATH=$($shell -c "source init/lmod/$shell 2>/dev/null; module load EasyBuild/${EXPECTED_EASYBUILD_VERSION}; which eb") + EASYBUILD_PATH=$($shell -c "source init/lmod/$shell 2>/dev/null; module load EasyBuild/${EXPECTED_EASYBUILD_VERSION}; which eb") fi - # escape the dots in ${EASYBUILD_VERSION} - PATTERN="/cvmfs/software\.eessi\.io/versions/$EESSI_VERSION/software/linux/x86_64/(intel/haswell|amd/zen3)/software/EasyBuild/${EXPECTED_EASYBUILD_VERSION//./\\.}/bin/eb" - echo "$EASYBUILD_PATH" | grep -E "$PATTERN" - assert_raises 'echo "$EASYBUILD_PATH" | grep -E "$PATTERN"' - - #End Test Suite - assert_end "source_eessi_$shell" - fi -done + # escape the dots in ${EASYBUILD_VERSION} + PATTERN="/cvmfs/software\.eessi\.io/versions/$EESSI_VERSION/software/linux/x86_64/(intel/haswell|amd/zen3)/software/EasyBuild/${EXPECTED_EASYBUILD_VERSION//./\\.}/bin/eb" + echo "$EASYBUILD_PATH" | grep -E "$PATTERN" + assert_raises 'echo "$EASYBUILD_PATH" | grep -E "$PATTERN"' + # End Test Suite + assert_end "source_eessi_$shell" + fi +done # RESET PAGER export LMOD_PAGER= From 40bc520f652bb48ca4d8c07fc1fba41143c8cee1 Mon Sep 17 00:00:00 2001 From: Thomas Roeblitz Date: Sun, 5 Oct 2025 22:51:53 +0200 Subject: [PATCH 21/21] don't need to show workflow file --- .github/workflows/tests_init_module.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/tests_init_module.yml b/.github/workflows/tests_init_module.yml index 7728f132..b4d31435 100644 --- a/.github/workflows/tests_init_module.yml +++ b/.github/workflows/tests_init_module.yml @@ -59,8 +59,5 @@ jobs: run: | export EESSI_VERSION=${{matrix.EESSI_VERSION}} export EXPECTED_EASYBUILD_VERSION=${{matrix.EXPECTED_EASYBUILD_VERSION}} - echo "===============================================" - cat .github/workflows/scripts/test_init_scripts.sh - echo "===============================================" .github/workflows/scripts/test_init_scripts.sh "bash" "zsh" "ksh" "fish" "csh"