Debian Codegraph @

testsuite/modules.30-cache/040-cache-use.exp

raw
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 DEBUG findModulesInCacheFile: found foo \\(1\\)
273 .*
274 DEBUG \\\[#1:load:foo\\\] findModulesInCacheFile: cache file '[escre $mp2cache]' has already been evaluated
275 DEBUG \\\[#1:load:foo\\\] findModulesInCacheFile: 2 elements are cached for '[escre $mp2]'
276 DEBUG \\\[#1:load:foo\\\] findModulesInCacheFile: 0 limited access files for '[escre $mp2]'
277 DEBUG \\\[#1:load:foo\\\] findModulesInCacheFile: 0 limited access dirs for '[escre $mp2]'
278 DEBUG \\\[#1:load:foo\\\] findModulesInCacheFile: found bar \\(1\\)
279 .*"
280 testouterr_cmd_re sh {load foo -D} $ans $tserr
281
282 file delete $mp2cache
283 file delete $mp2/bar
284 file delete $mp2/foo
285 file delete $mp2
286
287
288 # test over a modulepath containing a space character
289 # skip test on MSYS platform or if symlink creation is not supported
290 if {$is_symlink_supported && $os_name ne {msys}} {
291 set mpws "$env(HOME)/mp ws"
292 set mpwscache $mpws/.modulecache
293 file link -symbolic $mpws $mp1
294 setenv_var MODULEPATH $mpws
295
296 set tserr [msg_create '$mpwscache']
297 testouterr_cmd sh cachebuild OK $tserr
298
299 testouterr_cmd sh {avail -a -t -o } OK $tserr_avail1
300 testouterr_cmd sh {avail -a -t -o foo} OK $tserr_avail2
301
302 set tserr "$modlin [escre $mpws] $modlin
303 \\s+bar/1.0: bar/1.0
304 \\s+bar/2.0: bar/2.0
305 \\s+baz/w s: baz/w s
306 \\s+baz/w\"s: baz/w\"s
307 \\s+baz/w#s: baz/w#s
308 \\s+foo/2.0: foo/2.0
309 \\s+quux/oth/3.0: quux/oth/3.0
310 \\s+quux/oth/4.0: quux/oth/4.0
311 \\s+quux/sub/1.0: quux/sub/1.0
312 \\s+quux/sub/2.0: quux/sub/2.0
313 \\s+quxa/1.0: quxa/1.0
314 \\s+quxb/1.0: quxb/1.0
315 \\s+quxc/1.0: quxc/1.0
316 \\s+quxd/1.0: quxd/1.0
317 \\s+quxe/1.0: quxe/1.0
318 \\s+w s/1.0: w s/1.0
319 \\s+w\"s/1.0: w\"s/1.0
320 \\s+w#s/1.0: w#s/1.0"
321 testouterr_cmd_re sh whatis OK $tserr
322 set tserr "$modlin [escre $mpws] $modlin
323 \\s+baz/w s: baz/w s
324 \\s+baz/w\"s: baz/w\"s
325 \\s+baz/w#s: baz/w#s"
326 testouterr_cmd_re sh {whatis baz} OK $tserr
327
328 set ans [list]
329 lappend ans [list set __MODULES_LMALTNAME bar/1.0&bar/default&bar]
330 lappend ans [list set _LMFILES_ $mpws/bar/1.0]
331 lappend ans [list set LOADEDMODULES bar/1.0]
332 testouterr_cmd sh {load bar} $ans {}
333
334 set tserr "$err_magic'$mpws/foo/.modulerc'\n$err_contact
335 $err_magic'$mpws/foo/1.0'\n$err_contact"
336 testouterr_cmd sh {load foo/1.0} ERR $tserr
337
338 set tserr "$err_magic'$mpws/foo/.modulerc'\n$err_contact
339 [moderr_minverreq $mpws/foo/3.0 99]"
340 testouterr_cmd sh {load foo/3.0} ERR $tserr
341
342 set tserr "$err_magic'[escre $mpws]/foo/.modulerc'\n$err_contact
343
344 [escre [msg_load foo/5.0 [msg_moderr {missing close-brace} if\ \{<EXM> $mpws/foo/5.0 2]]]"
345 testouterr_cmd_re sh {load foo/5.0} ERR $tserr
346
347 set ans [list]
348 lappend ans [list set __MODULES_LMALTNAME .hid/1.0&as|.hid/default&as|.hid/latest]
349 lappend ans [list set _LMFILES_ $mpws/.hid/1.0]
350 lappend ans [list set LOADEDMODULES .hid/1.0]
351 testouterr_cmd sh {load .hid} $ans {}
352
353 file delete $mpwscache
354 file delete $mpws
355 }
356
357
358 # test symbol/tag resolution
359 setenv_var MODULEPATH $mp1
360
361 set tserr [msg_create $mp1cache]
362 testouterr_cmd sh cachebuild OK $tserr
363 set tserr "$mp1:
364 quux/oth/(default)
365 quux/oth/3.0(sym) <bar>
366 quux/oth/4.0
367 quux/sub/1.0 <foo>
368 quux/sub/2.0"
369 testouterr_cmd sh {avail -t quux} OK $tserr
370
371
372 # test indepth/noindepth resolution
373 set tserr "$mp1:
374 bar/
375 baz/
376 foo/
377 quux/
378 quxa/
379 quxb/
380 quxc/
381 quxd/
382 quxe/
383 'w s'/
384 w\"s/
385 w#s/"
386 testouterr_cmd sh {avail -t --no-indepth} OK $tserr
387 set tserr "$mp1:
388 quux/"
389 testouterr_cmd sh {avail -t --no-indepth quux} OK $tserr
390 set tserr "$mp1:
391 quux/oth/(default)
392 quux/sub/"
393 testouterr_cmd sh {avail -t --no-indepth quux/} OK $tserr
394 testouterr_cmd sh {avail -t --no-indepth quux/*} OK $tserr
395 set tserr "$mp1:
396 quux/oth/(default)"
397 testouterr_cmd sh {avail -t --no-indepth quux/o} OK $tserr
398 set tserr ""
399 testouterr_cmd sh {avail -t --no-indepth quux/nok} OK $tserr
400 testouterr_cmd sh {avail -t --no-indepth quux/no} OK $tserr
401
402 file delete $mp1cache
403
404
405 # test debug output
406 setenv_var MODULEPATH $mp2
407 lassign [create_simple_module_setup $mp2] other_dir_list other_file_list
408 array set other_file_arr $other_file_list
409
410 set tserr [msg_create $mp2cache]
411 testouterr_cmd sh cachebuild OK $tserr
412
413 set tserr ".*
414 DEBUG findModulesInCacheFile: cache file '[escre $mp2]/.modulecache' exists and is readable
415 .*
416 DEBUG findModulesInCacheFile: 4 elements are cached for '[escre $mp2]'
417 DEBUG findModulesInCacheFile: 0 limited access files for '[escre $mp2]'
418 DEBUG findModulesInCacheFile: 0 limited access dirs for '[escre $mp2]'
419 .*
420 DEBUG findModulesInCacheFile: found foo/.modulerc foo/1.0 \\(2\\)
421 .*"
422 testouterr_cmd_re sh {avail -D -t foo/1.0} OK $tserr
423 set tserr ".*
424 DEBUG findModulesInCacheFile: cache file '[escre $mp2]/.modulecache' exists and is readable
425 DEBUG setConf: cache_expiry_secs set to '0'
426 DEBUG findModulesInCacheFile: execute-cachefile [escre $mp2]/.modulecache [escre $mp2]
427 .*
428 DEBUG findModulesInCacheFile: 4 elements are cached for '[escre $mp2]'
429 .*
430 DEBUG findModulesInCacheFile: found foo/.modulerc foo/1.0 \\(2\\)
431 .*"
432 testouterr_cmd_re sh {avail -DD -t foo/1.0} OK $tserr
433 set tserr ".*
434 TIMER findModulesInCacheFile [escre $mp2] foo 0 0 \\(.* ms\\)
435 .*
436 [escre $mp2]:
437 foo/1.0
438 .*"
439 testouterr_cmd_re sh {avail -D --timer -t foo/1.0} OK $tserr
440 testouterr_cmd_re sh {avail -DD --timer -t foo/1.0} OK $tserr
441
442 set tserr ".*
443 Get modules: {} matching 'foo/1.0' in ''
444 Evaluate cache file: '[escre $mp2cache]'
445 Evaluate modulerc: '[escre $mp2]/foo/.modulerc'
446 Get modules: {foo/1.0} matching 'foo/1.0' in '[escre $mp2]'
447 [escre $mp2]:
448 foo/1.0"
449 testouterr_cmd_re sh {avail -T -t foo/1.0} OK $tserr
450
451 file delete $mp2cache
452 set tserr ".*
453 Get modules: {} matching 'foo/1.0' in ''
454 Evaluate modulerc: '[escre $mp2]/foo/.modulerc'
455 Get modules: {foo/1.0} matching 'foo/1.0' in '[escre $mp2]'
456 [escre $mp2]:
457 foo/1.0"
458 testouterr_cmd_re sh {avail -T -t foo/1.0} OK $tserr
459
460
461 # cache usage when mcookie_check is set to eval (same result as if
462 # option is set to always)
463 setenv_path_var MODULEPATH $mp1
464 set tserr [msg_create $mp1cache]
465 testouterr_cmd sh cachebuild OK $tserr
466 setenv_var MODULES_MCOOKIE_CHECK eval
467 testouterr_cmd sh {avail -a -t -o } OK $tserr_avail1
468 testouterr_cmd sh {avail -a -t -o foo} OK $tserr_avail2
469 testouterr_cmd_re sh whatis OK $tserr_whatis1
470 testouterr_cmd_re sh {whatis baz} OK $tserr_whatis2
471 testouterr_cmd sh {load bar} $ans_load1 {}
472 testouterr_cmd sh {load foo/1.0} ERR $tserr_load2
473 testouterr_cmd sh {load foo/3.0} ERR $tserr_load3
474 testouterr_cmd_re sh {load foo/5.0} ERR $tserr_load4
475 testouterr_cmd sh {load .hid} $ans_load5 {}
476 setenv_var MODULES_MCOOKIE_CHECK always
477
478 # cache usage when mcookie_version_check is disabled (same result as if
479 # option is enabled)
480 setenv_var MODULES_MCOOKIE_VERSION_CHECK 0
481 testouterr_cmd sh {avail -a -t -o } OK $tserr_avail1
482 testouterr_cmd sh {avail -a -t -o foo} OK $tserr_avail2
483 testouterr_cmd_re sh whatis OK $tserr_whatis1
484 testouterr_cmd_re sh {whatis baz} OK $tserr_whatis2
485 testouterr_cmd sh {load bar} $ans_load1 {}
486 testouterr_cmd sh {load foo/1.0} ERR $tserr_load2
487 testouterr_cmd sh {load foo/3.0} ERR $tserr_load3
488 testouterr_cmd_re sh {load foo/5.0} ERR $tserr_load4
489 testouterr_cmd sh {load .hid} $ans_load5 {}
490 setenv_var MODULES_MCOOKIE_VERSION_CHECK 1
491 file delete $mp1cache
492
493
494 # cannot test access if cannot change file permission
495 if {!$is_file_perms_editable} {
496 send_user "\tskipping access tests as file permissions cannot be changed\n"
497 # cannot test access if superuser privileges are in use
498 } elseif {$tcl_platform(user) eq "root"} {
499 send_user "\tskipping access tests as tests are run by superuser\n"
500 # cannot test access if restricted file permissions have no effect
501 } elseif {$is_locked_dir_file_readable && $is_locked_file_readable} {
502 send_user "\tskipping access tests as locked files or directories are still readable\n"
503 } else {
504
505 set noread_perms ugo-r
506
507 # check expected siteconfig file is installed
508 set is_stderr_tty [siteconfig_isStderrTty]
509 if {$is_stderr_tty} {
510 # test a cache read failure by faking cache file is readable
511 setenv_var TESTSUITE_ENABLE_SITECONFIG_CACHE_READ 1
512 create_dummy_cachefile $mp1
513 change_file_perms $mp1cache $noread_perms
514 testouterr_cmd sh {avail -a -t -o } OK $tserr_avail1
515 testouterr_cmd sh {load bar} $ans_load1b [err_permdenied $mp1cache]
516 restore_file_perms $mp1cache
517 file delete $mp1cache
518 unsetenv_var TESTSUITE_ENABLE_SITECONFIG_CACHE_READ
519 }
520
521 }
522
523
524 #
525 # Cleanup
526 #
527
528 # delete created files and dirs
529 delete_module_setup $mp1 [array names file_arr] $dir_list
530 delete_module_setup $mp2 [array names other_file_arr] $other_dir_list
531
532 reset_test_env