Skip to content

Commit

Permalink
Issue #743: Make show noSuchModule return an LmodError instead of Lmo…
Browse files Browse the repository at this point in the history
…dWarning except when $LMOD_QUIET is set
  • Loading branch information
Robert McLay committed Feb 18, 2025
1 parent 6c00a62 commit 1b8a79b
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 11 deletions.
2 changes: 2 additions & 0 deletions rt/common_funcs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,8 @@ initStdEnvVars()
unset SHLIB_PATH
unset TERM
unset _LMFILES_
unset LMOD_EXPERT
unset LMOD_QUIET
unset LMOD_CACHED_LOADS
unset LMOD_DISPLAY_META_COLOR
unset LMOD_DISPLAY_SN_COLOR
Expand Down
8 changes: 6 additions & 2 deletions rt/show/err.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,20 @@ Try:
to see if the module(s) are available across all compilers and MPI implementations.
===========================
step 14
lua ProjectDIR/src/lmod.in.lua shell --regression_testing show nosuchmodule
===========================
===========================
step 15
lua ProjectDIR/src/lmod.in.lua shell --regression_testing --location show a
===========================
ProjectDIR/rt/show/mf/Core2/a/1.0.lua
===========================
step 15
step 16
lua ProjectDIR/src/lmod.in.lua shell --regression_testing --terse show a
===========================
ProjectDIR/rt/show/mf/Core2/a/1.0.lua
===========================
step 16
step 17
lua ProjectDIR/src/lmod.in.lua shell --regression_testing show showMe
===========================
ProjectDIR/rt/show/mf/Core/showMe/2.0.lua:
Expand Down
12 changes: 10 additions & 2 deletions rt/show/out.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,22 +107,30 @@ lua ProjectDIR/src/lmod.in.lua shell --regression_testing show nosuchmodule
false
===========================
step 14
lua ProjectDIR/src/lmod.in.lua shell --regression_testing --location show a
lua ProjectDIR/src/lmod.in.lua shell --regression_testing show nosuchmodule
===========================
MODULEPATH=ProjectDIR/rt/show/mf/Core2:ProjectDIR/rt/show/mf/Core;
export MODULEPATH;
_ModuleTable_='_ModuleTable_={MTversion=3,depthT={},family={},mT={boost={fn="ProjectDIR/rt/show/mf/Core/boost/1.47.1.lua",fullName="boost/1.47.1",loadOrder=1,propT={},stackDepth=0,status="active",userName="boost/1.47.1",wV="000000001.000000047.000000001.*zfinal",},},mpathA={"ProjectDIR/rt/show/mf/Core2","ProjectDIR/rt/show/mf/Core",},systemBaseMPATH="ProjectDIR/rt/show/mf/Core",}';
export _ModuleTable_;
===========================
step 15
lua ProjectDIR/src/lmod.in.lua shell --regression_testing --terse show a
lua ProjectDIR/src/lmod.in.lua shell --regression_testing --location show a
===========================
MODULEPATH=ProjectDIR/rt/show/mf/Core2:ProjectDIR/rt/show/mf/Core;
export MODULEPATH;
_ModuleTable_='_ModuleTable_={MTversion=3,depthT={},family={},mT={boost={fn="ProjectDIR/rt/show/mf/Core/boost/1.47.1.lua",fullName="boost/1.47.1",loadOrder=1,propT={},stackDepth=0,status="active",userName="boost/1.47.1",wV="000000001.000000047.000000001.*zfinal",},},mpathA={"ProjectDIR/rt/show/mf/Core2","ProjectDIR/rt/show/mf/Core",},systemBaseMPATH="ProjectDIR/rt/show/mf/Core",}';
export _ModuleTable_;
===========================
step 16
lua ProjectDIR/src/lmod.in.lua shell --regression_testing --terse show a
===========================
MODULEPATH=ProjectDIR/rt/show/mf/Core2:ProjectDIR/rt/show/mf/Core;
export MODULEPATH;
_ModuleTable_='_ModuleTable_={MTversion=3,depthT={},family={},mT={boost={fn="ProjectDIR/rt/show/mf/Core/boost/1.47.1.lua",fullName="boost/1.47.1",loadOrder=1,propT={},stackDepth=0,status="active",userName="boost/1.47.1",wV="000000001.000000047.000000001.*zfinal",},},mpathA={"ProjectDIR/rt/show/mf/Core2","ProjectDIR/rt/show/mf/Core",},systemBaseMPATH="ProjectDIR/rt/show/mf/Core",}';
export _ModuleTable_;
===========================
step 17
lua ProjectDIR/src/lmod.in.lua shell --regression_testing show showMe
===========================
MODULEPATH=ProjectDIR/rt/show/mf/Core2:ProjectDIR/rt/show/mf/Core;
Expand Down
9 changes: 6 additions & 3 deletions rt/show/show.tdesc
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,12 @@ testdescript = {
runLmod show a #11
runLmod show b_tcl #12
runLmod show nosuchmodule #13
runLmod --location show a #14
runLmod --terse show a #15
runLmod show showMe #16
export LMOD_QUIET=1
runLmod show nosuchmodule #14 (no warning message printed because LMOD_QUIET is set.)
unset LMOD_QUIET
runLmod --location show a #15
runLmod --terse show a #16
runLmod show showMe #17
HOME=$ORIG_HOME
Expand Down
8 changes: 4 additions & 4 deletions src/Hub.lua
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,11 @@ function M.access(self, ...)


if (#a > 0) then
LmodError{msg="e_Failed_2_Find_w_Access",quote_comma_list=concatTbl(a,"\", \""),
module_list=concatTbl(a," ")}
local report = quiet() and LmodWarning or LmodError
report{msg="e_Failed_2_Find_w_Access",quote_comma_list=concatTbl(a,"\", \""),
module_list=concatTbl(a," ")}
end
dbg.fini("Hub:access")
end
dbg.fini("Hub:access")end

--------------------------------------------------------------------------
-- This function marks a module name as loaded and saves
Expand Down

0 comments on commit 1b8a79b

Please sign in to comment.