Ignore --auto/--no-auto opt when called from modulefile

This commit is contained in:
Xavier Delaruelle
2018-06-27 06:08:32 +02:00
parent e36ab552f0
commit 2067f9aba1
3 changed files with 24 additions and 8 deletions

View File

@@ -1513,9 +1513,9 @@ proc module {command args} {
reportDebug "cmd='$command', args='$args' (mode=$mode)"
# parse listing specific options, do that globally to ignore these
# options on commands not related to listing (exclude them from arg list)
lassign [eval parseListCommandArgs $command $args] show_oneperline\
# parse options, do that globally to ignore options not related to a given
# module sub-command (exclude them from arg list)
lassign [eval parseModuleCommandArgs $command $args] show_oneperline\
show_mtime show_filter args
# guess if called from top level
@@ -5602,8 +5602,8 @@ proc readCollectionContent {collfile colldesc} {
return [list $path_list $mod_list $nuasked_list]
}
# analyze arg list passed to a module cmd to set listing-related options
proc parseListCommandArgs {cmd args} {
# analyze arg list passed to a module cmd to set options
proc parseModuleCommandArgs {cmd args} {
set show_oneperline 0
set show_mtime 0
set show_filter ""
@@ -5631,6 +5631,9 @@ proc parseListCommandArgs {cmd args} {
{-L} - {--latest} {
set show_filter "onlylatest"
}
{--auto} - {--no-auto} {
reportWarning "Unsupported option '$arg'"
}
default {
lappend otherargs $arg
}

View File

@@ -0,0 +1,4 @@
#%Module
module load --auto ms
module switch --auto ms ms
module unload --no-auto ms

View File

@@ -43,6 +43,18 @@ setenv_path_var MODULES_LMCONFLICT "c&c"
setenv_path_var MODULES_LMPREREQ "b&c"
testouterr_cmd "sh" "unload c" "ERR" "$error_msgs: [err_prerequn c b]"
# restore environment
unsetenv_path_var MODULES_LMCONFLICT
unsetenv_path_var MODULES_LMPREREQ
unsetenv_loaded_module
# check warning raised when using --auto/--no-auto from modulefile
set ans [list]
lappend ans [list setpath LOADEDMODULES "mu"]
lappend ans [list setpath _LMFILES_ "$mp/mu"]
lappend ans [list unsetpath MODULES_LMCONFLICT]
lappend ans [list unsetpath MODULES_LMNOTUASKED]
testouterr_cmd "sh" "load mu" $ans "$warn_msgs: Unsupported option '--auto'\n$warn_msgs: Unsupported option '--auto'\n$warn_msgs: Unsupported option '--no-auto'"
#
# Cleanup
@@ -50,9 +62,6 @@ testouterr_cmd "sh" "unload c" "ERR" "$error_msgs: [err_prerequn c b]"
# restore environment
setenv_path_var MODULEPATH $modpath
unsetenv_path_var MODULES_LMCONFLICT
unsetenv_path_var MODULES_LMPREREQ
unsetenv_loaded_module
unset mp
unset ans