From d51267543584dfd8b8533ab5791092817241ee5d Mon Sep 17 00:00:00 2001 From: Matti Kaupenjohann Date: Mon, 12 Aug 2024 13:37:05 +0200 Subject: [PATCH 01/31] Add init scripts - zsh - fish --- init/fish | 9 +++++++++ init/zsh | 9 +++++++++ 2 files changed, 18 insertions(+) create mode 100644 init/fish create mode 100644 init/zsh diff --git a/init/fish b/init/fish new file mode 100644 index 0000000000..de51c41a4a --- /dev/null +++ b/init/fish @@ -0,0 +1,9 @@ +# Choose an EESSI version +set EESSI_VERSION (set -q EESSI_VERSION; and echo "$EESSI_VERSION"; or echo "2023.06") +# Automatically load the module for EESSI version +set -x LMOD_SYSTEM_DEFAULT_MODULES (set -q LMOD_SYSTEM_DEFAULT_MODULE; and echo "$LMOD_SYSTEM_DEFAULT_MODULE"; or echo "EESSI/${EESSI_VERSION}") +# Path to top-level module tree +set -x MODULEPATH=/cvmfs/software.eessi.io/versions/"$EESSI_VERSION"/init/modules +. /cvmfs/software.eessi.io/versions/"$EESSI_VERSION"/compat/linux/$(uname -m)/usr/share/Lmod/init/zsh + +module load $LMOD_SYSTEM_DEFAULT_MODULES diff --git a/init/zsh b/init/zsh new file mode 100644 index 0000000000..b11c08459b --- /dev/null +++ b/init/zsh @@ -0,0 +1,9 @@ +# Choose an EESSI version +EESSI_VERSION="${EESSI_VERSION:-2023.06}" +# Automatically load the module for EESSI version +export LMOD_SYSTEM_DEFAULT_MODULES="${LMOD_SYSTEM_DEFAULT_MODULES:-EESSI/${EESSI_VERSION}}" +# Path to top-level module tree +export MODULEPATH=/cvmfs/software.eessi.io/versions/"$EESSI_VERSION"/init/modules +. /cvmfs/software.eessi.io/versions/"$EESSI_VERSION"/compat/linux/$(uname -m)/usr/share/Lmod/init/zsh + +module load "$LMOD_SYSTEM_DEFAULT_MODULES" From 7f71c28e03c71c4d93b13c6dac6ed8adf9d1bc12 Mon Sep 17 00:00:00 2001 From: makanu Date: Mon, 12 Aug 2024 12:34:14 +0000 Subject: [PATCH 02/31] Fix fish init script variable setting and calling --- init/fish | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/init/fish b/init/fish index de51c41a4a..f391dc366b 100644 --- a/init/fish +++ b/init/fish @@ -1,9 +1,9 @@ # Choose an EESSI version set EESSI_VERSION (set -q EESSI_VERSION; and echo "$EESSI_VERSION"; or echo "2023.06") # Automatically load the module for EESSI version -set -x LMOD_SYSTEM_DEFAULT_MODULES (set -q LMOD_SYSTEM_DEFAULT_MODULE; and echo "$LMOD_SYSTEM_DEFAULT_MODULE"; or echo "EESSI/${EESSI_VERSION}") +set -x LMOD_SYSTEM_DEFAULT_MODULES (set -q LMOD_SYSTEM_DEFAULT_MODULE; and echo "$LMOD_SYSTEM_DEFAULT_MODULE"; or echo "EESSI/$EESSI_VERSION") # Path to top-level module tree -set -x MODULEPATH=/cvmfs/software.eessi.io/versions/"$EESSI_VERSION"/init/modules -. /cvmfs/software.eessi.io/versions/"$EESSI_VERSION"/compat/linux/$(uname -m)/usr/share/Lmod/init/zsh +set -x MODULEPATH /cvmfs/software.eessi.io/versions/"$EESSI_VERSION"/init/modules +. /cvmfs/software.eessi.io/versions/"$EESSI_VERSION"/compat/linux/$(uname -m)/usr/share/Lmod/init/fish module load $LMOD_SYSTEM_DEFAULT_MODULES From 1e2f154bb45c13688066863a5d5c3f75a4529164 Mon Sep 17 00:00:00 2001 From: makanu Date: Mon, 12 Aug 2024 12:35:26 +0000 Subject: [PATCH 03/31] Add init script - ksh --- init/ksh | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 init/ksh diff --git a/init/ksh b/init/ksh new file mode 100644 index 0000000000..d6cefe85c4 --- /dev/null +++ b/init/ksh @@ -0,0 +1,9 @@ +# Choose an EESSI version +EESSI_VERSION="${EESSI_VERSION:-2023.06}" +# Automatically load the module for EESSI version +export LMOD_SYSTEM_DEFAULT_MODULES="${LMOD_SYSTEM_DEFAULT_MODULES:-EESSI/${EESSI_VERSION}}" +# Path to top-level module tree +export MODULEPATH=/cvmfs/software.eessi.io/versions/"$EESSI_VERSION"/init/modules +. /cvmfs/software.eessi.io/versions/"$EESSI_VERSION"/compat/linux/$(uname -m)/usr/share/Lmod/init/ksh + +module load "$LMOD_SYSTEM_DEFAULT_MODULES" From a0c4377e90989b0190b629447cbfcd853480aa9d Mon Sep 17 00:00:00 2001 From: makanu Date: Mon, 12 Aug 2024 12:35:44 +0000 Subject: [PATCH 04/31] convert bash init script --- init/bash | 50 +++++++++----------------------------------------- 1 file changed, 9 insertions(+), 41 deletions(-) diff --git a/init/bash b/init/bash index 4ad09f6a1b..468237a36f 100644 --- a/init/bash +++ b/init/bash @@ -1,41 +1,9 @@ -function show_msg { - # only echo msg if EESSI_SILENT is unset - msg=$1 - if [[ -z ${EESSI_SILENT+x} ]]; then - echo "$msg" - fi -} - -# The following method should be safe, but might break if file is a symlink -# (could switch to $(dirname "$(readlink -f "$BASH_SOURCE")") in that case) -source $(dirname "$BASH_SOURCE")/eessi_environment_variables - -# only continue if setting EESSI environment variables worked fine -if [ $? -eq 0 ]; then - - export PS1="{EESSI $EESSI_VERSION} $PS1" - - # add location of commands provided by compat layer to $PATH; - # see https://github.com/EESSI/software-layer/issues/52 - export PATH=$EPREFIX/usr/bin:$EPREFIX/bin:$PATH - - # init Lmod - show_msg "Initializing Lmod..." - source $EESSI_EPREFIX/usr/share/Lmod/init/bash - - # prepend location of modules for EESSI software stack to $MODULEPATH - show_msg "Prepending $EESSI_MODULEPATH to \$MODULEPATH..." - module use $EESSI_MODULEPATH - show_msg "Prepending site path $EESSI_SITE_MODULEPATH to \$MODULEPATH..." - module use $EESSI_SITE_MODULEPATH - - #show_msg "" - #show_msg "*** Known problems in the ${EESSI_VERSION} software stack ***" - #show_msg "" - #show_msg "1) ..." - #show_msg "" - #show_msg "" - - echo "Environment set up to use EESSI (${EESSI_VERSION}), have fun!" - -fi +# Choose an EESSI version +EESSI_VERSION="${EESSI_VERSION:-2023.06}" +# Automatically load the module for EESSI version +export LMOD_SYSTEM_DEFAULT_MODULES="${LMOD_SYSTEM_DEFAULT_MODULES:-EESSI/${EESSI_VERSION}}" +# Path to top-level module tree +export MODULEPATH=/cvmfs/software.eessi.io/versions/"$EESSI_VERSION"/init/modules +. /cvmfs/software.eessi.io/versions/"$EESSI_VERSION"/compat/linux/$(uname -m)/usr/share/Lmod/init/bash + +module load "$LMOD_SYSTEM_DEFAULT_MODULES" From 68aea9fe6ae192ccfa15299ed97833579dcae659 Mon Sep 17 00:00:00 2001 From: makanu Date: Mon, 12 Aug 2024 12:46:34 +0000 Subject: [PATCH 05/31] Add init script - csh --- init/csh | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 init/csh diff --git a/init/csh b/init/csh new file mode 100644 index 0000000000..c43a50c412 --- /dev/null +++ b/init/csh @@ -0,0 +1,10 @@ +# Choose an EESSI version +if (! $?EESSI_VERSION) then; set EESSI_VERSION = "2023.06"; endif +# Automatically load the module for EESSI version +if (! $?LMOD_SYSTEM_DEFAULT_MODULES) then; setenv LMOD_SYSTEM_DEFAULT_MODULES "EESSI/$EESSI_VERSION"; endif +# Path to top-level module tree +setenv MODULEPATH /cvmfs/software.eessi.io/versions/"$EESSI_VERSION"/init/modules +source /cvmfs/software.eessi.io/versions/"$EESSI_VERSION"/compat/linux/`uname -m`/usr/share/Lmod/init/csh + +module load "$LMOD_SYSTEM_DEFAULT_MODULES" + From 788375d16ce0e34a89461966011445dce9a8f2a3 Mon Sep 17 00:00:00 2001 From: makanu Date: Mon, 12 Aug 2024 14:06:46 +0000 Subject: [PATCH 06/31] Export ${debian_chroot:+($debian_chroot)}\u@\h:\w\$ for all init scripts --- init/bash | 1 + init/csh | 1 + init/fish | 1 + init/ksh | 1 + init/zsh | 1 + 5 files changed, 5 insertions(+) diff --git a/init/bash b/init/bash index 468237a36f..4cd3fbe701 100644 --- a/init/bash +++ b/init/bash @@ -6,4 +6,5 @@ export LMOD_SYSTEM_DEFAULT_MODULES="${LMOD_SYSTEM_DEFAULT_MODULES:-EESSI/${EESSI export MODULEPATH=/cvmfs/software.eessi.io/versions/"$EESSI_VERSION"/init/modules . /cvmfs/software.eessi.io/versions/"$EESSI_VERSION"/compat/linux/$(uname -m)/usr/share/Lmod/init/bash +export PS1=$PS1 module load "$LMOD_SYSTEM_DEFAULT_MODULES" diff --git a/init/csh b/init/csh index c43a50c412..e71f4a9e81 100644 --- a/init/csh +++ b/init/csh @@ -6,5 +6,6 @@ if (! $?LMOD_SYSTEM_DEFAULT_MODULES) then; setenv LMOD_SYSTEM_DEFAULT_MODULES "E setenv MODULEPATH /cvmfs/software.eessi.io/versions/"$EESSI_VERSION"/init/modules source /cvmfs/software.eessi.io/versions/"$EESSI_VERSION"/compat/linux/`uname -m`/usr/share/Lmod/init/csh +setenv PS1 $PS1 module load "$LMOD_SYSTEM_DEFAULT_MODULES" diff --git a/init/fish b/init/fish index f391dc366b..f5659edcf4 100644 --- a/init/fish +++ b/init/fish @@ -6,4 +6,5 @@ set -x LMOD_SYSTEM_DEFAULT_MODULES (set -q LMOD_SYSTEM_DEFAULT_MODULE; and echo set -x MODULEPATH /cvmfs/software.eessi.io/versions/"$EESSI_VERSION"/init/modules . /cvmfs/software.eessi.io/versions/"$EESSI_VERSION"/compat/linux/$(uname -m)/usr/share/Lmod/init/fish +set -x PS1 $PS1 module load $LMOD_SYSTEM_DEFAULT_MODULES diff --git a/init/ksh b/init/ksh index d6cefe85c4..a849f1b0d9 100644 --- a/init/ksh +++ b/init/ksh @@ -6,4 +6,5 @@ export LMOD_SYSTEM_DEFAULT_MODULES="${LMOD_SYSTEM_DEFAULT_MODULES:-EESSI/${EESSI export MODULEPATH=/cvmfs/software.eessi.io/versions/"$EESSI_VERSION"/init/modules . /cvmfs/software.eessi.io/versions/"$EESSI_VERSION"/compat/linux/$(uname -m)/usr/share/Lmod/init/ksh +export PS1=$PS1 module load "$LMOD_SYSTEM_DEFAULT_MODULES" diff --git a/init/zsh b/init/zsh index b11c08459b..e3efbd87e2 100644 --- a/init/zsh +++ b/init/zsh @@ -6,4 +6,5 @@ export LMOD_SYSTEM_DEFAULT_MODULES="${LMOD_SYSTEM_DEFAULT_MODULES:-EESSI/${EESSI export MODULEPATH=/cvmfs/software.eessi.io/versions/"$EESSI_VERSION"/init/modules . /cvmfs/software.eessi.io/versions/"$EESSI_VERSION"/compat/linux/$(uname -m)/usr/share/Lmod/init/zsh +export PS1=$PS1 module load "$LMOD_SYSTEM_DEFAULT_MODULES" From b14cef843a13e51c2871fd9a4d8e4d7e74cb349a Mon Sep 17 00:00:00 2001 From: makanu Date: Tue, 13 Aug 2024 21:17:39 +0000 Subject: [PATCH 07/31] Implement module load following doc --- init/bash | 15 +++++++++++---- init/csh | 15 +++++++++++---- init/fish | 14 ++++++++++---- init/ksh | 15 +++++++++++---- init/zsh | 15 +++++++++++---- 5 files changed, 54 insertions(+), 20 deletions(-) diff --git a/init/bash b/init/bash index 4cd3fbe701..0451601679 100644 --- a/init/bash +++ b/init/bash @@ -1,10 +1,17 @@ # Choose an EESSI version EESSI_VERSION="${EESSI_VERSION:-2023.06}" -# Automatically load the module for EESSI version -export LMOD_SYSTEM_DEFAULT_MODULES="${LMOD_SYSTEM_DEFAULT_MODULES:-EESSI/${EESSI_VERSION}}" # Path to top-level module tree export MODULEPATH=/cvmfs/software.eessi.io/versions/"$EESSI_VERSION"/init/modules . /cvmfs/software.eessi.io/versions/"$EESSI_VERSION"/compat/linux/$(uname -m)/usr/share/Lmod/init/bash -export PS1=$PS1 -module load "$LMOD_SYSTEM_DEFAULT_MODULES" +export PS1 +if [ -z "$__Init_Default_Modules" ]; then + export __Init_Default_Modules=1; + + ## ability to predefine elsewhere the default list + LMOD_SYSTEM_DEFAULT_MODULES=${LMOD_SYSTEM_DEFAULT_MODULES:-"StdEnv"} + export LMOD_SYSTEM_DEFAULT_MODULES + module --initial_load --no_redirect restore +else + module refresh +fi diff --git a/init/csh b/init/csh index e71f4a9e81..920581fccb 100644 --- a/init/csh +++ b/init/csh @@ -1,11 +1,18 @@ # Choose an EESSI version if (! $?EESSI_VERSION) then; set EESSI_VERSION = "2023.06"; endif -# Automatically load the module for EESSI version -if (! $?LMOD_SYSTEM_DEFAULT_MODULES) then; setenv LMOD_SYSTEM_DEFAULT_MODULES "EESSI/$EESSI_VERSION"; endif # Path to top-level module tree setenv MODULEPATH /cvmfs/software.eessi.io/versions/"$EESSI_VERSION"/init/modules source /cvmfs/software.eessi.io/versions/"$EESSI_VERSION"/compat/linux/`uname -m`/usr/share/Lmod/init/csh -setenv PS1 $PS1 -module load "$LMOD_SYSTEM_DEFAULT_MODULES" +setenv PS1 $prompt +if (! $?__Init_Default_Modules ) then + setenv __Init_Default_Modules 1; + + ## ability to predefine elsewhere the default list + if (! $?LMOD_SYSTEM_DEFAULT_MODULES) then; setenv LMOD_SYSTEM_DEFAULT_MODULES "StdEnv"; endif + module --initial_load --no_redirect restore +else + module refresh +endif +#module load "$LMOD_SYSTEM_DEFAULT_MODULES" diff --git a/init/fish b/init/fish index f5659edcf4..9ae68b39dc 100644 --- a/init/fish +++ b/init/fish @@ -1,10 +1,16 @@ # Choose an EESSI version set EESSI_VERSION (set -q EESSI_VERSION; and echo "$EESSI_VERSION"; or echo "2023.06") -# Automatically load the module for EESSI version -set -x LMOD_SYSTEM_DEFAULT_MODULES (set -q LMOD_SYSTEM_DEFAULT_MODULE; and echo "$LMOD_SYSTEM_DEFAULT_MODULE"; or echo "EESSI/$EESSI_VERSION") # Path to top-level module tree set -x MODULEPATH /cvmfs/software.eessi.io/versions/"$EESSI_VERSION"/init/modules . /cvmfs/software.eessi.io/versions/"$EESSI_VERSION"/compat/linux/$(uname -m)/usr/share/Lmod/init/fish -set -x PS1 $PS1 -module load $LMOD_SYSTEM_DEFAULT_MODULES +export PS1 +if test -z "$__Init_Default_Modules" + export __Init_Default_Modules=1; + + ## ability to predefine elsewhere the default list + set -x LMOD_SYSTEM_DEFAULT_MODULES (set -q LMOD_SYSTEM_DEFAULT_MODULE; and echo "$LMOD_SYSTEM_DEFAULT_MODULE"; or echo "StdEnv") + module --initial_load --no_redirect restore +else + module refresh +end diff --git a/init/ksh b/init/ksh index a849f1b0d9..e4eaafb2e6 100644 --- a/init/ksh +++ b/init/ksh @@ -1,10 +1,17 @@ # Choose an EESSI version EESSI_VERSION="${EESSI_VERSION:-2023.06}" -# Automatically load the module for EESSI version -export LMOD_SYSTEM_DEFAULT_MODULES="${LMOD_SYSTEM_DEFAULT_MODULES:-EESSI/${EESSI_VERSION}}" # Path to top-level module tree export MODULEPATH=/cvmfs/software.eessi.io/versions/"$EESSI_VERSION"/init/modules . /cvmfs/software.eessi.io/versions/"$EESSI_VERSION"/compat/linux/$(uname -m)/usr/share/Lmod/init/ksh -export PS1=$PS1 -module load "$LMOD_SYSTEM_DEFAULT_MODULES" +export PS1 +if [ -z "$__Init_Default_Modules" ]; then + export __Init_Default_Modules=1; + + ## ability to predefine elsewhere the default list + LMOD_SYSTEM_DEFAULT_MODULES=${LMOD_SYSTEM_DEFAULT_MODULES:-"StdEnv"} + export LMOD_SYSTEM_DEFAULT_MODULES + module --initial_load --no_redirect restore +else + module refresh +fi diff --git a/init/zsh b/init/zsh index e3efbd87e2..90ffeff4ef 100644 --- a/init/zsh +++ b/init/zsh @@ -1,10 +1,17 @@ # Choose an EESSI version EESSI_VERSION="${EESSI_VERSION:-2023.06}" -# Automatically load the module for EESSI version -export LMOD_SYSTEM_DEFAULT_MODULES="${LMOD_SYSTEM_DEFAULT_MODULES:-EESSI/${EESSI_VERSION}}" # Path to top-level module tree export MODULEPATH=/cvmfs/software.eessi.io/versions/"$EESSI_VERSION"/init/modules . /cvmfs/software.eessi.io/versions/"$EESSI_VERSION"/compat/linux/$(uname -m)/usr/share/Lmod/init/zsh -export PS1=$PS1 -module load "$LMOD_SYSTEM_DEFAULT_MODULES" +export PS1 +if [ -z "$__Init_Default_Modules" ]; then + export __Init_Default_Modules=1; + + ## ability to predefine elsewhere the default list + LMOD_SYSTEM_DEFAULT_MODULES=${LMOD_SYSTEM_DEFAULT_MODULES:-"StdEnv"} + export LMOD_SYSTEM_DEFAULT_MODULES + module --initial_load --no_redirect restore +else + module refresh +fi From 1aa8cb80d64dd9f352fd8623166b281c8ae499a6 Mon Sep 17 00:00:00 2001 From: makanu Date: Fri, 16 Aug 2024 13:58:00 +0000 Subject: [PATCH 08/31] Add init scripts test - add test script - add github actions --- .../workflows/scripts/test_init_scripts.sh | 58 +++++++++++++++++++ .github/workflows/tests_init_module.yml | 44 ++++++++++++++ 2 files changed, 102 insertions(+) create mode 100755 .github/workflows/scripts/test_init_scripts.sh create mode 100644 .github/workflows/tests_init_module.yml diff --git a/.github/workflows/scripts/test_init_scripts.sh b/.github/workflows/scripts/test_init_scripts.sh new file mode 100755 index 0000000000..3a486eb0e2 --- /dev/null +++ b/.github/workflows/scripts/test_init_scripts.sh @@ -0,0 +1,58 @@ +#!/bin/bash +EESSI_VERSION="2023.06" +export LMOD_PAGER=cat + +# 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 +fi +. assert.sh/assert.sh + +SHELLS=$@ + +for shell in ${SHELLS[@]}; do + echo = | awk 'NF += (OFS = $_) + 100' + echo RUNNING TESTS FOR SHELL: $shell + echo = | awk 'NF += (OFS = $_) + 100' + + # TEST 1: Source Script and check Module Output + assert "$shell -c 'source init/$shell' 2>&1 " "EESSI/$EESSI_VERSION loaded successfully" + # TEST 2: Check PS1 Prompt (Previous exported) + PROMPT="${shell^^}_PROMPT" + assert "echo ${!PROMPT}" "{EESSI $EESSI_VERSION}" + # Test 3: Check module overview + MODULE_SECTIONS=($($shell -c "source init/$shell 2>/dev/null; module ov 2>&1 | grep -e '---'")) + assert "echo ${MODULE_SECTIONS[1]}" "/cvmfs/software.eessi.io/versions/$EESSI_VERSION/software/linux/x86_64/intel/haswell/modules/all" + assert "echo ${MODULE_SECTIONS[4]}" "/home/eessi/EESSI_testing/modules" + # Test 4: Load Python module and check version and path + command="$shell -c 'source init/$shell 2>/dev/null; module load Python/3.10.8-GCCcore-12.2.0; python --version'" + expected="Python 3.10.8" + assert "$command" "$expected" + command="$shell -c 'source init/$shell 2>/dev/null; module load Python/3.10.8-GCCcore-12.2.0; which python'" + expected="/cvmfs/software.eessi.io/versions/$EESSI_VERSION/software/linux/x86_64/intel/haswell/software/Python/3.10.8-GCCcore-12.2.0/bin/python" + assert "$command" "$expected" +done + +#ZSH TESTS +#assert "zsh -c 'source init/zsh' 2>&1 " "EESSI/$EESSI_VERSION loaded successfully" +#assert "echo $ZSH_PROMPT" "{EESSI $EESSI_VERSION}" + +#KSH TESTS +#assert "ksh -c 'source init/ksh' 2>&1 " "EESSI/$EESSI_VERSION loaded successfully" +#assert "echo $KSH_PROMPT" "{EESSI $EESSI_VERSION}" + +#FISH TESTS +#assert "fish -c 'source init/fish' 2>&1 " "EESSI/$EESSI_VERSION loaded successfully" +#assert "echo $FISH_PROMPT" "{EESSI $EESSI_VERSION}" + +#CSH TESTS +#assert "csh -c 'source init/csh' 2>&1 " "EESSI/$EESSI_VERSION loaded successfully" +#assert "echo $CSH_PROMPT" "{EESSI $EESSI_VERSION}" + +assert_end source_eessi + +# RESET PAGER +export LMOD_PAGER= diff --git a/.github/workflows/tests_init_module.yml b/.github/workflows/tests_init_module.yml new file mode 100644 index 0000000000..952a58b7e1 --- /dev/null +++ b/.github/workflows/tests_init_module.yml @@ -0,0 +1,44 @@ +# documentation: https://help.github.com/en/articles/workflow-syntax-for-github-actions +name: Check for EESSI init shell scripts to load eessi software module in software.eessi.io +on: + push: + branches: [ "*-software.eessi.io" ] + pull_request: + workflow_dispatch: +permissions: + contents: read # to fetch code (actions/checkout) +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + EESSI_VERSION: + - 2023.06 + EESSI_SOFTWARE_SUBDIR_OVERRIDE: + - x86_64/generic + fail-fast: false + steps: + - name: Check out software-layer repository + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + - name: Mount EESSI CernVM-FS pilot repository + uses: cvmfs-contrib/github-action-cvmfs@55899ca74cf78ab874bdf47f5a804e47c198743c # v4.0 + with: + cvmfs_config_package: https://github.com/EESSI/filesystem-layer/releases/download/latest/cvmfs-config-eessi_latest_all.deb + cvmfs_http_proxy: DIRECT + cvmfs_repositories: software.eessi.io + + - name: Clone assert.sh script + run: git clone https://github.com/lehmannro/assert.sh.git + + - name: Prepare PROMPT variables + run: | + export BASH_PROMPT=$(bash -c 'source init/bash; echo "$PS1"') + export ZSH_PROMPT=$(zsh -c 'source init/zsh; echo "$PS1"') + export KSH_PROMPT=$(ksh -c 'source init/ksh; echo "$PS1"') + export FISH_PROMPT=$(fish -c 'source init/fish; echo "$PS1"') + + - name: Run tests for available shells + run: | + .github/workflows/scripts/test_init_scripts.sh "bash" "zsh" "ksh" "fish" + From 0b6bc542727b9b2e2263cf497adc4b6bfdc29ec9 Mon Sep 17 00:00:00 2001 From: makanu Date: Fri, 16 Aug 2024 14:02:57 +0000 Subject: [PATCH 09/31] Cleanup script and FIX init module path --- .github/workflows/scripts/test_init_scripts.sh | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/.github/workflows/scripts/test_init_scripts.sh b/.github/workflows/scripts/test_init_scripts.sh index 3a486eb0e2..99fefecdf8 100755 --- a/.github/workflows/scripts/test_init_scripts.sh +++ b/.github/workflows/scripts/test_init_scripts.sh @@ -26,7 +26,7 @@ for shell in ${SHELLS[@]}; do # Test 3: Check module overview MODULE_SECTIONS=($($shell -c "source init/$shell 2>/dev/null; module ov 2>&1 | grep -e '---'")) assert "echo ${MODULE_SECTIONS[1]}" "/cvmfs/software.eessi.io/versions/$EESSI_VERSION/software/linux/x86_64/intel/haswell/modules/all" - assert "echo ${MODULE_SECTIONS[4]}" "/home/eessi/EESSI_testing/modules" + assert "echo ${MODULE_SECTIONS[4]}" "/cvmfs/software.eessi.io/versions/$EESSI_VERSION/init/modules" # Test 4: Load Python module and check version and path command="$shell -c 'source init/$shell 2>/dev/null; module load Python/3.10.8-GCCcore-12.2.0; python --version'" expected="Python 3.10.8" @@ -36,22 +36,6 @@ for shell in ${SHELLS[@]}; do assert "$command" "$expected" done -#ZSH TESTS -#assert "zsh -c 'source init/zsh' 2>&1 " "EESSI/$EESSI_VERSION loaded successfully" -#assert "echo $ZSH_PROMPT" "{EESSI $EESSI_VERSION}" - -#KSH TESTS -#assert "ksh -c 'source init/ksh' 2>&1 " "EESSI/$EESSI_VERSION loaded successfully" -#assert "echo $KSH_PROMPT" "{EESSI $EESSI_VERSION}" - -#FISH TESTS -#assert "fish -c 'source init/fish' 2>&1 " "EESSI/$EESSI_VERSION loaded successfully" -#assert "echo $FISH_PROMPT" "{EESSI $EESSI_VERSION}" - -#CSH TESTS -#assert "csh -c 'source init/csh' 2>&1 " "EESSI/$EESSI_VERSION loaded successfully" -#assert "echo $CSH_PROMPT" "{EESSI $EESSI_VERSION}" - assert_end source_eessi # RESET PAGER From 4aa7d00682cd92161aaffff79bc2bd01f8e17ca1 Mon Sep 17 00:00:00 2001 From: makanu Date: Fri, 16 Aug 2024 14:05:35 +0000 Subject: [PATCH 10/31] Use haswell for testing not sure what the output for generic would be. But different arches should be already tested on module --- .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 952a58b7e1..f9d99e3e4f 100644 --- a/.github/workflows/tests_init_module.yml +++ b/.github/workflows/tests_init_module.yml @@ -15,7 +15,7 @@ jobs: EESSI_VERSION: - 2023.06 EESSI_SOFTWARE_SUBDIR_OVERRIDE: - - x86_64/generic + - x86_64/haswell fail-fast: false steps: - name: Check out software-layer repository From 71543e312745552409ebd137b1a3c6ee60b5e9a0 Mon Sep 17 00:00:00 2001 From: makanu Date: Fri, 16 Aug 2024 14:45:24 +0000 Subject: [PATCH 11/31] Fix Pipeline - Fix Format --- .github/workflows/tests_init_module.yml | 44 ++++++++++++------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/.github/workflows/tests_init_module.yml b/.github/workflows/tests_init_module.yml index f9d99e3e4f..6edfbb41e9 100644 --- a/.github/workflows/tests_init_module.yml +++ b/.github/workflows/tests_init_module.yml @@ -11,34 +11,34 @@ jobs: build: runs-on: ubuntu-latest strategy: + fail-fast: false matrix: EESSI_VERSION: - - 2023.06 + - 2023.06 EESSI_SOFTWARE_SUBDIR_OVERRIDE: - - x86_64/haswell - fail-fast: false + - x86_64/haswell steps: - - name: Check out software-layer repository - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + - name: Check out software-layer repository + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - name: Mount EESSI CernVM-FS pilot repository - uses: cvmfs-contrib/github-action-cvmfs@55899ca74cf78ab874bdf47f5a804e47c198743c # v4.0 - with: - cvmfs_config_package: https://github.com/EESSI/filesystem-layer/releases/download/latest/cvmfs-config-eessi_latest_all.deb - cvmfs_http_proxy: DIRECT - cvmfs_repositories: software.eessi.io + - name: Mount EESSI CernVM-FS pilot repository + uses: cvmfs-contrib/github-action-cvmfs@55899ca74cf78ab874bdf47f5a804e47c198743c # v4.0 + with: + cvmfs_config_package: https://github.com/EESSI/filesystem-layer/releases/download/latest/cvmfs-config-eessi_latest_all.deb + cvmfs_http_proxy: DIRECT + cvmfs_repositories: software.eessi.io - - name: Clone assert.sh script - run: git clone https://github.com/lehmannro/assert.sh.git + - name: Clone assert.sh script + run: git clone https://github.com/lehmannro/assert.sh.git - - name: Prepare PROMPT variables - run: | - export BASH_PROMPT=$(bash -c 'source init/bash; echo "$PS1"') - export ZSH_PROMPT=$(zsh -c 'source init/zsh; echo "$PS1"') - export KSH_PROMPT=$(ksh -c 'source init/ksh; echo "$PS1"') - export FISH_PROMPT=$(fish -c 'source init/fish; echo "$PS1"') + - name: Prepare PROMPT variables + run: | + export BASH_PROMPT=$(bash -c 'source init/bash; echo "$PS1"') + export ZSH_PROMPT=$(zsh -c 'source init/zsh; echo "$PS1"') + export KSH_PROMPT=$(ksh -c 'source init/ksh; echo "$PS1"') + export FISH_PROMPT=$(fish -c 'source init/fish; echo "$PS1"') - - name: Run tests for available shells - run: | - .github/workflows/scripts/test_init_scripts.sh "bash" "zsh" "ksh" "fish" + - name: Run tests for available shells + run: | + .github/workflows/scripts/test_init_scripts.sh "bash" "zsh" "ksh" "fish" From ea32ffe4160ec60b180235061e84127a323aa78e Mon Sep 17 00:00:00 2001 From: makanu Date: Fri, 16 Aug 2024 14:50:34 +0000 Subject: [PATCH 12/31] Add StdEnv.lua module --- init/modules/StdEnv.lua | 1 + 1 file changed, 1 insertion(+) create mode 100644 init/modules/StdEnv.lua diff --git a/init/modules/StdEnv.lua b/init/modules/StdEnv.lua new file mode 100644 index 0000000000..ae34402e9a --- /dev/null +++ b/init/modules/StdEnv.lua @@ -0,0 +1 @@ +load("EESSI/2023.06") From bb3c8bd589dde2bbea78a38866e5084651e3c148 Mon Sep 17 00:00:00 2001 From: makanu Date: Fri, 16 Aug 2024 14:54:18 +0000 Subject: [PATCH 13/31] Install Shells on github actions --- .github/workflows/tests_init_module.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/tests_init_module.yml b/.github/workflows/tests_init_module.yml index 6edfbb41e9..c2cbf8f8e5 100644 --- a/.github/workflows/tests_init_module.yml +++ b/.github/workflows/tests_init_module.yml @@ -31,6 +31,11 @@ jobs: - name: Clone assert.sh script run: git clone https://github.com/lehmannro/assert.sh.git + - name: Install missing shells + run: | + apt install zsh ksh fish + echo "# INIT ZSH" > ~/.zshrc + - name: Prepare PROMPT variables run: | export BASH_PROMPT=$(bash -c 'source init/bash; echo "$PS1"') From 385aee024808a1beaa2e483448ebf82526bf40b1 Mon Sep 17 00:00:00 2001 From: makanu Date: Fri, 16 Aug 2024 14:57:10 +0000 Subject: [PATCH 14/31] Fix requirements install on github action --- .github/workflows/tests_init_module.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests_init_module.yml b/.github/workflows/tests_init_module.yml index c2cbf8f8e5..58c48c5b68 100644 --- a/.github/workflows/tests_init_module.yml +++ b/.github/workflows/tests_init_module.yml @@ -33,7 +33,8 @@ jobs: - name: Install missing shells run: | - apt install zsh ksh fish + sudo apt update + sudo apt install zsh ksh fish echo "# INIT ZSH" > ~/.zshrc - name: Prepare PROMPT variables From 461c941b130a238a88e4e07025b6f406573e0e9c Mon Sep 17 00:00:00 2001 From: makanu Date: Mon, 19 Aug 2024 08:34:18 +0000 Subject: [PATCH 15/31] Fix Fish command call issue --- init/fish | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init/fish b/init/fish index 9ae68b39dc..33952769e1 100644 --- a/init/fish +++ b/init/fish @@ -2,7 +2,7 @@ set EESSI_VERSION (set -q EESSI_VERSION; and echo "$EESSI_VERSION"; or echo "2023.06") # Path to top-level module tree set -x MODULEPATH /cvmfs/software.eessi.io/versions/"$EESSI_VERSION"/init/modules -. /cvmfs/software.eessi.io/versions/"$EESSI_VERSION"/compat/linux/$(uname -m)/usr/share/Lmod/init/fish +. /cvmfs/software.eessi.io/versions/"$EESSI_VERSION"/compat/linux/(uname -m)/usr/share/Lmod/init/fish export PS1 if test -z "$__Init_Default_Modules" From fcf493758852e9842812a314e5e690f739ee9e9d Mon Sep 17 00:00:00 2001 From: makanu Date: Fri, 6 Sep 2024 06:25:55 +0000 Subject: [PATCH 16/31] move init scripts into init/lmod - move new scripts - copy bash --- init/lmod/bash | 17 +++++++++++++++++ init/{ => lmod}/csh | 0 init/{ => lmod}/fish | 0 init/{ => lmod}/ksh | 0 init/{ => lmod}/zsh | 0 5 files changed, 17 insertions(+) create mode 100644 init/lmod/bash rename init/{ => lmod}/csh (100%) rename init/{ => lmod}/fish (100%) rename init/{ => lmod}/ksh (100%) rename init/{ => lmod}/zsh (100%) diff --git a/init/lmod/bash b/init/lmod/bash new file mode 100644 index 0000000000..0451601679 --- /dev/null +++ b/init/lmod/bash @@ -0,0 +1,17 @@ +# Choose an EESSI version +EESSI_VERSION="${EESSI_VERSION:-2023.06}" +# Path to top-level module tree +export MODULEPATH=/cvmfs/software.eessi.io/versions/"$EESSI_VERSION"/init/modules +. /cvmfs/software.eessi.io/versions/"$EESSI_VERSION"/compat/linux/$(uname -m)/usr/share/Lmod/init/bash + +export PS1 +if [ -z "$__Init_Default_Modules" ]; then + export __Init_Default_Modules=1; + + ## ability to predefine elsewhere the default list + LMOD_SYSTEM_DEFAULT_MODULES=${LMOD_SYSTEM_DEFAULT_MODULES:-"StdEnv"} + export LMOD_SYSTEM_DEFAULT_MODULES + module --initial_load --no_redirect restore +else + module refresh +fi diff --git a/init/csh b/init/lmod/csh similarity index 100% rename from init/csh rename to init/lmod/csh diff --git a/init/fish b/init/lmod/fish similarity index 100% rename from init/fish rename to init/lmod/fish diff --git a/init/ksh b/init/lmod/ksh similarity index 100% rename from init/ksh rename to init/lmod/ksh diff --git a/init/zsh b/init/lmod/zsh similarity index 100% rename from init/zsh rename to init/lmod/zsh From 032cdae88f319ab247f513ab91cb0ead3a28e873 Mon Sep 17 00:00:00 2001 From: makanu Date: Fri, 6 Sep 2024 06:32:03 +0000 Subject: [PATCH 17/31] Revert a0c4377e restore original content of bash init --- init/bash | 56 +++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 40 insertions(+), 16 deletions(-) diff --git a/init/bash b/init/bash index 0451601679..4ad09f6a1b 100644 --- a/init/bash +++ b/init/bash @@ -1,17 +1,41 @@ -# Choose an EESSI version -EESSI_VERSION="${EESSI_VERSION:-2023.06}" -# Path to top-level module tree -export MODULEPATH=/cvmfs/software.eessi.io/versions/"$EESSI_VERSION"/init/modules -. /cvmfs/software.eessi.io/versions/"$EESSI_VERSION"/compat/linux/$(uname -m)/usr/share/Lmod/init/bash - -export PS1 -if [ -z "$__Init_Default_Modules" ]; then - export __Init_Default_Modules=1; - - ## ability to predefine elsewhere the default list - LMOD_SYSTEM_DEFAULT_MODULES=${LMOD_SYSTEM_DEFAULT_MODULES:-"StdEnv"} - export LMOD_SYSTEM_DEFAULT_MODULES - module --initial_load --no_redirect restore -else - module refresh +function show_msg { + # only echo msg if EESSI_SILENT is unset + msg=$1 + if [[ -z ${EESSI_SILENT+x} ]]; then + echo "$msg" + fi +} + +# The following method should be safe, but might break if file is a symlink +# (could switch to $(dirname "$(readlink -f "$BASH_SOURCE")") in that case) +source $(dirname "$BASH_SOURCE")/eessi_environment_variables + +# only continue if setting EESSI environment variables worked fine +if [ $? -eq 0 ]; then + + export PS1="{EESSI $EESSI_VERSION} $PS1" + + # add location of commands provided by compat layer to $PATH; + # see https://github.com/EESSI/software-layer/issues/52 + export PATH=$EPREFIX/usr/bin:$EPREFIX/bin:$PATH + + # init Lmod + show_msg "Initializing Lmod..." + source $EESSI_EPREFIX/usr/share/Lmod/init/bash + + # prepend location of modules for EESSI software stack to $MODULEPATH + show_msg "Prepending $EESSI_MODULEPATH to \$MODULEPATH..." + module use $EESSI_MODULEPATH + show_msg "Prepending site path $EESSI_SITE_MODULEPATH to \$MODULEPATH..." + module use $EESSI_SITE_MODULEPATH + + #show_msg "" + #show_msg "*** Known problems in the ${EESSI_VERSION} software stack ***" + #show_msg "" + #show_msg "1) ..." + #show_msg "" + #show_msg "" + + echo "Environment set up to use EESSI (${EESSI_VERSION}), have fun!" + fi From 33b6b9267fef8b5cef81a553ea55583315a479b5 Mon Sep 17 00:00:00 2001 From: makanu Date: Fri, 6 Sep 2024 07:21:26 +0000 Subject: [PATCH 18/31] Use EESSI as LMOD SYSTEM DEFAULT makes StdEnv.lua unnecessary --- init/lmod/bash | 2 +- init/lmod/csh | 2 +- init/lmod/fish | 2 +- init/lmod/ksh | 2 +- init/lmod/zsh | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/init/lmod/bash b/init/lmod/bash index 0451601679..563187ecd1 100644 --- a/init/lmod/bash +++ b/init/lmod/bash @@ -9,7 +9,7 @@ if [ -z "$__Init_Default_Modules" ]; then export __Init_Default_Modules=1; ## ability to predefine elsewhere the default list - LMOD_SYSTEM_DEFAULT_MODULES=${LMOD_SYSTEM_DEFAULT_MODULES:-"StdEnv"} + LMOD_SYSTEM_DEFAULT_MODULES=${LMOD_SYSTEM_DEFAULT_MODULES:-"EESSI/$EESSI_VERSION"} export LMOD_SYSTEM_DEFAULT_MODULES module --initial_load --no_redirect restore else diff --git a/init/lmod/csh b/init/lmod/csh index 920581fccb..40fe099fc4 100644 --- a/init/lmod/csh +++ b/init/lmod/csh @@ -9,7 +9,7 @@ if (! $?__Init_Default_Modules ) then setenv __Init_Default_Modules 1; ## ability to predefine elsewhere the default list - if (! $?LMOD_SYSTEM_DEFAULT_MODULES) then; setenv LMOD_SYSTEM_DEFAULT_MODULES "StdEnv"; endif + if (! $?LMOD_SYSTEM_DEFAULT_MODULES) then; setenv LMOD_SYSTEM_DEFAULT_MODULES "EESSI/$EESSI_VERSION"; endif module --initial_load --no_redirect restore else module refresh diff --git a/init/lmod/fish b/init/lmod/fish index 33952769e1..17dfee9859 100644 --- a/init/lmod/fish +++ b/init/lmod/fish @@ -9,7 +9,7 @@ if test -z "$__Init_Default_Modules" export __Init_Default_Modules=1; ## ability to predefine elsewhere the default list - set -x LMOD_SYSTEM_DEFAULT_MODULES (set -q LMOD_SYSTEM_DEFAULT_MODULE; and echo "$LMOD_SYSTEM_DEFAULT_MODULE"; or echo "StdEnv") + set -x LMOD_SYSTEM_DEFAULT_MODULES (set -q LMOD_SYSTEM_DEFAULT_MODULE; and echo "$LMOD_SYSTEM_DEFAULT_MODULE"; or echo "EESSI/$EESSI_VERSION") module --initial_load --no_redirect restore else module refresh diff --git a/init/lmod/ksh b/init/lmod/ksh index e4eaafb2e6..ca7336f9ed 100644 --- a/init/lmod/ksh +++ b/init/lmod/ksh @@ -9,7 +9,7 @@ if [ -z "$__Init_Default_Modules" ]; then export __Init_Default_Modules=1; ## ability to predefine elsewhere the default list - LMOD_SYSTEM_DEFAULT_MODULES=${LMOD_SYSTEM_DEFAULT_MODULES:-"StdEnv"} + LMOD_SYSTEM_DEFAULT_MODULES=${LMOD_SYSTEM_DEFAULT_MODULES:-"EESSI/$EESSI_VERSION"} export LMOD_SYSTEM_DEFAULT_MODULES module --initial_load --no_redirect restore else diff --git a/init/lmod/zsh b/init/lmod/zsh index 90ffeff4ef..33b29cad3f 100644 --- a/init/lmod/zsh +++ b/init/lmod/zsh @@ -9,7 +9,7 @@ if [ -z "$__Init_Default_Modules" ]; then export __Init_Default_Modules=1; ## ability to predefine elsewhere the default list - LMOD_SYSTEM_DEFAULT_MODULES=${LMOD_SYSTEM_DEFAULT_MODULES:-"StdEnv"} + LMOD_SYSTEM_DEFAULT_MODULES=${LMOD_SYSTEM_DEFAULT_MODULES:-"EESSI/$EESSI_VERSION"} export LMOD_SYSTEM_DEFAULT_MODULES module --initial_load --no_redirect restore else From d4bc3bc54907906f49691ec0e640589de5d3280c Mon Sep 17 00:00:00 2001 From: makanu Date: Fri, 6 Sep 2024 07:21:46 +0000 Subject: [PATCH 19/31] Revert "Add StdEnv.lua module" This reverts commit ea32ffe4160ec60b180235061e84127a323aa78e. --- init/modules/StdEnv.lua | 1 - 1 file changed, 1 deletion(-) delete mode 100644 init/modules/StdEnv.lua diff --git a/init/modules/StdEnv.lua b/init/modules/StdEnv.lua deleted file mode 100644 index ae34402e9a..0000000000 --- a/init/modules/StdEnv.lua +++ /dev/null @@ -1 +0,0 @@ -load("EESSI/2023.06") From 63482f5c3c759260eda5f75c2f868a8d30efa956 Mon Sep 17 00:00:00 2001 From: makanu Date: Fri, 6 Sep 2024 14:54:50 +0000 Subject: [PATCH 20/31] Remove PS1 export handling PS1 variable is moved to later PR --- init/lmod/bash | 1 - init/lmod/csh | 1 - init/lmod/fish | 1 - init/lmod/ksh | 1 - init/lmod/zsh | 1 - 5 files changed, 5 deletions(-) diff --git a/init/lmod/bash b/init/lmod/bash index 563187ecd1..b4941d6766 100644 --- a/init/lmod/bash +++ b/init/lmod/bash @@ -4,7 +4,6 @@ EESSI_VERSION="${EESSI_VERSION:-2023.06}" export MODULEPATH=/cvmfs/software.eessi.io/versions/"$EESSI_VERSION"/init/modules . /cvmfs/software.eessi.io/versions/"$EESSI_VERSION"/compat/linux/$(uname -m)/usr/share/Lmod/init/bash -export PS1 if [ -z "$__Init_Default_Modules" ]; then export __Init_Default_Modules=1; diff --git a/init/lmod/csh b/init/lmod/csh index 40fe099fc4..5ae13fcc50 100644 --- a/init/lmod/csh +++ b/init/lmod/csh @@ -4,7 +4,6 @@ if (! $?EESSI_VERSION) then; set EESSI_VERSION = "2023.06"; endif setenv MODULEPATH /cvmfs/software.eessi.io/versions/"$EESSI_VERSION"/init/modules source /cvmfs/software.eessi.io/versions/"$EESSI_VERSION"/compat/linux/`uname -m`/usr/share/Lmod/init/csh -setenv PS1 $prompt if (! $?__Init_Default_Modules ) then setenv __Init_Default_Modules 1; diff --git a/init/lmod/fish b/init/lmod/fish index 17dfee9859..d4252ef32a 100644 --- a/init/lmod/fish +++ b/init/lmod/fish @@ -4,7 +4,6 @@ set EESSI_VERSION (set -q EESSI_VERSION; and echo "$EESSI_VERSION"; or echo "202 set -x MODULEPATH /cvmfs/software.eessi.io/versions/"$EESSI_VERSION"/init/modules . /cvmfs/software.eessi.io/versions/"$EESSI_VERSION"/compat/linux/(uname -m)/usr/share/Lmod/init/fish -export PS1 if test -z "$__Init_Default_Modules" export __Init_Default_Modules=1; diff --git a/init/lmod/ksh b/init/lmod/ksh index ca7336f9ed..71dc29542f 100644 --- a/init/lmod/ksh +++ b/init/lmod/ksh @@ -4,7 +4,6 @@ EESSI_VERSION="${EESSI_VERSION:-2023.06}" export MODULEPATH=/cvmfs/software.eessi.io/versions/"$EESSI_VERSION"/init/modules . /cvmfs/software.eessi.io/versions/"$EESSI_VERSION"/compat/linux/$(uname -m)/usr/share/Lmod/init/ksh -export PS1 if [ -z "$__Init_Default_Modules" ]; then export __Init_Default_Modules=1; diff --git a/init/lmod/zsh b/init/lmod/zsh index 33b29cad3f..5f605579c8 100644 --- a/init/lmod/zsh +++ b/init/lmod/zsh @@ -4,7 +4,6 @@ EESSI_VERSION="${EESSI_VERSION:-2023.06}" export MODULEPATH=/cvmfs/software.eessi.io/versions/"$EESSI_VERSION"/init/modules . /cvmfs/software.eessi.io/versions/"$EESSI_VERSION"/compat/linux/$(uname -m)/usr/share/Lmod/init/zsh -export PS1 if [ -z "$__Init_Default_Modules" ]; then export __Init_Default_Modules=1; From 7f95d5e3478f6aa16cef41628ad718d069b83b7f Mon Sep 17 00:00:00 2001 From: makanu Date: Fri, 6 Sep 2024 14:58:26 +0000 Subject: [PATCH 21/31] Update init scripts path in test script from `/init/$shell` to `/init/lmod/$shell` --- .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 99fefecdf8..06b658d988 100755 --- a/.github/workflows/scripts/test_init_scripts.sh +++ b/.github/workflows/scripts/test_init_scripts.sh @@ -19,19 +19,19 @@ for shell in ${SHELLS[@]}; do echo = | awk 'NF += (OFS = $_) + 100' # TEST 1: Source Script and check Module Output - assert "$shell -c 'source init/$shell' 2>&1 " "EESSI/$EESSI_VERSION loaded successfully" + assert "$shell -c 'source init/lmod/$shell' 2>&1 " "EESSI/$EESSI_VERSION loaded successfully" # TEST 2: Check PS1 Prompt (Previous exported) PROMPT="${shell^^}_PROMPT" assert "echo ${!PROMPT}" "{EESSI $EESSI_VERSION}" # Test 3: Check module overview - MODULE_SECTIONS=($($shell -c "source init/$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 '---'")) assert "echo ${MODULE_SECTIONS[1]}" "/cvmfs/software.eessi.io/versions/$EESSI_VERSION/software/linux/x86_64/intel/haswell/modules/all" assert "echo ${MODULE_SECTIONS[4]}" "/cvmfs/software.eessi.io/versions/$EESSI_VERSION/init/modules" # Test 4: Load Python module and check version and path - command="$shell -c 'source init/$shell 2>/dev/null; module load Python/3.10.8-GCCcore-12.2.0; python --version'" + command="$shell -c 'source init/lmod/$shell 2>/dev/null; module load Python/3.10.8-GCCcore-12.2.0; python --version'" expected="Python 3.10.8" assert "$command" "$expected" - command="$shell -c 'source init/$shell 2>/dev/null; module load Python/3.10.8-GCCcore-12.2.0; which python'" + command="$shell -c 'source init/lmod/$shell 2>/dev/null; module load Python/3.10.8-GCCcore-12.2.0; which python'" expected="/cvmfs/software.eessi.io/versions/$EESSI_VERSION/software/linux/x86_64/intel/haswell/software/Python/3.10.8-GCCcore-12.2.0/bin/python" assert "$command" "$expected" done From a2ce628df900072a4040b3950af53ba1a639afc6 Mon Sep 17 00:00:00 2001 From: makanu Date: Fri, 6 Sep 2024 15:00:23 +0000 Subject: [PATCH 22/31] Remove Prompt test from unittest since the delayed implementation of PS1 handling this test is removed --- .github/workflows/scripts/test_init_scripts.sh | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/scripts/test_init_scripts.sh b/.github/workflows/scripts/test_init_scripts.sh index 06b658d988..6e4f66af45 100755 --- a/.github/workflows/scripts/test_init_scripts.sh +++ b/.github/workflows/scripts/test_init_scripts.sh @@ -20,14 +20,11 @@ for shell in ${SHELLS[@]}; do # TEST 1: Source Script and check Module Output assert "$shell -c 'source init/lmod/$shell' 2>&1 " "EESSI/$EESSI_VERSION loaded successfully" - # TEST 2: Check PS1 Prompt (Previous exported) - PROMPT="${shell^^}_PROMPT" - assert "echo ${!PROMPT}" "{EESSI $EESSI_VERSION}" - # Test 3: Check module overview + # Test 2: Check module overview MODULE_SECTIONS=($($shell -c "source init/lmod/$shell 2>/dev/null; module ov 2>&1 | grep -e '---'")) assert "echo ${MODULE_SECTIONS[1]}" "/cvmfs/software.eessi.io/versions/$EESSI_VERSION/software/linux/x86_64/intel/haswell/modules/all" assert "echo ${MODULE_SECTIONS[4]}" "/cvmfs/software.eessi.io/versions/$EESSI_VERSION/init/modules" - # Test 4: Load Python module and check version and path + # Test 3: Load Python module and check version and path command="$shell -c 'source init/lmod/$shell 2>/dev/null; module load Python/3.10.8-GCCcore-12.2.0; python --version'" expected="Python 3.10.8" assert "$command" "$expected" From 2ab75c3daf7271ff6473638b2e78e994b74ad4b7 Mon Sep 17 00:00:00 2001 From: makanu Date: Fri, 6 Sep 2024 16:34:25 +0000 Subject: [PATCH 23/31] Rename Test Numbers - Classify each assert as a test - Give each test an number comment (increment) - Move `assert_end` into for loop to create seperate testsuite This results that failing test presents the matching number to the comment. --- .github/workflows/scripts/test_init_scripts.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/scripts/test_init_scripts.sh b/.github/workflows/scripts/test_init_scripts.sh index 6e4f66af45..24a59a90a3 100755 --- a/.github/workflows/scripts/test_init_scripts.sh +++ b/.github/workflows/scripts/test_init_scripts.sh @@ -20,20 +20,24 @@ for shell in ${SHELLS[@]}; do # TEST 1: Source Script and check Module Output assert "$shell -c 'source init/lmod/$shell' 2>&1 " "EESSI/$EESSI_VERSION loaded successfully" - # Test 2: Check module overview + # TEST 2: Check if module overviews first section is the loaded EESSI module MODULE_SECTIONS=($($shell -c "source init/lmod/$shell 2>/dev/null; module ov 2>&1 | grep -e '---'")) assert "echo ${MODULE_SECTIONS[1]}" "/cvmfs/software.eessi.io/versions/$EESSI_VERSION/software/linux/x86_64/intel/haswell/modules/all" + # 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 3: Load Python module and check version and path + # Test 4: Load Python module and check version command="$shell -c 'source init/lmod/$shell 2>/dev/null; module load Python/3.10.8-GCCcore-12.2.0; python --version'" expected="Python 3.10.8" assert "$command" "$expected" + # Test 5: Load Python module and check path command="$shell -c 'source init/lmod/$shell 2>/dev/null; module load Python/3.10.8-GCCcore-12.2.0; which python'" expected="/cvmfs/software.eessi.io/versions/$EESSI_VERSION/software/linux/x86_64/intel/haswell/software/Python/3.10.8-GCCcore-12.2.0/bin/python" assert "$command" "$expected" + + #End Test Suite + assert_end "source_eessi_$shell" done -assert_end source_eessi # RESET PAGER export LMOD_PAGER= From 7c798d4fc48e5ccfe5aa81e18d633fe6bfb8ca37 Mon Sep 17 00:00:00 2001 From: makanu Date: Fri, 6 Sep 2024 16:53:14 +0000 Subject: [PATCH 24/31] Remove PROMPT variable from action since delayed feature for PS1 manipulation this is no longer needed --- .github/workflows/tests_init_module.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/tests_init_module.yml b/.github/workflows/tests_init_module.yml index 58c48c5b68..f9283b68cd 100644 --- a/.github/workflows/tests_init_module.yml +++ b/.github/workflows/tests_init_module.yml @@ -37,13 +37,6 @@ jobs: sudo apt install zsh ksh fish echo "# INIT ZSH" > ~/.zshrc - - name: Prepare PROMPT variables - run: | - export BASH_PROMPT=$(bash -c 'source init/bash; echo "$PS1"') - export ZSH_PROMPT=$(zsh -c 'source init/zsh; echo "$PS1"') - export KSH_PROMPT=$(ksh -c 'source init/ksh; echo "$PS1"') - export FISH_PROMPT=$(fish -c 'source init/fish; echo "$PS1"') - - name: Run tests for available shells run: | .github/workflows/scripts/test_init_scripts.sh "bash" "zsh" "ksh" "fish" From 8d74aea96e184530e93ea2fc75560dc13b16dc52 Mon Sep 17 00:00:00 2001 From: MaKaNu <32844273+MaKaNu@users.noreply.github.com> Date: Fri, 6 Sep 2024 22:15:26 +0200 Subject: [PATCH 25/31] Set correct arch override Co-authored-by: ocaisa --- .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 f9283b68cd..e09afb8fb7 100644 --- a/.github/workflows/tests_init_module.yml +++ b/.github/workflows/tests_init_module.yml @@ -16,7 +16,7 @@ jobs: EESSI_VERSION: - 2023.06 EESSI_SOFTWARE_SUBDIR_OVERRIDE: - - x86_64/haswell + - x86_64/intel/haswell steps: - name: Check out software-layer repository uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 From 596f60542d6d34f0c8a8e21c7408dff21e6146be Mon Sep 17 00:00:00 2001 From: makanu Date: Wed, 11 Sep 2024 17:26:35 +0000 Subject: [PATCH 26/31] Fix arch differences Local Test system runs intel/haswell CICD System runs amd/zen3 No matter what I override the Path I am testing against is always the real arch Fixed by using regex detection, might fail if CICD System changes --- .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 24a59a90a3..938bdfb505 100755 --- a/.github/workflows/scripts/test_init_scripts.sh +++ b/.github/workflows/scripts/test_init_scripts.sh @@ -22,7 +22,8 @@ for shell in ${SHELLS[@]}; do assert "$shell -c 'source init/lmod/$shell' 2>&1 " "EESSI/$EESSI_VERSION loaded successfully" # TEST 2: Check if module overviews first section is the loaded EESSI module MODULE_SECTIONS=($($shell -c "source init/lmod/$shell 2>/dev/null; module ov 2>&1 | grep -e '---'")) - assert "echo ${MODULE_SECTIONS[1]}" "/cvmfs/software.eessi.io/versions/$EESSI_VERSION/software/linux/x86_64/intel/haswell/modules/all" + 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 Python module and check version @@ -30,10 +31,11 @@ for shell in ${SHELLS[@]}; do expected="Python 3.10.8" assert "$command" "$expected" # Test 5: Load Python module and check path - command="$shell -c 'source init/lmod/$shell 2>/dev/null; module load Python/3.10.8-GCCcore-12.2.0; which python'" - expected="/cvmfs/software.eessi.io/versions/$EESSI_VERSION/software/linux/x86_64/intel/haswell/software/Python/3.10.8-GCCcore-12.2.0/bin/python" - assert "$command" "$expected" - + PYTHON_PATH=$($shell -c "source init/lmod/$shell 2>/dev/null; module load Python/3.10.8-GCCcore-12.2.0; which python") + PATTERN="/cvmfs/software\.eessi\.io/versions/$EESSI_VERSION/software/linux/x86_64/(intel/haswell|amd/zen3)/software/Python/3\.10\.8-GCCcore-12\.2\.0/bin/python" + echo "$PYTHON_PATH" | grep -E "$PATTERN" + assert_raises 'echo "$PYTHON_PATH" | grep -E "$PATTERN"' + #End Test Suite assert_end "source_eessi_$shell" done From 462f18019d3a820e979a004dfa12018a39ce67d3 Mon Sep 17 00:00:00 2001 From: makanu Date: Thu, 12 Sep 2024 13:59:30 +0000 Subject: [PATCH 27/31] Add Exception for CSH csh is not as feature rich as other shells I have implemented. Maybe someday I learn how to approach it! --- .github/workflows/scripts/test_init_scripts.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/scripts/test_init_scripts.sh b/.github/workflows/scripts/test_init_scripts.sh index 938bdfb505..2bcbbc8d86 100755 --- a/.github/workflows/scripts/test_init_scripts.sh +++ b/.github/workflows/scripts/test_init_scripts.sh @@ -40,6 +40,9 @@ for shell in ${SHELLS[@]}; do assert_end "source_eessi_$shell" done +### EXCEPTION FOR CSH ### +echo -e "\033[33mWe don't now how to test csh correctly, PRs are Welcome.\033[0m" + # RESET PAGER export LMOD_PAGER= From 68ad3affa38707af85e0be221ff0c4a042fdca3d Mon Sep 17 00:00:00 2001 From: makanu Date: Thu, 12 Sep 2024 15:47:09 +0000 Subject: [PATCH 28/31] Add Check for not testable shells before we run any tests we check if the shell provided is actually testable. If a shell is not tested yet only means we don't know how to test the shell or the shell is not added to the TEST_SHELLS Array. --- .../workflows/scripts/test_init_scripts.sh | 50 ++++++++++--------- 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/.github/workflows/scripts/test_init_scripts.sh b/.github/workflows/scripts/test_init_scripts.sh index 2bcbbc8d86..048fba81f5 100755 --- a/.github/workflows/scripts/test_init_scripts.sh +++ b/.github/workflows/scripts/test_init_scripts.sh @@ -11,38 +11,40 @@ if [ ! -d assert.sh ]; then fi . assert.sh/assert.sh +TEST_SHELLS=("bash" "zsh" "fish" "ksh") SHELLS=$@ for shell in ${SHELLS[@]}; do echo = | awk 'NF += (OFS = $_) + 100' echo RUNNING TESTS FOR SHELL: $shell echo = | awk 'NF += (OFS = $_) + 100' - - # TEST 1: Source Script and check Module Output - assert "$shell -c 'source init/lmod/$shell' 2>&1 " "EESSI/$EESSI_VERSION loaded successfully" - # TEST 2: Check if module overviews first section is the loaded EESSI module - MODULE_SECTIONS=($($shell -c "source init/lmod/$shell 2>/dev/null; module ov 2>&1 | grep -e '---'")) - 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 Python module and check version - command="$shell -c 'source init/lmod/$shell 2>/dev/null; module load Python/3.10.8-GCCcore-12.2.0; python --version'" - expected="Python 3.10.8" - assert "$command" "$expected" - # Test 5: Load Python module and check path - PYTHON_PATH=$($shell -c "source init/lmod/$shell 2>/dev/null; module load Python/3.10.8-GCCcore-12.2.0; which python") - PATTERN="/cvmfs/software\.eessi\.io/versions/$EESSI_VERSION/software/linux/x86_64/(intel/haswell|amd/zen3)/software/Python/3\.10\.8-GCCcore-12\.2\.0/bin/python" - echo "$PYTHON_PATH" | grep -E "$PATTERN" - assert_raises 'echo "$PYTHON_PATH" | grep -E "$PATTERN"' - - #End Test Suite - assert_end "source_eessi_$shell" + 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" + else + # TEST 1: Source Script and check Module Output + assert "$shell -c 'source init/lmod/$shell' 2>&1 " "EESSI/$EESSI_VERSION loaded successfully" + # TEST 2: Check if module overviews first section is the loaded EESSI module + MODULE_SECTIONS=($($shell -c "source init/lmod/$shell 2>/dev/null; module ov 2>&1 | grep -e '---'")) + 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 Python module and check version + command="$shell -c 'source init/lmod/$shell 2>/dev/null; module load Python/3.10.8-GCCcore-12.2.0; python --version'" + expected="Python 3.10.8" + assert "$command" "$expected" + # Test 5: Load Python module and check path + PYTHON_PATH=$($shell -c "source init/lmod/$shell 2>/dev/null; module load Python/3.10.8-GCCcore-12.2.0; which python") + PATTERN="/cvmfs/software\.eessi\.io/versions/$EESSI_VERSION/software/linux/x86_64/(intel/haswell|amd/zen3)/software/Python/3\.10\.8-GCCcore-12\.2\.0/bin/python" + echo "$PYTHON_PATH" | grep -E "$PATTERN" + assert_raises 'echo "$PYTHON_PATH" | grep -E "$PATTERN"' + + #End Test Suite + assert_end "source_eessi_$shell" + fi done -### EXCEPTION FOR CSH ### -echo -e "\033[33mWe don't now how to test csh correctly, PRs are Welcome.\033[0m" - # RESET PAGER export LMOD_PAGER= From bccd55a2edfc0a0e366fc74241ad885c28e096cc Mon Sep 17 00:00:00 2001 From: makanu Date: Thu, 12 Sep 2024 15:47:56 +0000 Subject: [PATCH 29/31] Add csh to test We actually don't know how to csh for now. But if we figure out we don't need to update here. --- .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 e09afb8fb7..cfc4ae7b3d 100644 --- a/.github/workflows/tests_init_module.yml +++ b/.github/workflows/tests_init_module.yml @@ -39,5 +39,5 @@ jobs: - name: Run tests for available shells run: | - .github/workflows/scripts/test_init_scripts.sh "bash" "zsh" "ksh" "fish" + .github/workflows/scripts/test_init_scripts.sh "bash" "zsh" "ksh" "fish" "csh" From 7ad306ac462bdea86edac1f3780e9a5b82454863 Mon Sep 17 00:00:00 2001 From: MaKaNu <32844273+MaKaNu@users.noreply.github.com> Date: Thu, 12 Sep 2024 18:29:29 +0200 Subject: [PATCH 30/31] Update init/lmod/csh remove leftover comment Co-authored-by: ocaisa --- init/lmod/csh | 1 - 1 file changed, 1 deletion(-) diff --git a/init/lmod/csh b/init/lmod/csh index 5ae13fcc50..8e50d5e5c8 100644 --- a/init/lmod/csh +++ b/init/lmod/csh @@ -13,5 +13,4 @@ if (! $?__Init_Default_Modules ) then else module refresh endif -#module load "$LMOD_SYSTEM_DEFAULT_MODULES" From 1b38cecc6a132c79a5e74b97e8a7577d5f9d069f Mon Sep 17 00:00:00 2001 From: MaKaNu <32844273+MaKaNu@users.noreply.github.com> Date: Thu, 12 Sep 2024 22:41:14 +0200 Subject: [PATCH 31/31] Update install_scripts.sh Add copy of init lmod scripts --- install_scripts.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/install_scripts.sh b/install_scripts.sh index 0cfa5310c2..11c7fc2a9f 100755 --- a/install_scripts.sh +++ b/install_scripts.sh @@ -108,6 +108,12 @@ mc_files=( ) copy_files_by_list ${TOPDIR}/init/modules/EESSI ${INSTALL_PREFIX}/init/modules/EESSI "${mc_files[@]}" +# Copy for init/lmod directory +init_script_files=( + bash zsh ksh fish csh +) +copy_files_by_list ${TOPDIR}/init/lmod ${INSTALL_PREFIX}/init/lmod "${init_script_files[@]}" + # Copy for the scripts directory script_files=( utils.sh