Skip to content

Commit 33ad74e

Browse files
committed
ts: use requirement modpath info to compute dependencies
1 parent f41e5aa commit 33ad74e

File tree

1 file changed

+29
-18
lines changed

1 file changed

+29
-18
lines changed

testsuite/modules.50-cmds/641-modulepath-loaded.exp

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,10 @@ setenv_loaded_module [list modulepath-opt/1] [list $mp/modulepath-opt/1]
7575
setenv_var __MODULES_LMPREREQ modulepath-opt/1&qux/1
7676
setenv_var __MODULES_LMPREREQPATH modulepath-opt/1&qux/1&$modpath.3
7777

78-
#FIXME: modulepath-opt/1 should not get reloaded as mp4/qux/1 is not a requirement
79-
set tserr [msg_load modulepath-opt/1 [err_prereq_path qux/1]]\n\n[msg_load qux/1 [err_depre modulepath-opt/1]]
80-
testouterr_cmd sh {load --auto qux/1} ERR $tserr
78+
set ans [list]
79+
lappend ans [list set _LMFILES_ $mp/modulepath-opt/1:$mp/qux/1]
80+
lappend ans [list set LOADEDMODULES modulepath-opt/1:qux/1]
81+
testouterr_cmd sh {load --auto qux/1} $ans {}
8182

8283

8384
#
@@ -109,22 +110,25 @@ setenv_loaded_module [list qux/1 modulepath-opt/1] [list $mp/qux/1 $mp/modulepat
109110
setenv_var __MODULES_LMPREREQ qux/1&qux/1|foo/1.0:modulepath-opt/1&qux/1
110111
setenv_var __MODULES_LMPREREQPATH modulepath-opt/1&qux/1&$modpath.3
111112

112-
#FIXME: modulepath-opt/1 should not get reloaded as mp4/qux/1 is not a requirement
113-
set tserr [msg_load modulepath-opt/1 [err_prereq_path qux/1]]\n\n[msg_load foo/1.0 [err_depre modulepath-opt/1]]
114-
testouterr_cmd sh {load --auto foo/1.0} ERR $tserr
113+
set ans [list]
114+
lappend ans [list set __MODULES_LMPREREQ modulepath-opt/1&qux/1:qux/1&qux/1|foo/1.0]
115+
lappend ans [list set _LMFILES_ $mp/modulepath-opt/1:$mp/foo/1.0:$mp/qux/1]
116+
lappend ans [list set LOADEDMODULES modulepath-opt/1:foo/1.0:qux/1]
117+
set tserr [msg_top_load foo/1.0 {} {} qux/1]
118+
testouterr_cmd sh {load --auto foo/1.0} $ans $tserr
115119

116120
setenv_var MODULEPATH $mp:$modpath.3
117-
#FIXME: modulepath-opt/1 should not get reloaded as mp4/qux/1 is not a requirement
118-
testouterr_cmd sh {load --auto foo/1.0} ERR $tserr
121+
testouterr_cmd sh {load --auto foo/1.0} $ans $tserr
119122

120-
# qux/1 is reloaded from mp3 as it is the priority enabled modulepath
123+
# FIXME: qux/1 is reloaded from mp3 as it is the priority enabled modulepath
124+
# it should be kept from its initial modulepath
125+
# or modulepath-opt/1 should get reloaded as modpath.3/qux/1 is dependency
121126
setenv_var MODULEPATH $modpath.3:$mp
122127
set ans [list]
123-
lappend ans [list set __MODULES_LMPREREQ qux/1&qux/1|foo/1.0:modulepath-opt/1&qux/1]
124-
lappend ans [list set _LMFILES_ $modpath.3/foo/1.0:$modpath.3/qux/1:$mp/modulepath-opt/1]
125-
lappend ans [list set LOADEDMODULES foo/1.0:qux/1:modulepath-opt/1]
126-
lappend ans [list set __MODULES_LMPREREQPATH modulepath-opt/1&qux/1&$modpath.3]
127-
set tserr [msg_top_load foo/1.0 {} {} {qux/1 modulepath-opt/1}]
128+
lappend ans [list set __MODULES_LMPREREQ modulepath-opt/1&qux/1:qux/1&qux/1|foo/1.0]
129+
lappend ans [list set _LMFILES_ $mp/modulepath-opt/1:$modpath.3/foo/1.0:$modpath.3/qux/1]
130+
lappend ans [list set LOADEDMODULES modulepath-opt/1:foo/1.0:qux/1]
131+
set tserr [msg_top_load foo/1.0 {} {} {qux/1}]
128132
testouterr_cmd sh {load --auto foo/1.0} $ans $tserr
129133
setenv_var MODULEPATH $mp
130134

@@ -134,13 +138,20 @@ setenv_loaded_module [list qux/1 modulepath-opt/1] [list $modpath.3/qux/1 $mp/mo
134138
setenv_var __MODULES_LMPREREQ qux/1&qux/1|foo/1.0:modulepath-opt/1&qux/1
135139
setenv_var __MODULES_LMPREREQPATH modulepath-opt/1&qux/1&$modpath.3
136140

137-
# qux/1 is reloaded from mp4 as it is the enabled modulepath
138-
set tserr [msg_load modulepath-opt/1 [err_reqmis_path qux/1]]\n\n[msg_load foo/1.0 [err_depre modulepath-opt/1]]
139-
testouterr_cmd sh {load --auto foo/1.0} ERR $tserr
141+
# FIXME: qux/1 is reloaded from mp4 as it is the enabled modulepath
142+
# it should be kept from its initial modulepath
143+
# or modulepath-opt/1 should not get reloaded as mp4/qux/1 is not a dependency
144+
set ans [list]
145+
lappend ans [list set __MODULES_LMPREREQ qux/1&qux/1|foo/1.0]
146+
lappend ans [list set _LMFILES_ $mp/foo/1.0:$mp/qux/1]
147+
lappend ans [list set LOADEDMODULES foo/1.0:qux/1]
148+
lappend ans [list unset __MODULES_LMPREREQPATH]
149+
set tserr [msg_top_load foo/1.0 {} {} {{modulepath-opt/1 qux/1} {qux/1}}]
150+
testouterr_cmd sh {load --auto foo/1.0} $ans $tserr
140151

141152
setenv_var MODULEPATH $mp:$modpath.3
142153
# qux/1 is reloaded from mp4 as it is the priority enabled modulepath
143-
testouterr_cmd sh {load --auto foo/1.0} ERR $tserr
154+
testouterr_cmd sh {load --auto foo/1.0} $ans $tserr
144155

145156
# qux/1 is reloaded from mp3 as it is the priority enabled modulepath
146157
setenv_var MODULEPATH $modpath.3:$mp

0 commit comments

Comments
 (0)