| 1 |
############################################################################## |
| 2 |
# Modules Revision 3.0 |
| 3 |
# Providing a flexible user environment |
| 4 |
# |
| 5 |
# File: modules.70-maint/%M% |
| 6 |
# Revision: %I% |
| 7 |
# First Edition: 2020/04/05 |
| 8 |
# Last Mod.: %U%, %G% |
| 9 |
# |
| 10 |
# Authors: Xavier Delaruelle, [email protected] |
| 11 |
# |
| 12 |
# Description: Testuite testsequence |
| 13 |
# Command: |
| 14 |
# Modulefiles: |
| 15 |
# Sub-Command: |
| 16 |
# |
| 17 |
# Comment: %C{ |
| 18 |
# Test automatic symbolic version defined for each module name |
| 19 |
# }C% |
| 20 |
# |
| 21 |
############################################################################## |
| 22 |
|
| 23 |
skip_if_quick_mode |
| 24 |
|
| 25 |
# ensure avail -t tests have implicit default enabled |
| 26 |
setenv_var MODULES_IMPLICIT_DEFAULT 1 |
| 27 |
|
| 28 |
# ensure regular avail search match is set for these tests |
| 29 |
setenv_var MODULES_SEARCH_MATCH starts_with |
| 30 |
|
| 31 |
# ensure avail tests are made using in depth mode |
| 32 |
setenv_var MODULES_AVAIL_INDEPTH 1 |
| 33 |
|
| 34 |
# ensure last matching element is returned when unloading modules |
| 35 |
setenv_var MODULES_UNLOAD_MATCH_ORDER returnlast |
| 36 |
|
| 37 |
set mp "$modpath.2" |
| 38 |
set mpre [regsub -all "\(\[.+?\]\)" $mp {\\\1}] |
| 39 |
|
| 40 |
# setup specific environment |
| 41 |
setenv_path_var MODULEPATH $mp |
| 42 |
|
| 43 |
set key_sym "\n\nKey:\n(symbolic-version)" |
| 44 |
|
| 45 |
# test auto symbols enablement (when implicit_default and advanced_version_spec |
| 46 |
# is enabled and no module version already exists) |
| 47 |
|
| 48 |
setenv_var MODULES_IMPLICIT_DEFAULT 0 |
| 49 |
setenv_var MODULES_ADVANCED_VERSION_SPEC 0 |
| 50 |
|
| 51 |
set ans [list] |
| 52 |
lappend ans [list set _LMFILES_ $mp/foo/2] |
| 53 |
lappend ans [list set LOADEDMODULES foo/2] |
| 54 |
|
| 55 |
testouterr_cmd sh {avail -t foo/default} OK {} |
| 56 |
testouterr_cmd sh {avail -t foo/latest} OK {} |
| 57 |
testouterr_cmd sh {avail -t foo@latest} OK {} |
| 58 |
testouterr_cmd sh {load foo/default} ERR $err_path'foo/default' |
| 59 |
testouterr_cmd sh {load foo@default} ERR $err_path'foo@default' |
| 60 |
testouterr_cmd sh {load foo/latest} ERR $err_path'foo/latest' |
| 61 |
testouterr_cmd sh {whatis foo/default} ERR $err_path'foo/default' |
| 62 |
testouterr_cmd sh {whatis foo/latest} ERR $err_path'foo/latest' |
| 63 |
testouterr_cmd sh {whatis foo@latest} ERR $err_path'foo@latest' |
| 64 |
testouterr_cmd sh {load foo/2} $ans {} |
| 65 |
|
| 66 |
setenv_var MODULES_IMPLICIT_DEFAULT 1 |
| 67 |
setenv_var MODULES_ADVANCED_VERSION_SPEC 0 |
| 68 |
|
| 69 |
testouterr_cmd sh {avail -t foo/default} OK {} |
| 70 |
testouterr_cmd sh {avail -t foo/latest} OK {} |
| 71 |
testouterr_cmd sh {avail -t foo@latest} OK {} |
| 72 |
testouterr_cmd sh {load foo/default} ERR $err_path'foo/default' |
| 73 |
testouterr_cmd sh {load foo@default} ERR $err_path'foo@default' |
| 74 |
testouterr_cmd sh {load foo/latest} ERR $err_path'foo/latest' |
| 75 |
testouterr_cmd sh {whatis foo/default} ERR $err_path'foo/default' |
| 76 |
testouterr_cmd sh {whatis foo/latest} ERR $err_path'foo/latest' |
| 77 |
testouterr_cmd sh {whatis foo@latest} ERR $err_path'foo@latest' |
| 78 |
testouterr_cmd sh {load foo/2} $ans {} |
| 79 |
|
| 80 |
# cannot test feature enablement if its requirements are disabled and locked |
| 81 |
if {[is_config_locked implicit_default] && [is_conf_enabled implicitdefault]} { |
| 82 |
send_user "\tskipping auto symbol disablement tests as implicit_default config is enabled and locked\n" |
| 83 |
} else { |
| 84 |
|
| 85 |
setenv_var MODULES_IMPLICIT_DEFAULT 0 |
| 86 |
setenv_var MODULES_ADVANCED_VERSION_SPEC 1 |
| 87 |
|
| 88 |
testouterr_cmd sh {avail -t foo@default} OK {} |
| 89 |
testouterr_cmd sh {avail -t foo@latest} OK {} |
| 90 |
testouterr_cmd sh {avail -t foo/latest} OK {} |
| 91 |
testouterr_cmd sh {load foo@default} ERR $err_path'foo@default' |
| 92 |
testouterr_cmd sh {load foo/default} ERR $err_path'foo/default' |
| 93 |
testouterr_cmd sh {load foo@latest} ERR $err_path'foo@latest' |
| 94 |
testouterr_cmd sh {whatis foo@default} ERR $err_path'foo@default' |
| 95 |
testouterr_cmd sh {whatis foo@latest} ERR $err_path'foo@latest' |
| 96 |
testouterr_cmd sh {whatis foo/latest} ERR $err_path'foo/latest' |
| 97 |
testouterr_cmd sh {load foo/2} $ans {} |
| 98 |
|
| 99 |
} |
| 100 |
|
| 101 |
# cannot test feature enablement if its requirements are disabled and locked |
| 102 |
if {[is_config_locked implicit_default] && ![is_conf_enabled implicitdefault]} { |
| 103 |
send_user "\tskipping auto symbol tests as implicit_default config is disabled and locked\n" |
| 104 |
} else { |
| 105 |
|
| 106 |
setenv_var MODULES_IMPLICIT_DEFAULT 1 |
| 107 |
setenv_var MODULES_ADVANCED_VERSION_SPEC 1 |
| 108 |
|
| 109 |
set ans [list] |
| 110 |
lappend ans [list set __MODULES_LMALTNAME foo/2&as|foo/default&as|foo/latest] |
| 111 |
lappend ans [list set _LMFILES_ $mp/foo/2] |
| 112 |
lappend ans [list set LOADEDMODULES foo/2] |
| 113 |
|
| 114 |
testouterr_cmd sh {avail -t foo@default} OK $mp:\nfoo/2 |
| 115 |
testouterr_cmd sh {avail -t foo@latest} OK $mp:\nfoo/2 |
| 116 |
testouterr_cmd sh {avail -t foo/latest} OK $mp:\nfoo/2 |
| 117 |
testouterr_cmd sh {load foo} $ans {} |
| 118 |
testouterr_cmd sh {load foo@default} $ans {} |
| 119 |
testouterr_cmd sh {load foo/default} $ans {} |
| 120 |
testouterr_cmd sh {load foo@latest} $ans {} |
| 121 |
# found but no whatis string to output |
| 122 |
testouterr_cmd sh {whatis foo@default} OK {} |
| 123 |
testouterr_cmd sh {whatis foo@latest} OK {} |
| 124 |
testouterr_cmd sh {whatis foo/latest} OK {} |
| 125 |
testouterr_cmd sh {load foo/2} $ans {} |
| 126 |
|
| 127 |
|
| 128 |
# querying auto symbols |
| 129 |
|
| 130 |
testouterr_cmd sh {is-loaded foo} ERR {} |
| 131 |
testouterr_cmd sh {is-loaded foo@default} ERR {} |
| 132 |
testouterr_cmd sh {is-loaded foo/default} ERR {} |
| 133 |
testouterr_cmd sh {is-loaded foo/latest} ERR {} |
| 134 |
testouterr_cmd sh {is-loaded foo@latest} ERR {} |
| 135 |
setenv_loaded_module [list foo/2] [list $mp/foo/2] |
| 136 |
setenv_var __MODULES_LMALTNAME foo/2&as|foo/default&as|foo/latest |
| 137 |
testouterr_cmd sh {load foo} OK {} |
| 138 |
testouterr_cmd sh {load foo@default} OK {} |
| 139 |
testouterr_cmd sh {load foo/default} OK {} |
| 140 |
testouterr_cmd sh {load foo@latest} OK {} |
| 141 |
testouterr_cmd sh {load foo/latest} OK {} |
| 142 |
testouterr_cmd sh {is-loaded foo@default} OK {} |
| 143 |
testouterr_cmd sh {is-loaded foo/default} OK {} |
| 144 |
testouterr_cmd sh {is-loaded foo/latest} OK {} |
| 145 |
testouterr_cmd sh {is-loaded foo@latest} OK {} |
| 146 |
testouterr_cmd sh {list -t} OK $cur_loaded\nfoo/2 |
| 147 |
unsetenv_loaded_module |
| 148 |
unsetenv_var __MODULES_LMALTNAME |
| 149 |
|
| 150 |
|
| 151 |
# symbol already exists |
| 152 |
|
| 153 |
testouterr_cmd sh {avail -t autosym1@default} OK $mp:\nautosym1/1(default) |
| 154 |
testouterr_cmd sh {avail -t autosym1/latest} OK $mp:\nautosym1/2 |
| 155 |
set ans [list] |
| 156 |
lappend ans [list set __MODULES_LMALTNAME autosym1/1&autosym1/default&autosym1] |
| 157 |
lappend ans [list set _LMFILES_ $mp/autosym1/1] |
| 158 |
lappend ans [list set LOADEDMODULES autosym1/1] |
| 159 |
testouterr_cmd sh {load autosym1/default} $ans {} |
| 160 |
set ans [list] |
| 161 |
lappend ans [list set __MODULES_LMALTNAME autosym1/2&as|autosym1/latest] |
| 162 |
lappend ans [list set _LMFILES_ $mp/autosym1/2] |
| 163 |
lappend ans [list set LOADEDMODULES autosym1/2] |
| 164 |
testouterr_cmd sh {load autosym1@latest} $ans {} |
| 165 |
testouterr_cmd_re sh {whatis autosym1@default} OK "$modlin $mpre $modlin\n\\s+autosym1/1: autosym1/1" |
| 166 |
testouterr_cmd_re sh {whatis autosym1/latest} OK "$modlin $mpre $modlin\n\\s+autosym1/2: autosym1/2" |
| 167 |
testouterr_cmd sh {is-loaded autosym1/default} ERR {} |
| 168 |
testouterr_cmd sh {is-loaded autosym1@latest} ERR {} |
| 169 |
setenv_loaded_module [list autosym1/1 autosym1/2] [list $mp/autosym1/1 $mp/autosym2/2] |
| 170 |
setenv_var __MODULES_LMALTNAME autosym1/1&autosym1/default&autosym1:autosym1/2&as|autosym1/latest |
| 171 |
testouterr_cmd sh {is-loaded autosym1/default} OK {} |
| 172 |
testouterr_cmd sh {is-loaded autosym1@latest} OK {} |
| 173 |
testouterr_cmd sh {load autosym1/default} OK {} |
| 174 |
testouterr_cmd sh {load autosym1@latest} OK {} |
| 175 |
testouterr_cmd sh {list} OK "$cur_loaded\n 1) autosym1/1(default) 2) autosym1/2$key_sym" |
| 176 |
unsetenv_loaded_module |
| 177 |
unsetenv_var __MODULES_LMALTNAME |
| 178 |
|
| 179 |
testouterr_cmd sh {avail -t autosym2@default} OK $mp:\nautosym2/2(bar:latest) |
| 180 |
testouterr_cmd sh {avail -t autosym2/latest} OK $mp:\nautosym2/2(bar:latest) |
| 181 |
set ans [list] |
| 182 |
lappend ans [list set __MODULES_LMALTNAME autosym2/2&autosym2/latest&autosym2/bar&as|autosym2/default] |
| 183 |
lappend ans [list set _LMFILES_ $mp/autosym2/2] |
| 184 |
lappend ans [list set LOADEDMODULES autosym2/2] |
| 185 |
testouterr_cmd sh {load autosym2/default} $ans {} |
| 186 |
testouterr_cmd sh {load autosym2@latest} $ans {} |
| 187 |
testouterr_cmd_re sh {whatis autosym2@default} OK "$modlin $mpre $modlin\n\\s+autosym2/2: autosym2/2" |
| 188 |
testouterr_cmd_re sh {whatis autosym2/latest} OK "$modlin $mpre $modlin\n\\s+autosym2/2: autosym2/2" |
| 189 |
testouterr_cmd sh {is-loaded autosym2/default} ERR {} |
| 190 |
testouterr_cmd sh {is-loaded autosym2@latest} ERR {} |
| 191 |
setenv_loaded_module [list autosym2/1 autosym2/2] [list $mp/autosym2/1 $mp/autosym2/2] |
| 192 |
setenv_var __MODULES_LMALTNAME autosym2/2&autosym2/latest&autosym2/bar&as|autosym2/default |
| 193 |
testouterr_cmd sh {is-loaded autosym2/default} OK {} |
| 194 |
testouterr_cmd sh {is-loaded autosym2@latest} OK {} |
| 195 |
testouterr_cmd sh {load autosym2/default} OK {} |
| 196 |
testouterr_cmd sh {load autosym2@latest} OK {} |
| 197 |
testouterr_cmd sh {list} OK "$cur_loaded\n 1) autosym2/1 2) autosym2/2(bar:latest)$key_sym" |
| 198 |
unsetenv_loaded_module |
| 199 |
unsetenv_var __MODULES_LMALTNAME |
| 200 |
|
| 201 |
testouterr_cmd sh {avail -t autosym3@default} OK $mp:\nautosym3/1(default) |
| 202 |
testouterr_cmd sh {avail -t autosym3/latest} OK $mp:\nautosym3/2(latest) |
| 203 |
set ans [list] |
| 204 |
lappend ans [list set __MODULES_LMALTNAME autosym3/1&autosym3/default&autosym3] |
| 205 |
lappend ans [list set _LMFILES_ $mp/autosym3/1] |
| 206 |
lappend ans [list set LOADEDMODULES autosym3/1] |
| 207 |
testouterr_cmd sh {load autosym3/default} $ans {} |
| 208 |
set ans [list] |
| 209 |
lappend ans [list set __MODULES_LMALTNAME autosym3/2&autosym3/latest] |
| 210 |
lappend ans [list set _LMFILES_ $mp/autosym3/2] |
| 211 |
lappend ans [list set LOADEDMODULES autosym3/2] |
| 212 |
testouterr_cmd sh {load autosym3@latest} $ans {} |
| 213 |
testouterr_cmd_re sh {whatis autosym3@default} OK "$modlin $mpre $modlin\n\\s+autosym3/1: autosym3/1" |
| 214 |
testouterr_cmd_re sh {whatis autosym3/latest} OK "$modlin $mpre $modlin\n\\s+autosym3/2: autosym3/2" |
| 215 |
testouterr_cmd sh {is-loaded autosym3/default} ERR {} |
| 216 |
testouterr_cmd sh {is-loaded autosym3@latest} ERR {} |
| 217 |
setenv_loaded_module [list autosym3/1 autosym3/2] [list $mp/autosym3/1 $mp/autosym3/2] |
| 218 |
setenv_var __MODULES_LMALTNAME autosym3/1&autosym3/default&autosym3:autosym3/2&autosym3/latest |
| 219 |
testouterr_cmd sh {is-loaded autosym3/default} OK {} |
| 220 |
testouterr_cmd sh {is-loaded autosym3@latest} OK {} |
| 221 |
testouterr_cmd sh {load autosym3/default} OK {} |
| 222 |
testouterr_cmd sh {load autosym3@latest} OK {} |
| 223 |
testouterr_cmd sh {list} OK "$cur_loaded\n 1) autosym3/1(default) 2) autosym3/2(latest)$key_sym" |
| 224 |
unsetenv_loaded_module |
| 225 |
unsetenv_var __MODULES_LMALTNAME |
| 226 |
|
| 227 |
|
| 228 |
# alias, virtual or regular version file exists |
| 229 |
|
| 230 |
testouterr_cmd sh {avail -t autosym4@default} OK $mp:\nautosym4/latest(@) |
| 231 |
testouterr_cmd sh {avail -t autosym4/latest} OK $mp:\nautosym4/latest(@) |
| 232 |
set ans [list] |
| 233 |
lappend ans [list set __MODULES_LMALTNAME autosym4/2&al|autosym4/latest&as|autosym4/default] |
| 234 |
lappend ans [list set _LMFILES_ $mp/autosym4/2] |
| 235 |
lappend ans [list set LOADEDMODULES autosym4/2] |
| 236 |
testouterr_cmd sh {load autosym4/default} $ans {} |
| 237 |
testouterr_cmd sh {load autosym4@latest} $ans {} |
| 238 |
testouterr_cmd_re sh {whatis autosym4@default} OK "$modlin $mpre $modlin\n\\s+autosym4/2: autosym4/2" |
| 239 |
testouterr_cmd_re sh {whatis autosym4/latest} OK "$modlin $mpre $modlin\n\\s+autosym4/2: autosym4/2" |
| 240 |
testouterr_cmd sh {is-loaded autosym4/default} ERR {} |
| 241 |
testouterr_cmd sh {is-loaded autosym4@latest} ERR {} |
| 242 |
setenv_loaded_module [list autosym4/1 autosym4/2] [list $mp/autosym4/1 $mp/autosym4/2] |
| 243 |
setenv_var __MODULES_LMALTNAME autosym4/2&al|autosym4/latest&as|autosym4/default |
| 244 |
testouterr_cmd sh {is-loaded autosym4/default} OK {} |
| 245 |
testouterr_cmd sh {is-loaded autosym4@latest} OK {} |
| 246 |
testouterr_cmd sh {load autosym4/default} OK {} |
| 247 |
testouterr_cmd sh {load autosym4@latest} OK {} |
| 248 |
testouterr_cmd sh {list} OK "$cur_loaded\n 1) autosym4/1 2) autosym4/2" |
| 249 |
unsetenv_loaded_module |
| 250 |
unsetenv_var __MODULES_LMALTNAME |
| 251 |
|
| 252 |
testouterr_cmd sh {avail -t autosym5@default} OK $mp:\nautosym5/default |
| 253 |
testouterr_cmd sh {avail -t autosym5/latest} OK $mp:\nautosym5/default |
| 254 |
set ans [list] |
| 255 |
lappend ans [list set __MODULES_LMALTNAME autosym5/default&as|autosym5/latest] |
| 256 |
lappend ans [list set _LMFILES_ $mp/autosym5/default] |
| 257 |
lappend ans [list set LOADEDMODULES autosym5/default] |
| 258 |
testouterr_cmd sh {load autosym5/default} $ans {} |
| 259 |
testouterr_cmd sh {load autosym5@latest} $ans {} |
| 260 |
testouterr_cmd_re sh {whatis autosym5@default} OK "$modlin $mpre $modlin\n\\s+autosym5/default: autosym5/default" |
| 261 |
testouterr_cmd_re sh {whatis autosym5/latest} OK "$modlin $mpre $modlin\n\\s+autosym5/default: autosym5/default" |
| 262 |
testouterr_cmd sh {is-loaded autosym5/default} ERR {} |
| 263 |
testouterr_cmd sh {is-loaded autosym5@latest} ERR {} |
| 264 |
setenv_loaded_module [list autosym5/default] [list $mp/autosym5/default] |
| 265 |
setenv_var __MODULES_LMALTNAME autosym5/default&as|autosym5/latest |
| 266 |
testouterr_cmd sh {is-loaded autosym5/default} OK {} |
| 267 |
testouterr_cmd sh {is-loaded autosym5@latest} OK {} |
| 268 |
testouterr_cmd sh {load autosym5/default} OK {} |
| 269 |
testouterr_cmd sh {load autosym5@latest} OK {} |
| 270 |
testouterr_cmd sh {list} OK "$cur_loaded\n 1) autosym5/default" |
| 271 |
unsetenv_loaded_module |
| 272 |
unsetenv_var __MODULES_LMALTNAME |
| 273 |
|
| 274 |
testouterr_cmd sh {avail -t autosym6@default} OK $mp:\nautosym6/default(@) |
| 275 |
testouterr_cmd sh {avail -t autosym6/latest} OK $mp:\nautosym6/latest |
| 276 |
set ans [list] |
| 277 |
lappend ans [list set __MODULES_LMALTNAME autosym6/1&autosym6/zzz&al|autosym6/default] |
| 278 |
lappend ans [list set _LMFILES_ $mp/autosym6/1] |
| 279 |
lappend ans [list set LOADEDMODULES autosym6/1] |
| 280 |
testouterr_cmd sh {load autosym6/default} $ans {} |
| 281 |
set ans [list] |
| 282 |
lappend ans [list set _LMFILES_ $mp/autosym6/2] |
| 283 |
lappend ans [list set LOADEDMODULES autosym6/latest] |
| 284 |
testouterr_cmd sh {load autosym6@latest} $ans {} |
| 285 |
testouterr_cmd_re sh {whatis autosym6@default} OK "$modlin $mpre $modlin\n\\s+autosym6/1: autosym6/1" |
| 286 |
testouterr_cmd_re sh {whatis autosym6/latest} OK "$modlin $mpre $modlin\n\\s+autosym6/latest: autosym6/latest" |
| 287 |
testouterr_cmd sh {is-loaded autosym6/default} ERR {} |
| 288 |
testouterr_cmd sh {is-loaded autosym6@latest} ERR {} |
| 289 |
setenv_loaded_module [list autosym6/1 autosym6/latest] [list $mp/autosym6/1 $mp/autosym6/2] |
| 290 |
setenv_var __MODULES_LMALTNAME autosym6/1&autosym6/zzz&al|autosym6/default |
| 291 |
testouterr_cmd sh {is-loaded autosym6/default} OK {} |
| 292 |
testouterr_cmd sh {is-loaded autosym6@latest} OK {} |
| 293 |
testouterr_cmd sh {load autosym6/default} OK {} |
| 294 |
testouterr_cmd sh {load autosym6@latest} OK {} |
| 295 |
testouterr_cmd sh {list} OK "$cur_loaded\n 1) autosym6/1(zzz) 2) autosym6/latest$key_sym" |
| 296 |
unsetenv_loaded_module |
| 297 |
unsetenv_var __MODULES_LMALTNAME |
| 298 |
|
| 299 |
|
| 300 |
# icase test |
| 301 |
|
| 302 |
set ans [list] |
| 303 |
lappend ans [list set __MODULES_LMALTNAME foo/2&as|foo/default&as|foo/latest] |
| 304 |
lappend ans [list set _LMFILES_ $mp/foo/2] |
| 305 |
lappend ans [list set LOADEDMODULES foo/2] |
| 306 |
|
| 307 |
testouterr_cmd sh {avail -i -t foo@defAULT} OK $mp:\nfoo/2 |
| 308 |
testouterr_cmd sh {avail -i -t foo@LAtest} OK $mp:\nfoo/2 |
| 309 |
testouterr_cmd sh {load -i foo/defauLT} $ans {} |
| 310 |
testouterr_cmd sh {load -i foo@latESt} $ans {} |
| 311 |
# found but no whatis string to output |
| 312 |
testouterr_cmd sh {whatis -i foo@DEFault} OK {} |
| 313 |
testouterr_cmd sh {whatis -i foo/latest} OK {} |
| 314 |
testouterr_cmd sh {is-loaded -i foo/DEFault} ERR {} |
| 315 |
testouterr_cmd sh {is-loaded -i foo@laTEst} ERR {} |
| 316 |
setenv_loaded_module [list foo/2] [list $mp/foo/2] |
| 317 |
setenv_var __MODULES_LMALTNAME foo/2&as|foo/default&as|foo/latest |
| 318 |
testouterr_cmd sh {is-loaded -i foo/deFAult} OK {} |
| 319 |
testouterr_cmd sh {is-loaded -i foo@LATest} OK {} |
| 320 |
testouterr_cmd sh {load -i foo/defauLT} OK {} |
| 321 |
testouterr_cmd sh {load -i foo@latESt} OK {} |
| 322 |
unsetenv_loaded_module |
| 323 |
unsetenv_var __MODULES_LMALTNAME |
| 324 |
|
| 325 |
|
| 326 |
# auto symbols requires an exact match |
| 327 |
|
| 328 |
testouterr_cmd sh {avail -t foo@def} OK {} |
| 329 |
testouterr_cmd sh {avail -t foo@la} OK {} |
| 330 |
testouterr_cmd sh {avail -t foo@lat*} OK {} |
| 331 |
testouterr_cmd sh {avail -t foo @def??lt} OK {} |
| 332 |
testouterr_cmd sh {avail -t foo@def*?lt} OK {} |
| 333 |
testouterr_cmd sh {avail -t foo/la*?st} OK {} |
| 334 |
testouterr_cmd sh {load foo/la*?st} ERR $err_path'foo/la*?st' |
| 335 |
testouterr_cmd sh {avail -t autosym3/lat} OK $mp:\nautosym3/2(latest) |
| 336 |
testouterr_cmd sh {avail -t -C atest} OK $mp:\nautosym2/2(bar:latest)\nautosym3/2(latest)\nautosym4/latest(@)\nautosym6/latest |
| 337 |
|
| 338 |
|
| 339 |
# test version list, version range |
| 340 |
|
| 341 |
testouterr_cmd sh {avail -t foo@default,latest} OK $mp:\nfoo/2 |
| 342 |
testouterr_cmd sh {avail -t autosym1@default,latest} OK $mp:\nautosym1/1(default)\nautosym1/2 |
| 343 |
set ans [list] |
| 344 |
lappend ans [list set __MODULES_LMALTNAME autosym1/1&autosym1/default&autosym1] |
| 345 |
lappend ans [list set _LMFILES_ $mp/autosym1/1] |
| 346 |
lappend ans [list set LOADEDMODULES autosym1/1] |
| 347 |
testouterr_cmd sh {load autosym1@default,latest} $ans {} |
| 348 |
testouterr_cmd sh {load autosym1@default,2} $ans {} |
| 349 |
testouterr_cmd sh {load autosym1@1,latest} $ans {} |
| 350 |
testouterr_cmd sh {avail -t foo@:latest} ERR $err_rangevers':latest' |
| 351 |
testouterr_cmd sh {avail -t foo@default:} ERR $err_rangevers'default:' |
| 352 |
|
| 353 |
|
| 354 |
# test deep modulefiles |
| 355 |
|
| 356 |
testouterr_cmd sh {avail -t autosym7@default} OK $mp:\nautosym7/dir2/1\nautosym7/dir2/2 |
| 357 |
testouterr_cmd sh {avail -t autosym7/latest} OK $mp:\nautosym7/dir2/1\nautosym7/dir2/2 |
| 358 |
set ans [list] |
| 359 |
lappend ans [list set __MODULES_LMALTNAME autosym7/dir2/2&as|autosym7/default&as|autosym7/latest&as|autosym7/dir2/default&as|autosym7/dir2/latest] |
| 360 |
lappend ans [list set _LMFILES_ $mp/autosym7/dir2/2] |
| 361 |
lappend ans [list set LOADEDMODULES autosym7/dir2/2] |
| 362 |
testouterr_cmd sh {load autosym7/dir2/default} $ans {} |
| 363 |
testouterr_cmd sh {load autosym7/dir2@latest} $ans {} |
| 364 |
testouterr_cmd sh {load autosym7/default} $ans {} |
| 365 |
testouterr_cmd sh {load autosym7@latest} $ans {} |
| 366 |
testouterr_cmd_re sh {whatis autosym7@default} OK "$modlin $mpre $modlin\n\\s+autosym7/dir2/1: autosym7/dir2/1\n\\s+autosym7/dir2/2: autosym7/dir2/2" |
| 367 |
testouterr_cmd_re sh {whatis autosym7@latest} OK "$modlin $mpre $modlin\n\\s+autosym7/dir2/1: autosym7/dir2/1\n\\s+autosym7/dir2/2: autosym7/dir2/2" |
| 368 |
testouterr_cmd_re sh {whatis autosym7/dir2@latest} OK "$modlin $mpre $modlin\n\\s+autosym7/dir2/2: autosym7/dir2/2" |
| 369 |
testouterr_cmd_re sh {whatis autosym7/dir2@latest} OK "$modlin $mpre $modlin\n\\s+autosym7/dir2/2: autosym7/dir2/2" |
| 370 |
testouterr_cmd sh {is-loaded autosym7/default} ERR {} |
| 371 |
testouterr_cmd sh {is-loaded autosym7@latest} ERR {} |
| 372 |
testouterr_cmd sh {is-loaded autosym7/dir2/default} ERR {} |
| 373 |
testouterr_cmd sh {is-loaded autosym7/dir2@latest} ERR {} |
| 374 |
setenv_loaded_module [list autosym7/dir2/2] [list $mp/autosym7/dir2/2] |
| 375 |
setenv_var __MODULES_LMALTNAME autosym7/dir2/2&as|autosym7/default&as|autosym7/latest&as|autosym7/dir2/default&as|autosym7/dir2/latest |
| 376 |
testouterr_cmd sh {is-loaded autosym7/default} OK {} |
| 377 |
testouterr_cmd sh {is-loaded autosym7@latest} OK {} |
| 378 |
testouterr_cmd sh {is-loaded autosym7/dir2/default} OK {} |
| 379 |
testouterr_cmd sh {is-loaded autosym7/dir2@latest} OK {} |
| 380 |
testouterr_cmd sh {load autosym7/default} OK {} |
| 381 |
testouterr_cmd sh {load autosym7@latest} OK {} |
| 382 |
testouterr_cmd sh {load autosym7/dir2/default} OK {} |
| 383 |
testouterr_cmd sh {load autosym7/dir2@latest} OK {} |
| 384 |
testouterr_cmd sh {list} OK "$cur_loaded\n 1) autosym7/dir2/2" |
| 385 |
unsetenv_loaded_module |
| 386 |
unsetenv_var __MODULES_LMALTNAME |
| 387 |
|
| 388 |
set ans [list] |
| 389 |
lappend ans [list set __MODULES_LMALTNAME autosym7/dir1/2&as|autosym7/dir1/default&as|autosym7/dir1/latest] |
| 390 |
lappend ans [list set _LMFILES_ $mp/autosym7/dir1/2] |
| 391 |
lappend ans [list set LOADEDMODULES autosym7/dir1/2] |
| 392 |
testouterr_cmd sh {load autosym7/dir1/default} $ans {} |
| 393 |
testouterr_cmd sh {load autosym7/dir1@latest} $ans {} |
| 394 |
setenv_loaded_module [list autosym7/dir1/2] [list $mp/autosym7/dir1/2] |
| 395 |
setenv_var __MODULES_LMALTNAME autosym7/dir1/2&as|autosym7/dir1/default&as|autosym7/dir1/latest |
| 396 |
testouterr_cmd sh {is-loaded autosym7/dir1/default} OK {} |
| 397 |
testouterr_cmd sh {is-loaded autosym7/dir1@latest} OK {} |
| 398 |
testouterr_cmd sh {is-loaded autosym7/default} ERR {} |
| 399 |
testouterr_cmd sh {is-loaded autosym7@latest} ERR {} |
| 400 |
unsetenv_loaded_module |
| 401 |
unsetenv_var __MODULES_LMALTNAME |
| 402 |
|
| 403 |
|
| 404 |
# symbol spread |
| 405 |
|
| 406 |
set ans [list] |
| 407 |
lappend ans [list set __MODULES_LMALTNAME autosym8/2&al|autosym8/3&as|autosym8/default&as|autosym8/latest] |
| 408 |
lappend ans [list set _LMFILES_ $mp/autosym8/2] |
| 409 |
lappend ans [list set LOADEDMODULES autosym8/2] |
| 410 |
testouterr_cmd sh {load autosym8@latest} $ans {} |
| 411 |
testouterr_cmd sh {avail -t autosym8@default} OK $mp:\nautosym8/3(@) |
| 412 |
setenv_loaded_module [list autosym8/2] [list $mp/autosym8/2] |
| 413 |
setenv_var __MODULES_LMALTNAME autosym8/2&al|autosym8/3&as|autosym8/default&as|autosym8/latest |
| 414 |
testouterr_cmd sh {is-loaded autosym8@latest} OK {} |
| 415 |
unsetenv_loaded_module |
| 416 |
unsetenv_var __MODULES_LMALTNAME |
| 417 |
|
| 418 |
|
| 419 |
# autosymbol name matches an explicit symbolic version that is itself |
| 420 |
# targeted by a module-forbid command coupled to a module-hide --hard one: |
| 421 |
# the entry already found (in error) for this name short-circuits autosymbol |
| 422 |
# creation, yet resolution to the forbidden module is still attempted |
| 423 |
# |
| 424 |
# uses modulefiles.4 rather than modulefiles.2, so this fixture does not show |
| 425 |
# up in the other tests that enumerate modulefiles.2's entire content |
| 426 |
|
| 427 |
set mp_saved $mp |
| 428 |
set mp "$modpath.4" |
| 429 |
setenv_path_var MODULEPATH $mp |
| 430 |
|
| 431 |
testouterr_cmd sh {avail -t autosym10@default} OK $mp:\nautosym10/2 |
| 432 |
testouterr_cmd sh {avail -t autosym10@latest} OK {} |
| 433 |
testouterr_cmd sh {avail -t autosym10/latest} OK {} |
| 434 |
set ans [list] |
| 435 |
lappend ans [list set __MODULES_LMALTNAME autosym10/2&as|autosym10/latest&as|autosym10/default] |
| 436 |
lappend ans [list set _LMFILES_ $mp/autosym10/2] |
| 437 |
lappend ans [list set LOADEDMODULES autosym10/2] |
| 438 |
testouterr_cmd sh {load autosym10} $ans {} |
| 439 |
testouterr_cmd sh {load autosym10/default} $ans {} |
| 440 |
testouterr_cmd sh {load autosym10@latest} ERR [err_accessdenied autosym10/latest] |
| 441 |
testouterr_cmd sh {load autosym10/latest} ERR [err_accessdenied autosym10/latest] |
| 442 |
testouterr_cmd sh {whatis autosym10@latest} ERR [err_accessdenied autosym10/latest] |
| 443 |
testouterr_cmd sh {is-loaded autosym10/default} ERR {} |
| 444 |
testouterr_cmd sh {is-loaded autosym10@latest} ERR {} |
| 445 |
setenv_loaded_module [list autosym10/2] [list $mp/autosym10/2] |
| 446 |
setenv_var __MODULES_LMALTNAME autosym10/2&as|autosym10/latest&as|autosym10/default |
| 447 |
testouterr_cmd sh {is-loaded autosym10/default} OK {} |
| 448 |
testouterr_cmd sh {is-loaded autosym10@latest} OK {} |
| 449 |
testouterr_cmd sh {list} OK "$cur_loaded\n 1) autosym10/2" |
| 450 |
unsetenv_loaded_module |
| 451 |
unsetenv_var __MODULES_LMALTNAME |
| 452 |
|
| 453 |
set mp $mp_saved |
| 454 |
setenv_path_var MODULEPATH $mp |
| 455 |
|
| 456 |
|
| 457 |
# use in requirements |
| 458 |
|
| 459 |
set ans [list] |
| 460 |
lappend ans [list set __MODULES_LMCONFLICT autosym9/1&autosym1@latest] |
| 461 |
lappend ans [list set __MODULES_LMALTNAME foo/2&as|foo/default&as|foo/latest:autosym9/1&as|autosym9/default&as|autosym9/latest] |
| 462 |
lappend ans [list set __MODULES_LMPREREQ autosym9/1&foo@default] |
| 463 |
lappend ans [list set _LMFILES_ $mp/foo/2:$mp/autosym9/1] |
| 464 |
lappend ans [list set LOADEDMODULES foo/2:autosym9/1] |
| 465 |
lappend ans [list set __MODULES_LMTAG foo/2&auto-loaded] |
| 466 |
# test ReqLo |
| 467 |
testouterr_cmd_re sh {load --auto autosym9@1} $ans [msg_top_load autosym9/1 {} foo/2 {}] |
| 468 |
setenv_loaded_module [list foo/2 autosym9/1] [list $mp/foo/2 $mp/autosym9/1] [list foo/2] |
| 469 |
setenv_var __MODULES_LMALTNAME foo/2&as|foo/default&as|foo/latest:autosym9/1&as|autosym9/default&as|autosym9/latest |
| 470 |
setenv_var __MODULES_LMPREREQ autosym9/1&foo@default |
| 471 |
setenv_var __MODULES_LMCONFLICT autosym9/1&autosym1@latest |
| 472 |
# test conflict |
| 473 |
if {[is_conf_enabled autohandling conflictunload]} { |
| 474 |
set ans [list] |
| 475 |
lappend ans [list set __MODULES_LMALTNAME autosym1/2&as|autosym1/latest] |
| 476 |
lappend ans [list unset __MODULES_LMCONFLICT] |
| 477 |
lappend ans [list unset __MODULES_LMPREREQ] |
| 478 |
lappend ans [list set _LMFILES_ $mp/autosym1/2] |
| 479 |
lappend ans [list set LOADEDMODULES autosym1/2] |
| 480 |
lappend ans [list unset __MODULES_LMTAG] |
| 481 |
set tserr [msg_top_load_conun autosym1/2 {} autosym9/1 foo/2 {} {}] |
| 482 |
} else { |
| 483 |
set ans ERR |
| 484 |
set tserr [msg_load autosym1/2 [err_conflict autosym9/1]] |
| 485 |
} |
| 486 |
testouterr_cmd sh {load autosym1@latest} $ans $tserr |
| 487 |
testouterr_cmd sh {load autosym1/2} $ans $tserr |
| 488 |
set ans [list] |
| 489 |
lappend ans [list unset __MODULES_LMALTNAME] |
| 490 |
lappend ans [list unset __MODULES_LMCONFLICT] |
| 491 |
lappend ans [list unset __MODULES_LMPREREQ] |
| 492 |
lappend ans [list unset _LMFILES_] |
| 493 |
lappend ans [list unset LOADEDMODULES] |
| 494 |
lappend ans [list unset __MODULES_LMTAG] |
| 495 |
# test UReqUn |
| 496 |
testouterr_cmd sh {unload --auto autosym9@latest} $ans [msg_top_unload autosym9/1 {} foo/2 {}] |
| 497 |
testouterr_cmd sh {unload --auto autosym9/1} $ans [msg_top_unload autosym9/1 {} foo/2 {}] |
| 498 |
# test DepUn |
| 499 |
testouterr_cmd sh {unload --auto foo@default} $ans [msg_top_unload {foo/2 <aL>} autosym9/1 {} {}] |
| 500 |
testouterr_cmd sh {unload --auto foo@latest} $ans [msg_top_unload {foo/2 <aL>} autosym9/1 {} {}] |
| 501 |
testouterr_cmd sh {unload --auto foo@2} $ans [msg_top_unload {foo/2 <aL>} autosym9/1 {} {}] |
| 502 |
# test DepRe |
| 503 |
setenv_loaded_module [list autosym9/1] [list $mp/autosym9/1] |
| 504 |
setenv_var __MODULES_LMALTNAME autosym9/1&as|autosym9/default&as|autosym9/latest |
| 505 |
setenv_var __MODULES_LMPREREQ autosym9/1&foo@default |
| 506 |
setenv_var __MODULES_LMCONFLICT autosym9/1&autosym1@latest |
| 507 |
set ans [list] |
| 508 |
lappend ans [list set __MODULES_LMALTNAME foo/2&as|foo/default&as|foo/latest:autosym9/1&as|autosym9/default&as|autosym9/latest] |
| 509 |
lappend ans [list set __MODULES_LMCONFLICT autosym9/1&autosym1@latest] |
| 510 |
lappend ans [list set __MODULES_LMPREREQ autosym9/1&foo@default] |
| 511 |
lappend ans [list set _LMFILES_ $mp/foo/2:$mp/autosym9/1] |
| 512 |
lappend ans [list set LOADEDMODULES foo/2:autosym9/1] |
| 513 |
testouterr_cmd_re sh {load --auto foo@2} $ans [msg_top_load foo/2 {} {} autosym9/1] |
| 514 |
testouterr_cmd_re sh {load --auto foo@default} $ans [msg_top_load foo/2 {} {} autosym9/1] |
| 515 |
testouterr_cmd_re sh {load --auto foo@latest} $ans [msg_top_load foo/2 {} {} autosym9/1] |
| 516 |
unsetenv_loaded_module |
| 517 |
unsetenv_var __MODULES_LMALTNAME |
| 518 |
unsetenv_var __MODULES_LMTAG |
| 519 |
unsetenv_var __MODULES_LMCONFLICT |
| 520 |
unsetenv_var __MODULES_LMPREREQ |
| 521 |
|
| 522 |
} |
| 523 |
|
| 524 |
# disable auto symbols once recorded in environment |
| 525 |
|
| 526 |
setenv_var MODULES_ADVANCED_VERSION_SPEC 0 |
| 527 |
setenv_loaded_module [list autosym8/2] [list $mp/autosym8/2] |
| 528 |
setenv_var __MODULES_LMALTNAME autosym8/2&al|autosym8/3&as|autosym8/default&as|autosym8/latest |
| 529 |
testouterr_cmd sh {is-loaded autosym8/default} OK {} |
| 530 |
testouterr_cmd sh {is-loaded autosym8/latest} OK {} |
| 531 |
testouterr_cmd sh {load autosym8/latest} OK {} |
| 532 |
testouterr_cmd sh {load autosym8} OK {} |
| 533 |
testouterr_cmd sh {list} OK "$cur_loaded\n 1) autosym8/2" |
| 534 |
testouterr_cmd sh {avail -t autosym8/latest} OK {} |
| 535 |
testouterr_cmd sh {avail -t autosym8/default} OK {} |
| 536 |
# test requirement resolution once auto symbol is disabled |
| 537 |
setenv_loaded_module [list foo/2 autosym9/1] [list $mp/foo/2 $mp/autosym9/1] [list foo/2] |
| 538 |
setenv_var __MODULES_LMALTNAME foo/2&as|foo/default&as|foo/latest:autosym9/1&as|autosym9/default&as|autosym9/latest |
| 539 |
# hack a little bit requirement definitions to make them fit a disabled advanced_version_spec context |
| 540 |
setenv_var __MODULES_LMPREREQ autosym9/1&foo/default |
| 541 |
setenv_var __MODULES_LMCONFLICT autosym9/1&autosym1/latest |
| 542 |
set ans [list] |
| 543 |
lappend ans [list unset __MODULES_LMALTNAME] |
| 544 |
lappend ans [list unset __MODULES_LMCONFLICT] |
| 545 |
lappend ans [list unset __MODULES_LMPREREQ] |
| 546 |
lappend ans [list unset _LMFILES_] |
| 547 |
lappend ans [list unset LOADEDMODULES] |
| 548 |
lappend ans [list unset __MODULES_LMTAG] |
| 549 |
testouterr_cmd sh {unload --auto foo/default} $ans [msg_top_unload {foo/2 <aL>} autosym9/1 {} {}] |
| 550 |
testouterr_cmd sh {unload --auto foo/latest} $ans [msg_top_unload {foo/2 <aL>} autosym9/1 {} {}] |
| 551 |
testouterr_cmd sh {unload --auto foo/2} $ans [msg_top_unload {foo/2 <aL>} autosym9/1 {} {}] |
| 552 |
# conflict not seen, as symbol is not defined |
| 553 |
set ans [list] |
| 554 |
lappend ans [list set _LMFILES_ $mp/foo/2:$mp/autosym9/1:$mp/autosym1/2] |
| 555 |
lappend ans [list set LOADEDMODULES foo/2:autosym9/1:autosym1/2] |
| 556 |
testouterr_cmd_re sh {load autosym1/2} $ans {} |
| 557 |
unsetenv_loaded_module |
| 558 |
unsetenv_var __MODULES_LMALTNAME |
| 559 |
unsetenv_var __MODULES_LMTAG |
| 560 |
unsetenv_var __MODULES_LMCONFLICT |
| 561 |
unsetenv_var __MODULES_LMPREREQ |
| 562 |
|
| 563 |
|
| 564 |
# |
| 565 |
# Cleanup |
| 566 |
# |
| 567 |
|
| 568 |
reset_test_env |