Skip to content

Commit 6f72f44

Browse files
authored
Merge branch 'main' into make_cuda_version_check_dynamic
2 parents 2229170 + 32d515e commit 6f72f44

5 files changed

Lines changed: 89 additions & 17 deletions

File tree

.github/workflows/scripts/test_init_scripts.sh

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

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

170183
# End Test Suite

EESSI-install-software.sh

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -412,12 +412,16 @@ else
412412

413413
# copy EasyBuild log file if EasyBuild exited with an error
414414
if [ ${ec} -ne 0 ]; then
415-
eb_last_log=$(unset EB_VERBOSE; eb --last-log)
416-
# copy to current working directory
417-
cp -a ${eb_last_log} .
418-
echo "Last EasyBuild log file copied from ${eb_last_log} to ${PWD}"
419-
# copy to build logs dir (with context added)
420-
copy_build_log "${eb_last_log}" "${build_logs_dir}"
415+
eb_last_log=$(eb --last-log | grep ^/.*\.log)
416+
# copy to current working directory if file exhists
417+
if [ -f ${eb_last_log} ]; then
418+
cp -a ${eb_last_log} .
419+
echo "Last EasyBuild log file copied from ${eb_last_log} to ${PWD}"
420+
# copy to build logs dir (with context added)
421+
copy_build_log "${eb_last_log}" "${build_logs_dir}"
422+
else
423+
fatal_error "Could not copy EasyBuild log file because ${eb_last_log} does not exist"
424+
fi
421425
fi
422426

423427
$TOPDIR/check_missing_installations.sh ${easystack_file} ${pr_diff}

eb_hooks.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1110,6 +1110,31 @@ def pre_configure_hook_score_p(self, *args, **kwargs):
11101110
raise EasyBuildError("Score-P-specific hook triggered for non-Score-P easyconfig?!")
11111111

11121112

