ts: vers list spec select one mod ctx tests

This commit is contained in:
Xavier Delaruelle
2019-10-31 07:34:28 +01:00
parent 30605a8669
commit aebc81feec
2 changed files with 193 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
#%Module
module-whatis [module-info name]

View File

@@ -220,6 +220,197 @@ testouterr_cmd sh {whatis advvers@2.1,2.2} ERR "$err_path'advvers@2.1,2.2'"
setenv_var MODULES_ADVANCED_VERSION_SPEC 1
#
# check consistent effect over the one module selection context
#
# test over existing module
set ans [list]
lappend ans [list setpath LOADEDMODULES extdfl2/3.1.7]
lappend ans [list setpath _LMFILES_ $mp/extdfl2/3.1.7]
testouterr_cmd sh {load extdfl2@3.0.2,3.1.7} $ans {}
testouterr_cmd sh {load extdfl2@3.1.6,3.1.7} $ans {}
testouterr_cmd sh {load extdfl2@3.1.8,3.1.7,3.1.6} $ans {}
testouterr_cmd sh "load $mp/extdfl2 @3.0.2,3.1.7" ERR "$err_file'$mp/extdfl2 @3.0.2,3.1.7'"
testouterr_cmd sh "load $mp/extdfl2/3.1.7 @12,11" ERR "$err_file'$mp/extdfl2/3.1.7 @12,11'"
set ans [list]
lappend ans [list setpath LOADEDMODULES extdfl3/1.1/3]
lappend ans [list setpath _LMFILES_ $mp/extdfl3/1.1/3]
lappend ans [list setpath MODULES_LMALTNAME extdfl3/1.1/3&extdfl3/1.2&extdfl3/1.00&extdfl3/1.3/3]
testouterr_cmd sh {load extdfl3@1.1,1.0} $ans {}
testouterr_cmd sh {load extdfl3@1.1/3,1.3/4} ERR $err_specvers'1.1/3,1.3/4'
testouterr_cmd sh {unload extdfl2@3.1.7,3.0.15} OK {}
set ans [list]
lappend ans [list setpath LOADEDMODULES extdfl/1.3.1]
lappend ans [list setpath _LMFILES_ $mp/extdfl/1.3.1]
lappend ans [list setpath MODULES_LMALTNAME extdfl/1.3.1&extdfl/default&extdfl]
testouterr_cmd sh {load extdfl@1.3.1,1.3.7} $ans {}
# test over already loaded module
setenv_loaded_module [list extdfl2/3.1.7] [list $mp/extdfl2/3.1.7]
testouterr_cmd sh {load extdfl2@3.1.7,3.0.15} OK {}
testouterr_cmd sh "load $mp/extdfl2 @3.1.7,3.0.15" ERR "$err_file'$mp/extdfl2 @3.1.7,3.0.15'"
set ans [list]
lappend ans [list unsetpath LOADEDMODULES]
lappend ans [list unsetpath _LMFILES_]
testouterr_cmd sh {unload extdfl2@3.1.7,3.0.15} $ans {}
testouterr_cmd sh "unload $mp/extdfl2 @3.1.7,3.0.15" OK {}
setenv_loaded_module [list extdfl/1.3.7] [list $mp/extdfl/1.3.7]
set ans [list]
lappend ans [list setpath LOADEDMODULES extdfl/1.3.7:extdfl/1.3.1]
lappend ans [list setpath _LMFILES_ $mp/extdfl/1.3.7:$mp/extdfl/1.3.1]
lappend ans [list setpath MODULES_LMALTNAME extdfl/1.3.1&extdfl/default&extdfl]
testouterr_cmd_re sh {load extdfl@1.3.1,1.3.7} $ans {}
testouterr_cmd_re sh {load extdfl@1.3.1,1.3.7,1.4.5} $ans {}
set ans [list]
lappend ans [list setpath LOADEDMODULES extdfl/1.3.7:extdfl/1.4.5]
lappend ans [list setpath _LMFILES_ $mp/extdfl/1.3.7:$mp/extdfl/1.4.5]
testouterr_cmd_re sh {load extdfl@1.3.7,1.4.5} $ans {}
set ans [list]
lappend ans [list unsetpath LOADEDMODULES]
lappend ans [list unsetpath _LMFILES_]
testouterr_cmd_re sh {unload extdfl@1.3.1,1.3.7} $ans {}
testouterr_cmd_re sh {unload extdfl@1.3.1,1.3.7,1.4.5} $ans {}
testouterr_cmd_re sh {unload extdfl@1.3.7,1.4.5} $ans {}
setenv_loaded_module [list $mp/extdfl2/3.1.7] [list $mp/extdfl2/3.1.7]
testouterr_cmd sh {unload extdfl2@3.0.15,3.1.7} $ans {}
testouterr_cmd sh "load $mp/extdfl2 @3.1.7,3.0.15" ERR "$err_file'$mp/extdfl2 @3.1.7,3.0.15'"
testouterr_cmd sh {unload extdfl3@1.3} OK {}
testouterr_cmd sh {unload extdfl3@1.3/4} ERR $err_specvers'1.3/4'
setenv_loaded_module [list $mp/extdfl3/1.3/4] [list $mp/extdfl3/1.3/4]
testouterr_cmd sh {unload extdfl3@1.1,1.3} $ans {}
testouterr_cmd sh {unload extdfl3@1.0,1.3/3} ERR $err_specvers'1.0,1.3/3'
testouterr_cmd sh {unload extdfl3/1.3@4,3} $ans {}
setenv_loaded_module [list $mp/extdfl2/3.1.7] [list $mp/extdfl2/3.1.7]
set ans [list]
lappend ans [list setpath LOADEDMODULES extdfl3/1.1/3]
lappend ans [list setpath _LMFILES_ $mp/extdfl3/1.1/3]
lappend ans [list setpath MODULES_LMALTNAME extdfl3/1.1/3&extdfl3/1.2&extdfl3/1.00&extdfl3/1.3/3]
testouterr_cmd sh {switch extdfl2@3.0.2,3.1.7 extdfl3@1.0,1.1} $ans {}
unsetenv_loaded_module
# test other sub-cmds concerned by context
testouterr_cmd_re sh {help extdfl2@3.10.2,3.9.2} OK "$modlin\nModule Specific Help for $mpre/extdfl2/3.10.2:\n\n$warn_msgs: Unable to find ModulesHelp in $mpre/extdfl2/3.10.2.\n$modlin"
testouterr_cmd_re sh {display extdfl2@3.9.2,3.1.3,3.10.2} OK "$modlin\n$mpre/extdfl2/3.10.2:\n\nmodule-whatis\textdfl2/3.10.2\n$modlin"
testouterr_cmd_re sh {test extdfl2@3.9.2,3.10.2,3.1.3} OK "$modlin\nModule Specific Test for $mpre/extdfl2/3.10.2:\n\n$warn_msgs: Unable to find ModulesTest in $mpre/extdfl2/3.10.2.\n$modlin"
testouterr_cmd sh {path extdfl2@3.12,3.10.2,3.9.2} [list [list text $mp/extdfl2/3.10.2]] {}
testouterr_cmd sh {is-avail extdfl2@3.9.2,3.10.2,3.1.3} OK {}
testouterr_cmd sh {is-avail extdfl2@3.12,3.10.2,3.9.2} OK {}
testouterr_cmd sh {is-avail extdfl2@3.11,3.12} ERR {}
# test unknown module
testouterr_cmd sh {load unknown@1.3.7,1.4.5} ERR $err_path'unknown@1.3.7,1.4.5'
testouterr_cmd sh {load extdfl2 @11,12} ERR "$err_path'extdfl2 @11,12'"
testouterr_cmd sh "load $mp/unknown @1.4.5,1.3.7" ERR "$err_file'$mp/unknown @1.4.5,1.3.7'"
testouterr_cmd sh "load $mp/extdfl2@11,12" ERR "$err_file'$mp/extdfl2@11,12'"
# test various modulefile kind: alias, symver, virtual, directory hidden
testouterr_cmd sh {path extdfl3@1.0,1.00} [list [list text $mp/extdfl3/1.1/3]] {}
testouterr_cmd sh {path extdfl7 @1.3,3.0} [list [list text $mp/extdfl7/2.10]] {}
testouterr_cmd sh {path nocase @regular,virt} [list [list text $mp/nocase/1]] {}
testouterr_cmd sh {path extdfl3@1.1,1.00} [list [list text $mp/extdfl3/1.1/3]] {}
testouterr_cmd sh {path extdfl @.1.3.3,.1.3.4} [list [list text $mp/extdfl/.1.3.4]] {}
# version specified over an alias which targets a module/version modulefile
testouterr_cmd sh {path advvers3 @1.0,1.2} OK "$err_path'advvers3 @1.0,1.2'"
# wildcard characters have no effect
testouterr_cmd sh {path ext*l @1.0,1.3} {} "$err_path'ext*l @1.0,1.3'"
testouterr_cmd sh {path ext?fl @1.3,1.0} {} "$err_path'ext?fl @1.3,1.0'"
testouterr_cmd sh {path extdfl @1.4.*,1.3.?} {} "$err_path'extdfl @1.4.*,1.3.?'"
testouterr_cmd sh {path extdfl @1.3.*,1.4.?} {} "$err_path'extdfl @1.3.*,1.4.?'"
testouterr_cmd sh {path extdfl @1.3*,1.4?} {} "$err_path'extdfl @1.3*,1.4?'"
testouterr_cmd sh {path e+?.* @1.4.5,1.3.7} OK "$err_path'e+?.* @1.4.5,1.3.7'"
testouterr_cmd sh {path e+t.fl @1.4.5,1.3.7} [list [list text $mp/e+t.fl/1.4.5]] {}
# test mod@vers where a modulefile mod@vers exist
testouterr_cmd sh {load advvers@2.1,2.2} ERR $err_path'advvers@2.1,2.2'
setenv_var MODULES_ADVANCED_VERSION_SPEC 0
testouterr_cmd sh {load advvers@2.1,2.2} ERR $err_path'advvers@2.1,2.2'
setenv_var MODULES_ADVANCED_VERSION_SPEC 1
# test explicit default enabled
testouterr_cmd sh {load extdfl@1.2,1.4} ERR "$err_path'extdfl@1.2,1.4'"
setenv_var MODULES_EXTENDED_DEFAULT 1
set ans [list]
lappend ans [list setpath LOADEDMODULES extdfl/1.4.5]
lappend ans [list setpath _LMFILES_ $mp/extdfl/1.4.5]
testouterr_cmd sh {load extdfl@1.2,1.4} $ans {}
# test implicit default disabled
if {![is_config_locked implicit_default]} {
setenv_var MODULES_IMPLICIT_DEFAULT 0
testouterr_cmd sh {load extdfl@1.2,1.4} ERR $err_nodefault'extdfl@1.2,1.4'
# mixing an unexistent mod with a regular one will fail load when implicit default is disabled
testouterr_cmd sh {load extdfl@1.4.3,1.4.5} ERR $err_nodefault'extdfl@1.4.3,1.4.5'
set ans [list]
lappend ans [list setpath LOADEDMODULES extdfl/1.3.1]
lappend ans [list setpath _LMFILES_ $mp/extdfl/1.3.1]
lappend ans [list setpath MODULES_LMALTNAME extdfl/1.3.1&extdfl/default&extdfl]
testouterr_cmd sh {load extdfl@1.4,1.3} $ans {}
testouterr_cmd sh {load extdfl@1.4,1.2,1} $ans {}
testouterr_cmd sh {load extdfl @1,2} $ans {}
setenv_var MODULES_IMPLICIT_DEFAULT 1
}
unsetenv_var MODULES_EXTENDED_DEFAULT
# test icase
set ans [list]
lappend ans [list setpath LOADEDMODULES extdfl/1.4.5]
lappend ans [list setpath _LMFILES_ $mp/extdfl/1.4.5]
testouterr_cmd sh {load -i extDfl@1.3.7,1.4.5} $ans {}
set ans [list]
lappend ans [list setpath LOADEDMODULES extdfl2/2.rc.2]
lappend ans [list setpath _LMFILES_ $mp/extdfl2/2.rc.2]
testouterr_cmd sh {load -i extdfl2@2.rC.2,2.RC.1} $ans {}
set ans [list]
lappend ans [list setpath LOADEDMODULES icase3/1.2]
lappend ans [list setpath _LMFILES_ $mp/icase3/1.2]
testouterr_cmd sh {load -i icase3@1.1,1.2,1.4} $ans {}
testouterr_cmd sh {load -i ICase3@1.1,1.2,1.4} $ans {}
set ans [list]
lappend ans [list setpath LOADEDMODULES iCaSe3/1.4]
lappend ans [list setpath _LMFILES_ $mp/iCaSe3/1.4]
testouterr_cmd sh {load -i iCaSe3@1.1,1.2,1.4} $ans {}
testouterr_cmd sh {load -i icase3@1.1,1.4} $ans {}
setenv_var MODULES_EXTENDED_DEFAULT 1
testouterr_cmd sh {load -i iCaSe3@1.1,1.2,1.4} $ans {}
testouterr_cmd sh {load -i iCaSe3@1,2} $ans {}
set ans [list]
lappend ans [list setpath LOADEDMODULES icase3/1.2]
lappend ans [list setpath _LMFILES_ $mp/icase3/1.2]
testouterr_cmd sh {load -i ICase3@1.1,1.2,1.4} $ans {}
testouterr_cmd sh {load -i ICase3@1,2} $ans {}
unsetenv_var MODULES_EXTENDED_DEFAULT
set ans [list]
lappend ans [list setpath LOADEDMODULES ICASE3/vers.1]
lappend ans [list setpath _LMFILES_ $mp/ICASE3/vers.1]
testouterr_cmd sh {load -i iCaSe3@vers.1,VERS.1} $ans {}
testouterr_cmd sh {load -i iCaSe3@vErs.1,VeRS.1} $ans {}
testouterr_cmd sh {load -i ICASE3@vErs.1,VeRS.1} $ans {}
# check effect over [module-info specified] call
set ans [list]
lappend ans [list setpath LOADEDMODULES advvers/1.2]
lappend ans [list setpath _LMFILES_ $mp/advvers/1.2]
lappend ans [list set ts advvers@1.1,1.2]
testouterr_cmd sh {load advvers@1.1,1.2} $ans {}
set ans [list]
lappend ans [list setpath LOADEDMODULES advvers/1.2]
lappend ans [list setpath _LMFILES_ $mp/advvers/1.2]
lappend ans [list set ts "advvers @1.0,1.1,1.2"]
testouterr_cmd sh {load advvers @1.0,1.1,1.2} $ans {}
set ans [list]
lappend ans [list setpath LOADEDMODULES advvers/1.2]
lappend ans [list setpath _LMFILES_ $mp/advvers/1.2]
lappend ans [list set ts "advvers@1.0 @1.1,1.2"]
testouterr_cmd sh {load advvers@1.0 @1.1,1.2} $ans {}
#
# Cleanup
#