1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201
|
##############################################################################
# Modules Revision 3.0
# Providing a flexible user environment
#
# File: modules.00-init/%M%
# Revision: %I%
# First Edition: 2017/05/06
# Last Mod.: %U%, %G%
#
# Authors: Xavier Delaruelle, xavier.delaruelle@cea.fr
#
# Description: Testuite testsequence
# Command:
# Sub-Command:
#
# Comment: %C{
# Check basic set of module commands on all shells
# }C%
#
##############################################################################
set bad_cmd "$error_msgs: Invalid command 'foo'"
set bad_cmd_re "(envmodule: )?$bad_cmd"
#
# The tests
#
if {$verbose} {
send_user "\tChecking basic set of module commands\n"
}
foreach shell $shell_list {
testall_cmd_re "$shell" "module --version" {} "Modules Release \\S+ (\\S+)" 0
testall_cmd "$shell" "module foo" "" "$bad_cmd\n$type_help" 1
testall_cmd "$shell" "module use $share_modpath\; module purge\; module load null\; module list -t" "" "$cur_loaded\nnull" 0
testall_cmd "$shell" "module use $share_modpath\; module purge\; module load null\; module unload null\; module list -t" "" "$no_loaded" 0
testall_cmd "$shell" "module is-loaded unk" "" "" 1
testall_cmd "$shell" "module use $share_modpath\; module load null\; module is-loaded null" "" "" 0
testall_cmd "$shell" "module info-loaded unk" "" "" 0
testall_cmd "$shell" "module use $share_modpath\; module load null\; module info-loaded null" "null" "" 0
}
# ensure tools used in complex shell alias definition are available
if {[find_bin grep] ne "" && [find_bin tr] ne "" && [find_bin awk] ne ""} {
foreach shell $shell_list {
if {$shell eq {csh} || $shell eq {tcsh}} {
# alias evaluation leads to a syntax error if wa_277 is enabled
testall_cmd_re "$shell" "module load $testsuite_modpath/alias/3.0\; testsuite; ts2; ts3" [expr {$install_wa277 eq {y} ? {} : "Release\nhttp://an.example.web\\?¶m=one\nselect\\\[type==BAR && osrel==FOO\\\] myapp"}] ".*" [expr {$install_wa277 eq {y} ? 1 : 0}]
} else {
testall_cmd_re "$shell" "module load $testsuite_modpath/alias/3.0\; testsuite; ts2; ts3" "Release\nhttp://an.example.web\\?¶m=one\nselect\\\[type==BAR && osrel==FOO\\\] myapp" ".*" 0
}
}
} elseif {$verbose} {
send_user "\tSkipping shell alias definition tests\n"
}
foreach shell $othlang_list {
testall_cmd_re "$shell" "--version" {} "Modules Release \\S+ (\\S+)" 0
testall_cmd_re "$shell" "foo" {} "$bad_cmd_re\n$type_help.*" 1
testall_cmd "$shell" "use,$share_modpath:purge:load,null:list,-t" "" "$cur_loaded\nnull" 0
testall_cmd "$shell" "use,$share_modpath:purge:load,null:unload,null:list,-t" "" "$no_loaded" 0
switch -- $shell {
cmake - r {
testall_cmd_re "$shell" "is-loaded,unk" "" ".*" 1
}
default {
testall_cmd_re "$shell" "is-loaded,unk" "" "" 1
}
}
testall_cmd "$shell" "use,$share_modpath:load,null:is-loaded,null" "" "" 0
switch -- $shell {
r {
testall_cmd "$shell" "info-loaded,unk" "\[1\] \"\"" {} 0
}
python - ruby {
testall_cmd "$shell" "info-loaded,unk" "\n" "" 0
}
default {
testall_cmd "$shell" "info-loaded,unk" "" "" 0
}
}
switch -- $shell {
{cmake} {
set anstxt "-- null"
}
{r} {
set anstxt "\[1\] \"null\""
}
default {
set anstxt "null"
}
}
testall_cmd "$shell" "use,$share_modpath:load,null:info-loaded,null" $anstxt "" 0
}
# test unload of previously loaded modulefile
if {$verbose} {
send_user "\tSetup LOADEDMODULES = 'null'\n"
send_user "\tSetup _LMFILES_ = '$share_modpath/null'\n"
}
set env(LOADEDMODULES) "null"
set env(_LMFILES_) "$share_modpath/null"
foreach shell $shell_list {
testall_cmd "$shell" "module use $share_modpath\; module unload null\; module list -t" "" "$no_loaded" 0
}
foreach shell $othlang_list {
testall_cmd "$shell" "use,$share_modpath:unload,null:list,-t" "" "$no_loaded" 0
}
# ensure advanced_version_spec is efficient on all shells
set loadunloadout "Loading advvers6/1.3\n Loading requirement: advvers7/1.0\nUnloading advvers7/1.0 <aL>\n Unloading dependent: advvers6/1.3"
if {![is_config_locked implicit_default]} {
foreach shell $shell_list {
testall_cmd $shell "module use $testsuite_modpath.2\; module config implicit_default 1\; module config verbosity normal\; module config advanced_version_spec 1\; module load --auto advvers6@1.3\; module unload --auto advvers7@1.0" {} $loadunloadout 0
}
foreach shell $othlang_list {
testall_cmd $shell "use,$testsuite_modpath.2:config,implicit_default,1:config,verbosity,normal:config,advanced_version_spec,1:load,--auto,advvers6@1.3:unload,--auto,advvers7@1.0" {} $loadunloadout 0
}
} elseif {$verbose} {
send_user "\tSkipping advanced_version_spec tests as implicit_default config is locked\n"
}
# test modulepath and module names containing space
if {!$is_symlink_supported} {
send_user "\tskipping tests over '$testsuite_modpath wspace' modulepath as symbolic links are not supported on filesystem\n"
} else {
set loadunloadout "Loading 'space yc/4'\nUnloading 'space yc/4'"
foreach shell $shell_list {
testall_cmd $shell "module use \"$testsuite_modpath wspace\"\; module load -v \"space yc/4\"\; module unload -v \"space yc/4\"" {} $loadunloadout 0
}
foreach shell $othlang_list {
testall_cmd $shell "use,$testsuite_modpath wspace:load,-v,space yc/4:unload,-v,space yc/4" {} $loadunloadout 0
}
}
# test complete command
setenv_var TESTSUITE_COMPLETE comp3
foreach shell $shell_list {
if {$shell in {bash tcsh fish}} {
testall_cmd $shell "module use \"$testsuite_modpath.3\"\; module load complete/1.0\; cmd" cmd {} 0
testall_cmd $shell "module use \"$testsuite_modpath.3\"\; module load complete/1.0 complete/1.1\; cmd" cmd {} 0
}
}
unsetenv_var TESTSUITE_COMPLETE
# test noglob eval on sh-kind shells
foreach shell $shell_list {
if {$shell in {sh bash ksh zsh}} {
set tsout {foo}
if {$shell eq {sh} && $sh_strict} {
set tserr {.*eval: \[\[: not found.*}
} else {
set tserr {}
}
testouterr_cmd_re $shell "module use \"$testsuite_modpath.3\"\; module load noglobeval/1.0\; foo" $tsout $tserr
}
}
# test unset undefined elements on shells
foreach shell $shell_list {
foreach elt {variable alias function complete} {
setenv_var TESTSUITE_UNSET $elt
testall_cmd $shell "module use \"$testsuite_modpath.4\"\; module load unset/1.0" {} {} 0
}
}
unsetenv_var TESTSUITE_UNSET
# test special characters in environment variable
foreach shell $shell_list {
if {$shell in {csh tcsh}} {
if {$install_wa277 eq {y}} {
set tsout "abc : \\|<>!#$^&'\"()@x%y\\z:sh* -"
} else {
set tsout "abc : {}|<>!#$^&'\"()@x%y\\z:sh* -"
}
} else {
set tsout "abc : {}|<>!#$^&'\"()@x%y\\z:sh*\n -"
}
testouterr_cmd $shell "module use \"$testsuite_modpath\"\; module load eschars/1.0\; echo \"\$pathelogical -\"" $tsout {}
}
#
# Clean up variables used in this test case
#
reset_test_env
# vim:set tabstop=3 shiftwidth=3 expandtab autoindent:
|