| 1 |
############################################################################## |
| 2 |
# Modules Revision 3.0 |
| 3 |
# Providing a flexible user environment |
| 4 |
# |
| 5 |
# File: modules.50-cmds/%M% |
| 6 |
# Revision: %I% |
| 7 |
# First Edition: 2018/06/06 |
| 8 |
# Last Mod.: %U%, %G% |
| 9 |
# |
| 10 |
# Authors: Xavier Delaruelle, [email protected] |
| 11 |
# |
| 12 |
# Description: Testuite testsequence |
| 13 |
# Command: load, unload |
| 14 |
# Modulefiles: |
| 15 |
# Sub-Command: prereq, conflict |
| 16 |
# |
| 17 |
# Comment: %C{ |
| 18 |
# Test dependency handling consistency whatever the auto-handling |
| 19 |
# mode enablement state |
| 20 |
# }C% |
| 21 |
# |
| 22 |
############################################################################## |
| 23 |
|
| 24 |
skip_if_quick_mode |
| 25 |
|
| 26 |
set mp "$modpath.deps" |
| 27 |
|
| 28 |
# setup specific environment |
| 29 |
setenv_path_var MODULEPATH $mp |
| 30 |
|
| 31 |
# is-loading conflict check |
| 32 |
testouterr_cmd "sh" "load mt" "ERR" [msg_load ms [err_conloi mt]]\n\n[msg_load mt [err_reqlo ms]] |
| 33 |
|
| 34 |
# is-loading conflict check with fully qualified modulefile |
| 35 |
testouterr_cmd "sh" "load mtf" "ERR" [msg_load $mp/msf [err_conloi mtf]]\n\n[msg_load mtf [err_reqlo $mp/msf]] |
| 36 |
|
| 37 |
# conflict consistency check |
| 38 |
set ans [list] |
| 39 |
lappend ans [list set __MODULES_LMCONFLICT "a&b"] |
| 40 |
lappend ans [list set LOADEDMODULES "a"] |
| 41 |
lappend ans [list set _LMFILES_ "$mp/a"] |
| 42 |
lappend ans [list ERR] |
| 43 |
if {$install_autohandling eq {y}} { |
| 44 |
if {[is_conf_enabled conflictunload]} { |
| 45 |
set ans [list] |
| 46 |
lappend ans [list set __MODULES_LMCONFLICT "c&c"] |
| 47 |
lappend ans [list set __MODULES_LMPREREQ "b&c"] |
| 48 |
lappend ans [list set _LMFILES_ "$mp/c:$mp/b"] |
| 49 |
lappend ans [list set LOADEDMODULES "c:b"] |
| 50 |
lappend ans [list set __MODULES_LMTAG c&auto-loaded] |
| 51 |
set tserr [msg_top_load b a c {}] |
| 52 |
} else { |
| 53 |
set tserr [msg_load b [err_conlo a]] |
| 54 |
} |
| 55 |
testouterr_cmd "sh" "load a b" $ans $tserr |
| 56 |
} else { |
| 57 |
# as load is attempted to see if conflict solves, returned error is also about missing prereq |
| 58 |
testouterr_cmd "sh" "load a b" $ans [msg_load b [err_prereq c] [err_conlo a]] |
| 59 |
} |
| 60 |
|
| 61 |
# prereq consistency check |
| 62 |
# no test possible with equal results between --auto and --no-auto modes |
| 63 |
# due to DepUn mechanism |
| 64 |
|
| 65 |
# restore environment |
| 66 |
unsetenv_var __MODULES_LMCONFLICT |
| 67 |
unsetenv_var __MODULES_LMPREREQ |
| 68 |
unsetenv_loaded_module |
| 69 |
|
| 70 |
# check warning raised when using --auto/--no-auto from modulefile |
| 71 |
# confusing error messages obtained due to load then unload of same modulefile (which is thus defined as a conflict and a prereq) |
| 72 |
if {$install_autohandling eq {y}} { |
| 73 |
set tserr [msg_unload {ms <aL>} [err_deploi mu]]\n\n[msg_load mu "$warn_msgs: Unsupported option '--auto'" "$warn_msgs: Unsupported option '--auto'" [err_conun ms]] |
| 74 |
} else { |
| 75 |
set tserr [msg_unload {ms <aL>} [err_deploi mu]]\n\n[msg_load mu "$warn_msgs: Unsupported option '--auto'" "$warn_msgs: Unsupported option '--auto'" [err_conun ms]] |
| 76 |
} |
| 77 |
testouterr_cmd "sh" "load mu" ERR $tserr |
| 78 |
|
| 79 |
# |
| 80 |
# Cleanup |
| 81 |
# |
| 82 |
|
| 83 |
reset_test_env |