| 1 |
############################################################################## |
| 2 |
# Modules Revision 3.0 |
| 3 |
# Providing a flexible user environment |
| 4 |
# |
| 5 |
# File: modules.30-cache/%M% |
| 6 |
# Revision: %I% |
| 7 |
# First Edition: 2022/11/24 |
| 8 |
# Last Mod.: %U%, %G% |
| 9 |
# |
| 10 |
# Authors: Xavier Delaruelle, [email protected] |
| 11 |
# |
| 12 |
# Description: Testuite testsequence |
| 13 |
# Command: avail, whatis, load |
| 14 |
# Modulefiles: |
| 15 |
# Sub-Command: |
| 16 |
# |
| 17 |
# Comment: %C{ |
| 18 |
# Test use of cachefiles |
| 19 |
# }C% |
| 20 |
# |
| 21 |
############################################################################## |
| 22 |
|
| 23 |
# filesystem on Cygwin platform is responding in an unexpected way |
| 24 |
# skip these tests on this platform for now |
| 25 |
skip_if_os_in cygwin |
| 26 |
|
| 27 |
# ensure avail tests are made using in depth mode |
| 28 |
setenv_var MODULES_AVAIL_INDEPTH 1 |
| 29 |
|
| 30 |
# ensure avail tests have implicit default enabled |
| 31 |
setenv_var MODULES_IMPLICIT_DEFAULT 1 |
| 32 |
|
| 33 |
# ensure auto symbolic versions are set for these tests |
| 34 |
setenv_var MODULES_ADVANCED_VERSION_SPEC 1 |
| 35 |
|
| 36 |
# ensure regular avail search match is set for these tests |
| 37 |
setenv_var MODULES_SEARCH_MATCH starts_with |
| 38 |
|
| 39 |
# generate content in modulepaths |
| 40 |
lassign [create_diverse_module_setup $mp1] dir_list file_list |
| 41 |
array set file_arr $file_list |
| 42 |
|
| 43 |
setenv_var MODULEPATH $mp1 |
| 44 |
|
| 45 |
# create file cache for test |
| 46 |
set tserr [msg_create $mp1cache] |
| 47 |
testouterr_cmd sh cachebuild OK $tserr |
| 48 |
|
| 49 |
set tserr {} |
| 50 |
foreach f [lsort [array names file_arr]] { |
| 51 |
switch -glob -- $f { |
| 52 |
*/.modulerc - */.version - foo/1.0 - foo/3.0 - quux/nok/5.0 -\ |
| 53 |
.git/ignmod - quux/SCCS/ignmod - {w s/1.0~} - foo/1.0,v -\ |
| 54 |
quxc/1.0~ - .svn/ignmod - .sos/ignmod {} |
| 55 |
{* *} {lappend tserr '$f'} |
| 56 |
default {lappend tserr $f} |
| 57 |
} |
| 58 |
} |
| 59 |
set tserr_avail1 [join $tserr \n] |
| 60 |
testouterr_cmd sh {avail -a -t -o } OK $tserr_avail1 |
| 61 |
set tserr_avail2 [join {foo/2.0 foo/4.0 foo/5.0 foo/6.0} \n] |
| 62 |
testouterr_cmd sh {avail -a -t -o foo} OK $tserr_avail2 |
| 63 |
|
| 64 |
set tserr_whatis1 "$modlin [escre $mp1] $modlin |
| 65 |
\\s+bar/1.0: bar/1.0 |
| 66 |
\\s+bar/2.0: bar/2.0 |
| 67 |
\\s+baz/w s: baz/w s |
| 68 |
\\s+baz/w\"s: baz/w\"s |
| 69 |
\\s+baz/w#s: baz/w#s |
| 70 |
\\s+foo/2.0: foo/2.0 |
| 71 |
\\s+quux/oth/3.0: quux/oth/3.0 |
| 72 |
\\s+quux/oth/4.0: quux/oth/4.0 |
| 73 |
\\s+quux/sub/1.0: quux/sub/1.0 |
| 74 |
\\s+quux/sub/2.0: quux/sub/2.0 |
| 75 |
\\s+quxa/1.0: quxa/1.0 |
| 76 |
\\s+quxb/1.0: quxb/1.0 |
| 77 |
\\s+quxc/1.0: quxc/1.0 |
| 78 |
\\s+quxd/1.0: quxd/1.0 |
| 79 |
\\s+quxe/1.0: quxe/1.0 |
| 80 |
\\s+w s/1.0: w s/1.0 |
| 81 |
\\s+w\"s/1.0: w\"s/1.0 |
| 82 |
\\s+w#s/1.0: w#s/1.0" |
| 83 |
testouterr_cmd_re sh whatis OK $tserr_whatis1 |
| 84 |
set tserr_whatis2 "$modlin [escre $mp1] $modlin |
| 85 |
\\s+baz/w s: baz/w s |
| 86 |
\\s+baz/w\"s: baz/w\"s |
| 87 |
\\s+baz/w#s: baz/w#s" |
| 88 |
testouterr_cmd_re sh {whatis baz} OK $tserr_whatis2 |
| 89 |
|
| 90 |
set ans_load1 [list] |
| 91 |
lappend ans_load1 [list set __MODULES_LMALTNAME bar/1.0&bar/default&bar] |
| 92 |
lappend ans_load1 [list set _LMFILES_ $mp1/bar/1.0] |
| 93 |
lappend ans_load1 [list set LOADEDMODULES bar/1.0] |
| 94 |
testouterr_cmd sh {load bar} $ans_load1 {} |
| 95 |
|
| 96 |
set tserr_load2 "$err_magic'$mp1/foo/.modulerc'\n$err_contact |
| 97 |
$err_magic'$mp1/foo/1.0'\n$err_contact" |
| 98 |
testouterr_cmd sh {load foo/1.0} ERR $tserr_load2 |
| 99 |
|
| 100 |
set tserr_load3 "$err_magic'$mp1/foo/.modulerc'\n$err_contact |
| 101 |
[moderr_minverreq $mp1/foo/3.0 99]" |
| 102 |
testouterr_cmd sh {load foo/3.0} ERR $tserr_load3 |
| 103 |
|
| 104 |
set tserr_load4 "$err_magic'[escre $mp1]/foo/.modulerc'\n$err_contact |
| 105 |
|
| 106 |
[escre [msg_load foo/5.0 [msg_moderr {missing close-brace} if\ \{<EXM> $mp1/foo/5.0 2]]]" |
| 107 |
testouterr_cmd_re sh {load foo/5.0} ERR $tserr_load4 |
| 108 |
|
| 109 |
set ans_load5 [list] |
| 110 |
lappend ans_load5 [list set __MODULES_LMALTNAME .hid/1.0&as|.hid/default&as|.hid/latest] |
| 111 |
lappend ans_load5 [list set _LMFILES_ $mp1/.hid/1.0] |
| 112 |
lappend ans_load5 [list set LOADEDMODULES .hid/1.0] |
| 113 |
testouterr_cmd sh {load .hid} $ans_load5 {} |
| 114 |
|
| 115 |
# delete generated cache file |
| 116 |
file delete $mp1cache |
| 117 |
|
| 118 |
# clean setup prior quitting if quick mode |
| 119 |
if {[is_quick_mode]} { |
| 120 |
delete_module_setup $mp1 [array names file_arr] $dir_list |
| 121 |
} |
| 122 |
skip_if_quick_mode |
| 123 |
|
| 124 |
# same tests without a cache (should get same result) |
| 125 |
testouterr_cmd sh {avail -a -t -o } OK $tserr_avail1 |
| 126 |
testouterr_cmd sh {avail -a -t -o foo} OK $tserr_avail2 |
| 127 |
testouterr_cmd_re sh whatis OK $tserr_whatis1 |
| 128 |
testouterr_cmd_re sh {whatis baz} OK $tserr_whatis2 |
| 129 |
testouterr_cmd sh {load bar} $ans_load1 {} |
| 130 |
testouterr_cmd sh {load foo/1.0} ERR $tserr_load2 |
| 131 |
testouterr_cmd sh {load foo/3.0} ERR $tserr_load3 |
| 132 |
testouterr_cmd_re sh {load foo/5.0} ERR $tserr_load4 |
| 133 |
testouterr_cmd sh {load .hid} $ans_load5 {} |
| 134 |
|
| 135 |
# tests with empty cache file |
| 136 |
create_dummy_cachefile $mp1 |
| 137 |
testouterr_cmd sh {avail -a -t -o } OK {} |
| 138 |
testouterr_cmd sh {avail -a -t -o foo} OK {} |
| 139 |
testouterr_cmd_re sh whatis OK {} |
| 140 |
testouterr_cmd_re sh {whatis baz} ERR $err_path'baz' |
| 141 |
testouterr_cmd sh {load bar} ERR $err_path'bar' |
| 142 |
testouterr_cmd sh {load foo/1.0} ERR $err_path'foo/1.0' |
| 143 |
testouterr_cmd sh {load foo/3.0} ERR $err_path'foo/3.0' |
| 144 |
testouterr_cmd sh {load foo/5.0} ERR $err_path'foo/5.0' |
| 145 |
testouterr_cmd sh {load .hid} ERR $err_path'.hid' |
| 146 |
file delete $mp1cache |
| 147 |
|
| 148 |
# tests with a cache containing only few elements |
| 149 |
set fid [open $mp1cache w] |
| 150 |
puts $fid "#%Module$::cache_mcookie_version |
| 151 |
modulefile-content bar/1.0 1664035017 #%Module #%Module" |
| 152 |
close $fid |
| 153 |
testouterr_cmd sh {avail -a -t -o } OK bar/1.0 |
| 154 |
testouterr_cmd sh {avail -a -t -o foo} OK {} |
| 155 |
set tserr "- Package/Alias $modlin.- Versions $modlin.- Last mod. $modlin |
| 156 |
[escre $mp1]: |
| 157 |
bar/1.0\\s+[clock format 1664035017 -format {%Y/%m/%d %H:%M:%S}]" |
| 158 |
testouterr_cmd_re sh {avail -l} OK $tserr |
| 159 |
testouterr_cmd_re sh whatis OK {} |
| 160 |
testouterr_cmd_re sh {whatis baz} ERR $err_path'baz' |
| 161 |
set ans [list] |
| 162 |
lappend ans [list set __MODULES_LMALTNAME bar/1.0&as|bar/default&as|bar/latest] |
| 163 |
lappend ans [list set _LMFILES_ $mp1/bar/1.0] |
| 164 |
lappend ans [list set LOADEDMODULES bar/1.0] |
| 165 |
testouterr_cmd sh {load bar} $ans {} |
| 166 |
testouterr_cmd sh {load foo/1.0} ERR $err_path'foo/1.0' |
| 167 |
testouterr_cmd sh {load foo/3.0} ERR $err_path'foo/3.0' |
| 168 |
testouterr_cmd sh {load foo/5.0} ERR $err_path'foo/5.0' |
| 169 |
testouterr_cmd sh {load .hid} ERR $err_path'.hid' |
| 170 |
file delete $mp1cache |
| 171 |
|
| 172 |
# test with an empty file (no module header) |
| 173 |
close [open $mp1cache w] |
| 174 |
testouterr_cmd sh {avail -a -t -o } OK $tserr_avail1 |
| 175 |
testouterr_cmd sh {avail -a -t -o foo} OK $tserr_avail2 |
| 176 |
testouterr_cmd_re sh whatis OK $tserr_whatis1 |
| 177 |
testouterr_cmd_re sh {whatis baz} OK $tserr_whatis2 |
| 178 |
set ans_load1b [list] |
| 179 |
lappend ans_load1b [list set __MODULES_LMALTNAME bar/1.0&bar/default&bar] |
| 180 |
lappend ans_load1b [list set _LMFILES_ $mp1/bar/1.0] |
| 181 |
lappend ans_load1b [list set LOADEDMODULES bar/1.0] |
| 182 |
lappend ans_load1b [list ERR] |
| 183 |
testouterr_cmd sh {load bar} $ans_load1b [cacheerr_magic $mp1cache] |
| 184 |
testouterr_cmd sh {load foo/1.0} ERR [cacheerr_magic $mp1cache]\n$tserr_load2 |
| 185 |
testouterr_cmd sh {load foo/3.0} ERR [cacheerr_magic $mp1cache]\n$tserr_load3 |
| 186 |
testouterr_cmd_re sh {load foo/5.0} ERR [cacheerr_magic [escre $mp1cache]]\n$tserr_load4 |
| 187 |
set ans_load5b [list] |
| 188 |
lappend ans_load5b [list set __MODULES_LMALTNAME .hid/1.0&as|.hid/default&as|.hid/latest] |
| 189 |
lappend ans_load5b [list set _LMFILES_ $mp1/.hid/1.0] |
| 190 |
lappend ans_load5b [list set LOADEDMODULES .hid/1.0] |
| 191 |
lappend ans_load5b [list ERR] |
| 192 |
testouterr_cmd sh {load .hid} $ans_load5b [cacheerr_magic $mp1cache] |
| 193 |
file delete $mp1cache |
| 194 |
|
| 195 |
# test with a module header without version specification |
| 196 |
set fid [open $mp1cache w] |
| 197 |
puts $fid "#%Module |
| 198 |
modulefile-content bar/1.0 1664035017 #%Module #%Module" |
| 199 |
close $fid |
| 200 |
testouterr_cmd sh {avail -a -t -o } OK $tserr_avail1 |
| 201 |
testouterr_cmd sh {avail -a -t -o foo} OK $tserr_avail2 |
| 202 |
testouterr_cmd sh {load bar} $ans_load1b [cacheerr_misverreq $mp1cache] |
| 203 |
file delete $mp1cache |
| 204 |
|
| 205 |
# test with a module header with required version too high |
| 206 |
set fid [open $mp1cache w] |
| 207 |
puts $fid "#%Module99 |
| 208 |
modulefile-content bar/1.0 1664035017 #%Module #%Module" |
| 209 |
close $fid |
| 210 |
testouterr_cmd sh {avail -a -t -o } OK $tserr_avail1 |
| 211 |
testouterr_cmd sh {avail -a -t -o foo} OK $tserr_avail2 |
| 212 |
testouterr_cmd sh {load bar} $ans_load1 {} |
| 213 |
file delete $mp1cache |
| 214 |
|
| 215 |
# test with a module header with required version below current version |
| 216 |
set fid [open $mp1cache w] |
| 217 |
puts $fid "#%Module5.2 |
| 218 |
modulefile-content bar/1.0 1664035017 #%Module #%Module" |
| 219 |
close $fid |
| 220 |
testouterr_cmd sh {avail -a -t -o } OK bar/1.0 |
| 221 |
testouterr_cmd sh {avail -a -t -o foo} OK {} |
| 222 |
set ans [list] |
| 223 |
lappend ans [list set __MODULES_LMALTNAME bar/1.0&as|bar/default&as|bar/latest] |
| 224 |
lappend ans [list set _LMFILES_ $mp1/bar/1.0] |
| 225 |
lappend ans [list set LOADEDMODULES bar/1.0] |
| 226 |
testouterr_cmd sh {load bar} $ans {} |
| 227 |
file delete $mp1cache |
| 228 |
|
| 229 |
# tests with a cache containing element that does not exists anymore in modulepath |
| 230 |
set fid [open $mp1cache w] |
| 231 |
puts $fid "#%Module$::cache_mcookie_version |
| 232 |
modulefile-content bar/5.0 1664035017 #%Module #%Module" |
| 233 |
close $fid |
| 234 |
testouterr_cmd sh {avail -a -t -o } OK bar/5.0 |
| 235 |
set tserr "- Package/Alias $modlin.- Versions $modlin.- Last mod. $modlin |
| 236 |
[escre $mp1]: |
| 237 |
bar/5.0\\s+[clock format 1664035017 -format {%Y/%m/%d %H:%M:%S}]" |
| 238 |
testouterr_cmd_re sh {avail -l} OK $tserr |
| 239 |
set ans [list] |
| 240 |
lappend ans [list set __MODULES_LMALTNAME bar/5.0&as|bar/default&as|bar/latest] |
| 241 |
lappend ans [list set _LMFILES_ $mp1/bar/5.0] |
| 242 |
lappend ans [list set LOADEDMODULES bar/5.0] |
| 243 |
testouterr_cmd sh {load bar} $ans {} |
| 244 |
file delete $mp1cache |
| 245 |
|
| 246 |
|
| 247 |
# test potential double cache evaluation situation |
| 248 |
setenv_var MODULEPATH $mp2 |
| 249 |
file mkdir $mp2 |
| 250 |
set fid [open $mp2/foo w] |
| 251 |
puts $fid {#%Module |
| 252 |
if {[is-avail bar]} { |
| 253 |
module load bar |
| 254 |
} |
| 255 |
} |
| 256 |
close $fid |
| 257 |
create_dummy_modulefile $mp2/bar |
| 258 |
set tserr [msg_create $mp2cache] |
| 259 |
testouterr_cmd sh cachebuild OK $tserr |
| 260 |
|
| 261 |
set ans [list] |
| 262 |
lappend ans [list set __MODULES_LMPREREQ foo&bar] |
| 263 |
lappend ans [list set _LMFILES_ $mp2/bar:$mp2/foo] |
| 264 |
lappend ans [list set LOADEDMODULES bar:foo] |
| 265 |
lappend ans [list set __MODULES_LMTAG bar&auto-loaded] |
| 266 |
set tserr ".* |
| 267 |
DEBUG findModulesInCacheFile: cache file '[escre $mp2cache]' exists and is readable |
| 268 |
.* |
| 269 |
DEBUG findModulesInCacheFile: 2 elements are cached for '[escre $mp2]' |
| 270 |
DEBUG findModulesInCacheFile: 0 limited access files for '[escre $mp2]' |
| 271 |
DEBUG findModulesInCacheFile: 0 limited access dirs for '[escre $mp2]' |
| 272 |
.* |
| 273 |
DEBUG findModulesInCacheFile: found foo \\(1\\) |
| 274 |
.* |
| 275 |
DEBUG \\\[#1:load:foo\\\] findModulesInCacheFile: cache file '[escre $mp2cache]' has already been evaluated |
| 276 |
DEBUG \\\[#1:load:foo\\\] findModulesInCacheFile: 2 elements are cached for '[escre $mp2]' |
| 277 |
DEBUG \\\[#1:load:foo\\\] findModulesInCacheFile: 0 limited access files for '[escre $mp2]' |
| 278 |
DEBUG \\\[#1:load:foo\\\] findModulesInCacheFile: 0 limited access dirs for '[escre $mp2]' |
| 279 |
DEBUG \\\[#1:load:foo\\\] findModulesInCacheFile: found bar \\(1\\) |
| 280 |
.*" |
| 281 |
testouterr_cmd_re sh {load foo -D} $ans $tserr |
| 282 |
|
| 283 |
file delete $mp2cache |
| 284 |
file delete $mp2/bar |
| 285 |
file delete $mp2/foo |
| 286 |
file delete $mp2 |
| 287 |
|
| 288 |
|
| 289 |
# test over a modulepath containing a space character |
| 290 |
# skip test on MSYS platform or if symlink creation is not supported |
| 291 |
if {$is_symlink_supported && $os_name ne {msys}} { |
| 292 |
set mpws "$env(HOME)/mp ws" |
| 293 |
set mpwscache $mpws/.modulecache |
| 294 |
file link -symbolic $mpws $mp1 |
| 295 |
setenv_var MODULEPATH $mpws |
| 296 |
|
| 297 |
set tserr [msg_create '$mpwscache'] |
| 298 |
testouterr_cmd sh cachebuild OK $tserr |
| 299 |
|
| 300 |
testouterr_cmd sh {avail -a -t -o } OK $tserr_avail1 |
| 301 |
testouterr_cmd sh {avail -a -t -o foo} OK $tserr_avail2 |
| 302 |
|
| 303 |
set tserr "$modlin [escre $mpws] $modlin |
| 304 |
\\s+bar/1.0: bar/1.0 |
| 305 |
\\s+bar/2.0: bar/2.0 |
| 306 |
\\s+baz/w s: baz/w s |
| 307 |
\\s+baz/w\"s: baz/w\"s |
| 308 |
\\s+baz/w#s: baz/w#s |
| 309 |
\\s+foo/2.0: foo/2.0 |
| 310 |
\\s+quux/oth/3.0: quux/oth/3.0 |
| 311 |
\\s+quux/oth/4.0: quux/oth/4.0 |
| 312 |
\\s+quux/sub/1.0: quux/sub/1.0 |
| 313 |
\\s+quux/sub/2.0: quux/sub/2.0 |
| 314 |
\\s+quxa/1.0: quxa/1.0 |
| 315 |
\\s+quxb/1.0: quxb/1.0 |
| 316 |
\\s+quxc/1.0: quxc/1.0 |
| 317 |
\\s+quxd/1.0: quxd/1.0 |
| 318 |
\\s+quxe/1.0: quxe/1.0 |
| 319 |
\\s+w s/1.0: w s/1.0 |
| 320 |
\\s+w\"s/1.0: w\"s/1.0 |
| 321 |
\\s+w#s/1.0: w#s/1.0" |
| 322 |
testouterr_cmd_re sh whatis OK $tserr |
| 323 |
set tserr "$modlin [escre $mpws] $modlin |
| 324 |
\\s+baz/w s: baz/w s |
| 325 |
\\s+baz/w\"s: baz/w\"s |
| 326 |
\\s+baz/w#s: baz/w#s" |
| 327 |
testouterr_cmd_re sh {whatis baz} OK $tserr |
| 328 |
|
| 329 |
set ans [list] |
| 330 |
lappend ans [list set __MODULES_LMALTNAME bar/1.0&bar/default&bar] |
| 331 |
lappend ans [list set _LMFILES_ $mpws/bar/1.0] |
| 332 |
lappend ans [list set LOADEDMODULES bar/1.0] |
| 333 |
testouterr_cmd sh {load bar} $ans {} |
| 334 |
|
| 335 |
set tserr "$err_magic'$mpws/foo/.modulerc'\n$err_contact |
| 336 |
$err_magic'$mpws/foo/1.0'\n$err_contact" |
| 337 |
testouterr_cmd sh {load foo/1.0} ERR $tserr |
| 338 |
|
| 339 |
set tserr "$err_magic'$mpws/foo/.modulerc'\n$err_contact |
| 340 |
[moderr_minverreq $mpws/foo/3.0 99]" |
| 341 |
testouterr_cmd sh {load foo/3.0} ERR $tserr |
| 342 |
|
| 343 |
set tserr "$err_magic'[escre $mpws]/foo/.modulerc'\n$err_contact |
| 344 |
|
| 345 |
[escre [msg_load foo/5.0 [msg_moderr {missing close-brace} if\ \{<EXM> $mpws/foo/5.0 2]]]" |
| 346 |
testouterr_cmd_re sh {load foo/5.0} ERR $tserr |
| 347 |
|
| 348 |
set ans [list] |
| 349 |
lappend ans [list set __MODULES_LMALTNAME .hid/1.0&as|.hid/default&as|.hid/latest] |
| 350 |
lappend ans [list set _LMFILES_ $mpws/.hid/1.0] |
| 351 |
lappend ans [list set LOADEDMODULES .hid/1.0] |
| 352 |
testouterr_cmd sh {load .hid} $ans {} |
| 353 |
|
| 354 |
file delete $mpwscache |
| 355 |
file delete $mpws |
| 356 |
} |
| 357 |
|
| 358 |
|
| 359 |
# test symbol/tag resolution |
| 360 |
setenv_var MODULEPATH $mp1 |
| 361 |
|
| 362 |
set tserr [msg_create $mp1cache] |
| 363 |
testouterr_cmd sh cachebuild OK $tserr |
| 364 |
set tserr "$mp1: |
| 365 |
quux/oth/(default) |
| 366 |
quux/oth/3.0(sym) <bar> |
| 367 |
quux/oth/4.0 |
| 368 |
quux/sub/1.0 <foo> |
| 369 |
quux/sub/2.0" |
| 370 |
testouterr_cmd sh {avail -t quux} OK $tserr |
| 371 |
|
| 372 |
|
| 373 |
# test indepth/noindepth resolution |
| 374 |
set tserr "$mp1: |
| 375 |
bar/ |
| 376 |
baz/ |
| 377 |
foo/ |
| 378 |
quux/ |
| 379 |
quxa/ |
| 380 |
quxb/ |
| 381 |
quxc/ |
| 382 |
quxd/ |
| 383 |
quxe/ |
| 384 |
'w s'/ |
| 385 |
w\"s/ |
| 386 |
w#s/" |
| 387 |
testouterr_cmd sh {avail -t --no-indepth} OK $tserr |
| 388 |
set tserr "$mp1: |
| 389 |
quux/" |
| 390 |
testouterr_cmd sh {avail -t --no-indepth quux} OK $tserr |
| 391 |
set tserr "$mp1: |
| 392 |
quux/oth/(default) |
| 393 |
quux/sub/" |
| 394 |
testouterr_cmd sh {avail -t --no-indepth quux/} OK $tserr |
| 395 |
testouterr_cmd sh {avail -t --no-indepth quux/*} OK $tserr |
| 396 |
set tserr "$mp1: |
| 397 |
quux/oth/(default)" |
| 398 |
testouterr_cmd sh {avail -t --no-indepth quux/o} OK $tserr |
| 399 |
set tserr "" |
| 400 |
testouterr_cmd sh {avail -t --no-indepth quux/nok} OK $tserr |
| 401 |
testouterr_cmd sh {avail -t --no-indepth quux/no} OK $tserr |
| 402 |
|
| 403 |
file delete $mp1cache |
| 404 |
|
| 405 |
|
| 406 |
# test debug output |
| 407 |
setenv_var MODULEPATH $mp2 |
| 408 |
lassign [create_simple_module_setup $mp2] other_dir_list other_file_list |
| 409 |
array set other_file_arr $other_file_list |
| 410 |
|
| 411 |
set tserr [msg_create $mp2cache] |
| 412 |
testouterr_cmd sh cachebuild OK $tserr |
| 413 |
|
| 414 |
set tserr ".* |
| 415 |
DEBUG findModulesInCacheFile: cache file '[escre $mp2]/.modulecache' exists and is readable |
| 416 |
.* |
| 417 |
DEBUG findModulesInCacheFile: 4 elements are cached for '[escre $mp2]' |
| 418 |
DEBUG findModulesInCacheFile: 0 limited access files for '[escre $mp2]' |
| 419 |
DEBUG findModulesInCacheFile: 0 limited access dirs for '[escre $mp2]' |
| 420 |
.* |
| 421 |
DEBUG findModulesInCacheFile: found foo/.modulerc foo/1.0 \\(2\\) |
| 422 |
.*" |
| 423 |
testouterr_cmd_re sh {avail -D -t foo/1.0} OK $tserr |
| 424 |
set tserr ".* |
| 425 |
DEBUG findModulesInCacheFile: cache file '[escre $mp2]/.modulecache' exists and is readable |
| 426 |
DEBUG setConf: cache_expiry_secs set to '0' |
| 427 |
DEBUG findModulesInCacheFile: execute-cachefile [escre $mp2]/.modulecache [escre $mp2] |
| 428 |
.* |
| 429 |
DEBUG findModulesInCacheFile: 4 elements are cached for '[escre $mp2]' |
| 430 |
.* |
| 431 |
DEBUG findModulesInCacheFile: found foo/.modulerc foo/1.0 \\(2\\) |
| 432 |
.*" |
| 433 |
testouterr_cmd_re sh {avail -DD -t foo/1.0} OK $tserr |
| 434 |
set tserr ".* |
| 435 |
TIMER findModulesInCacheFile [escre $mp2] foo 0 0 \\(.* ms\\) |
| 436 |
.* |
| 437 |
[escre $mp2]: |
| 438 |
foo/1.0 |
| 439 |
.*" |
| 440 |
testouterr_cmd_re sh {avail -D --timer -t foo/1.0} OK $tserr |
| 441 |
testouterr_cmd_re sh {avail -DD --timer -t foo/1.0} OK $tserr |
| 442 |
|
| 443 |
set tserr ".* |
| 444 |
Get modules: {} matching 'foo/1.0' in '' |
| 445 |
Evaluate cache file: '[escre $mp2cache]' |
| 446 |
Evaluate modulerc: '[escre $mp2]/foo/.modulerc' |
| 447 |
Get modules: {foo/1.0} matching 'foo/1.0' in '[escre $mp2]' |
| 448 |
[escre $mp2]: |
| 449 |
foo/1.0" |
| 450 |
testouterr_cmd_re sh {avail -T -t foo/1.0} OK $tserr |
| 451 |
|
| 452 |
file delete $mp2cache |
| 453 |
set tserr ".* |
| 454 |
Get modules: {} matching 'foo/1.0' in '' |
| 455 |
Evaluate modulerc: '[escre $mp2]/foo/.modulerc' |
| 456 |
Get modules: {foo/1.0} matching 'foo/1.0' in '[escre $mp2]' |
| 457 |
[escre $mp2]: |
| 458 |
foo/1.0" |
| 459 |
testouterr_cmd_re sh {avail -T -t foo/1.0} OK $tserr |
| 460 |
|
| 461 |
|
| 462 |
# cache usage when mcookie_check is set to eval (same result as if |
| 463 |
# option is set to always) |
| 464 |
setenv_path_var MODULEPATH $mp1 |
| 465 |
set tserr [msg_create $mp1cache] |
| 466 |
testouterr_cmd sh cachebuild OK $tserr |
| 467 |
setenv_var MODULES_MCOOKIE_CHECK eval |
| 468 |
testouterr_cmd sh {avail -a -t -o } OK $tserr_avail1 |
| 469 |
testouterr_cmd sh {avail -a -t -o foo} OK $tserr_avail2 |
| 470 |
testouterr_cmd_re sh whatis OK $tserr_whatis1 |
| 471 |
testouterr_cmd_re sh {whatis baz} OK $tserr_whatis2 |
| 472 |
testouterr_cmd sh {load bar} $ans_load1 {} |
| 473 |
testouterr_cmd sh {load foo/1.0} ERR $tserr_load2 |
| 474 |
testouterr_cmd sh {load foo/3.0} ERR $tserr_load3 |
| 475 |
testouterr_cmd_re sh {load foo/5.0} ERR $tserr_load4 |
| 476 |
testouterr_cmd sh {load .hid} $ans_load5 {} |
| 477 |
setenv_var MODULES_MCOOKIE_CHECK always |
| 478 |
|
| 479 |
# cache usage when mcookie_version_check is disabled (same result as if |
| 480 |
# option is enabled) |
| 481 |
setenv_var MODULES_MCOOKIE_VERSION_CHECK 0 |
| 482 |
testouterr_cmd sh {avail -a -t -o } OK $tserr_avail1 |
| 483 |
testouterr_cmd sh {avail -a -t -o foo} OK $tserr_avail2 |
| 484 |
testouterr_cmd_re sh whatis OK $tserr_whatis1 |
| 485 |
testouterr_cmd_re sh {whatis baz} OK $tserr_whatis2 |
| 486 |
testouterr_cmd sh {load bar} $ans_load1 {} |
| 487 |
testouterr_cmd sh {load foo/1.0} ERR $tserr_load2 |
| 488 |
testouterr_cmd sh {load foo/3.0} ERR $tserr_load3 |
| 489 |
testouterr_cmd_re sh {load foo/5.0} ERR $tserr_load4 |
| 490 |
testouterr_cmd sh {load .hid} $ans_load5 {} |
| 491 |
setenv_var MODULES_MCOOKIE_VERSION_CHECK 1 |
| 492 |
file delete $mp1cache |
| 493 |
|
| 494 |
|
| 495 |
# cannot test access if cannot change file permission |
| 496 |
if {!$is_file_perms_editable} { |
| 497 |
send_user "\tskipping access tests as file permissions cannot be changed\n" |
| 498 |
# cannot test access if superuser privileges are in use |
| 499 |
} elseif {$tcl_platform(user) eq "root"} { |
| 500 |
send_user "\tskipping access tests as tests are run by superuser\n" |
| 501 |
# cannot test access if restricted file permissions have no effect |
| 502 |
} elseif {$is_locked_dir_file_readable && $is_locked_file_readable} { |
| 503 |
send_user "\tskipping access tests as locked files or directories are still readable\n" |
| 504 |
} else { |
| 505 |
|
| 506 |
set noread_perms ugo-r |
| 507 |
|
| 508 |
# check expected siteconfig file is installed |
| 509 |
set is_stderr_tty [siteconfig_isStderrTty] |
| 510 |
if {$is_stderr_tty} { |
| 511 |
# test a cache read failure by faking cache file is readable |
| 512 |
setenv_var TESTSUITE_ENABLE_SITECONFIG_CACHE_READ 1 |
| 513 |
create_dummy_cachefile $mp1 |
| 514 |
change_file_perms $mp1cache $noread_perms |
| 515 |
testouterr_cmd sh {avail -a -t -o } OK $tserr_avail1 |
| 516 |
testouterr_cmd sh {load bar} $ans_load1b [err_permdenied $mp1cache] |
| 517 |
restore_file_perms $mp1cache |
| 518 |
file delete $mp1cache |
| 519 |
unsetenv_var TESTSUITE_ENABLE_SITECONFIG_CACHE_READ |
| 520 |
} |
| 521 |
|
| 522 |
} |
| 523 |
|
| 524 |
|
| 525 |
# |
| 526 |
# Cleanup |
| 527 |
# |
| 528 |
|
| 529 |
# delete created files and dirs |
| 530 |
delete_module_setup $mp1 [array names file_arr] $dir_list |
| 531 |
delete_module_setup $mp2 [array names other_file_arr] $other_dir_list |
| 532 |
|
| 533 |
reset_test_env |