Skip to content

Commit 8bbfa43

Browse files
committed
ts: cover leftover modulepath-ignore code paths
Exercise ignore patterns that compile to a void matcher (slash or negation character only) and a pattern ending with a trailing backslash, which is matched literally. Also cover the walk of a limited access '.version' rc file from cache file that a previous module search from same command has already evaluated. Assisted-by: Claude:claude-fable-5 Signed-off-by: Xavier Delaruelle <xavier.delaruelle@cea.fr>
1 parent 03da5ea commit 8bbfa43

2 files changed

Lines changed: 18 additions & 4 deletions

File tree

‎testsuite/modules.20-locate/180-modulepath-ignore.exp‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,19 +157,21 @@ file delete -force $userhome
157157

158158
# double asterisk (leading, middle and mid-segment), character range
159159
# (regular and negated), single character, escaped characters, leading
160-
# slash anchor and unclosed character range patterns, defined over several
161-
# modulepath-ignore calls in same rc file
160+
# slash anchor, unclosed character range, trailing backslash (matched
161+
# literally, so 'esc\' pattern does not match 'esc' file) and void (slash
162+
# or negation character only, matching nothing) patterns, defined over
163+
# several modulepath-ignore calls in same rc file
162164
set mp4 $env(HOME)/mpign4
163165
file mkdir $mp4/app $mp4/lib/x $mp4/sub/doc $mp4/qux $mp4/quax $mp4/a/x/y\
164166
$mp4/mx
165167
set fid [open $mp4/.modulerc w]
166168
puts $fid "#%Module\nmodulepath-ignore **/doc lib/** {app/\[13\]*}\
167169
{\\!bang} qu?x\nmodulepath-ignore /root1* a/**/b {e\[!0-9\]f} m**n\
168-
{br\[ack} {sp\\*t}"
170+
{br\[ack} {sp\\*t}\nmodulepath-ignore / ! esc\\\\"
169171
close $fid
170172
foreach f [list app/1.0 app/2.0 app/3.0 lib/x/1.0 sub/doc/1.0 sub/1.0\
171173
qux/1.0 quax/1.0 !bang root1.0 sub/root1.5 a/b a/x/b a/x/y/b a/c exf\
172-
e5f mooon mx/n {br[ack} {sp*t} spot] {
174+
e5f mooon mx/n {br[ack} {sp*t} spot esc] {
173175
set fid [open $mp4/$f w]
174176
puts $fid $mfcontent
175177
close $fid
@@ -178,6 +180,7 @@ setenv_path_var MODULEPATH $mp4
178180
set tserr "a/c
179181
app/2.0
180182
e5f
183+
esc
181184
mx/n
182185
qux/1.0
183186
spot

‎testsuite/modules.30-cache/043-cache-use-limited-access.exp‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,17 @@ lappend ans_load1 [list set _LMFILES_ $mp1/bar/1.0]
152152
lappend ans_load1 [list set LOADEDMODULES bar/1.0]
153153
testouterr_cmd sh {load bar} $ans_load1 {}
154154

155+
# load two module specifications of same root in a single command: module
156+
# search of second specification walks down again the limited access
157+
# elements from cache and finds the 'bar/.version' rc file already
158+
# evaluated during the module search of first specification
159+
set ans_load1b [list]
160+
lappend ans_load1b [list set __MODULES_LMALTNAME\
161+
bar/1.0&bar/default&bar:bar/2.0&as|bar/latest]
162+
lappend ans_load1b [list set _LMFILES_ $mp1/bar/1.0:$mp1/bar/2.0]
163+
lappend ans_load1b [list set LOADEDMODULES bar/1.0:bar/2.0]
164+
testouterr_cmd sh {load bar bar/2.0} $ans_load1b {}
165+
155166
set tserr_load2 "$err_magic'$mp1/foo/.modulerc'\n$err_contact
156167
$err_magic'$mp1/foo/1.0'\n$err_contact"
157168
testouterr_cmd sh {load foo/1.0} ERR $tserr_load2

0 commit comments

Comments
 (0)