1113+
def pre_configure_hook_dyninst(self, *args, **kwargs):
1114+
"""
1115+
Pre-configure hook for Dyninst
1116+
- specify correct path to binutils (in compat layer)
1117+
"""
1118+
if self.name == 'Dyninst':
1119+
1120+
# determine path to Prefix installation in compat layer via $EPREFIX
1121+
eprefix = get_eessi_envvar('EPREFIX')
1122+
1123+
binutils_lib_path_glob_pattern = os.path.join(eprefix, 'usr', 'lib*', 'binutils', '*-linux-gnu', '2.*')
1124+
binutils_lib_path = glob.glob(binutils_lib_path_glob_pattern)
1125+
if len(binutils_lib_path) == 1:
1126+
print_msg("Defining LibIberty variables for Dyninst...")
1127+
self.cfg.update('configopts', '-DLibIberty_ROOT_DIR=' + binutils_lib_path[0])
1128+
self.cfg.update('configopts', '-DLibIberty_INCLUDE_DIRS=' + os.path.join(binutils_lib_path[0], 'include'))
1129+
self.cfg.update('configopts', '-DLibIberty_LIBRARIES=' + os.path.join(binutils_lib_path[0], 'libiberty.a'))
1130+
else:
1131+
raise EasyBuildError("Failed to isolate path for binutils libraries using %s, got %s",
1132+
binutils_lib_path_glob_pattern, binutils_lib_path)
1133+
1134+
else:
1135+
raise EasyBuildError("Dyninst-specific hook triggered for non-Dyninst easyconfig?!")
1136+
1137+
11131138
def pre_configure_hook_extrae(self, *args, **kwargs):
11141139
"""
11151140
Pre-configure hook for Extrae
@@ -1987,6 +2012,7 @@ def pre_run_shell_cmd_hook(cmd, work_dir=None, **kwargs):
19872012
'WRF': pre_configure_hook_wrf_aarch64,
19882013
'LAMMPS': pre_configure_hook_LAMMPS_zen4_and_aarch64_cuda,
19892014
'Score-P': pre_configure_hook_score_p,
2015+
'Dyninst': pre_configure_hook_dyninst,
19902016
'CMake': pre_configure_hook_cmake_system,
19912017
}
19922018

eessi_container.sh

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,9 @@ display_help() {
113113
echo " when a directory is provided, the format of the"
114114
echo " tarball's name will be {REPO_ID}-{TIMESTAMP}.tgz"
115115
echo " [default: not set]"
116+
echo " -S | --sandbox - use sandbox mode (i.e. convert .sif image to sandbox and then run"
117+
echo " it instead)"
118+
echo " [default: not set]"
116119
echo " -v | --verbose - display more information [default: false]"
117120
echo " -x | --http-proxy URL - provides URL for the env variable http_proxy"
118121
echo " [default: not set]; uses env var \$http_proxy if set"
@@ -275,6 +278,10 @@ while [[ $# -gt 0 ]]; do
275278
SAVE="$2"
276279
shift 2
277280
;;
281+
-S|--sandbox)
282+
SANDBOX=1
283+
shift 1
284+
;;
278285
-u|--resume)
279286
RESUME="$2"
280287
shift 2
@@ -1039,10 +1046,23 @@ for arg in "${PASS_THROUGH[@]}"; do
10391046
ADDITIONAL_CONTAINER_OPTIONS+=(${arg})
10401047
done
10411048

1042-
echo "Launching container with command (next line):"
1043-
echo "singularity ${RUN_QUIET} ${MODE} ${ADDITIONAL_CONTAINER_OPTIONS[@]} ${EESSI_FUSE_MOUNTS[@]} ${CONTAINER} $@"
1044-
singularity ${RUN_QUIET} ${MODE} "${ADDITIONAL_CONTAINER_OPTIONS[@]}" "${EESSI_FUSE_MOUNTS[@]}" ${CONTAINER} "$@"
1045-
exit_code=$?
1049+
# EESSI_SINGULARITY_SANDBOX is an environment variable (typically set in site_config.sh, if needed)
1050+
if [[ -n "${EESSI_SINGULARITY_SANDBOX}" || ${SANDBOX} -eq 1 ]]; then
1051+
# using a sandbox image mode is more robust at the cleanup phase at the end
1052+
CONTAINER_SANDBOX="${CONTAINER%.sif}.sandbox"
1053+
echo "Building a sandbox image with command (next line):"
1054+
echo "singularity build --sandbox --force ${CONTAINER_SANDBOX} ${CONTAINER}"
1055+
singularity build --sandbox --force ${CONTAINER_SANDBOX} ${CONTAINER}
1056+
echo "Launching sandbox container with command (next line):"
1057+
echo "singularity ${RUN_QUIET} ${MODE} ${ADDITIONAL_CONTAINER_OPTIONS[@]} ${EESSI_FUSE_MOUNTS[@]} ${CONTAINER_SANDBOX} $@"
1058+
singularity ${RUN_QUIET} ${MODE} "${ADDITIONAL_CONTAINER_OPTIONS[@]}" "${EESSI_FUSE_MOUNTS[@]}" ${CONTAINER_SANDBOX} "$@"
1059+
exit_code=$?
1060+
else
1061+
echo "Launching container with command (next line):"
1062+
echo "singularity ${RUN_QUIET} ${MODE} ${ADDITIONAL_CONTAINER_OPTIONS[@]} ${EESSI_FUSE_MOUNTS[@]} ${CONTAINER} $@"
1063+
singularity ${RUN_QUIET} ${MODE} "${ADDITIONAL_CONTAINER_OPTIONS[@]}" "${EESSI_FUSE_MOUNTS[@]}" ${CONTAINER} "$@"
1064+
exit_code=$?
1065+
fi
10461066

10471067
# 6. save tmp if requested (arg -s|--save)
10481068
if [[ ! -z ${SAVE} ]]; then

init/modules/EESSI/2023.06.lua

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,14 @@ local quiet_load = false
222222
if os.getenv("EESSI_MODULE_UPDATE_PS1") then
223223
local prompt = os.getenv("PS1")
224224
if prompt then
225-
pushenv("PS1", "{EESSI/" .. eessi_version .. "} " .. prompt)
225+
local prefix = "{EESSI/" .. eessi_version .. "} "
226+
if mode() == "load" then
227+
-- Prepend prefix to PS1 without evaluating its contents
228+
execute{cmd="PS1=\"" .. prefix .. "$PS1\"", modeA={"load"}}
229+
elseif mode() == "unload" then
230+
-- Strip the prefix from beginning of PS1
231+
execute{cmd="PS1=\"${PS1#\"" .. prefix .. "\"}\"", modeA={"unload"}}
232+
end
226233
end
227234
end
228235

@@ -233,11 +240,13 @@ if os.getenv("EESSI_MODULE_STICKY") then
233240
load_message = load_message .. " (requires '--force' option to unload or purge)"
234241
end
235242

236-
-- set CURL_CA_BUNDLE on RHEL-based systems
243+
-- set CURL_CA_BUNDLE and friends on RHEL-based systems
237244
ca_bundle_file_rhel = "/etc/pki/tls/certs/ca-bundle.crt"
238245
if isFile(ca_bundle_file_rhel) then
239246
pushenv("CURL_CA_BUNDLE", ca_bundle_file_rhel)
240-
eessiDebug("Setting CURL_CA_BUNDLE to " .. ca_bundle_file_rhel)
247+
pushenv("REQUESTS_CA_BUNDLE", ca_bundle_file_rhel)
248+
pushenv("SSL_CERT_FILE", ca_bundle_file_rhel)
249+
eessiDebug("Setting CURL_CA_BUNDLE,REQUESTS_CA_BUNDLE,SSL_CERT_FILE to " .. ca_bundle_file_rhel)
241250
end
242251

243252
if mode() == "load" then

0 commit comments

Comments
 (0)