1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400
|
##############################################################################
# Modules Revision 3.0
# Providing a flexible user environment
#
# File: modules.50-cmds/%M%
# Revision: %I%
# First Edition: 2019/02/01
# Last Mod.: %U%, %G%
#
# Authors: Xavier Delaruelle, xavier.delaruelle@cea.fr
#
# Description: Testuite testsequence
# Command: load, unload
# Modulefiles:
# Sub-Command: prereq, conflict
#
# Comment: %C{
# Test automatic resolution of modulefile dependencies when
# some constraints have been forced previously
# }C%
#
##############################################################################
# enable auto_handling with environment variable
setenv_var MODULES_AUTO_HANDLING 1
# ensure auto symbolic versions are not set for these tests
setenv_var MODULES_ADVANCED_VERSION_SPEC 0
set mp $modpath.deps
# setup specific environment
setenv_path_var MODULEPATH $mp
# requirement is found after its dependent
# 1. load --force --no-auto ib
# 2. load --no-auto ia
setenv_loaded_module [list ib ia] [list $mp/ib $mp/ia]
setenv_var __MODULES_LMPREREQ ib&ia
# ib should not be impacted
set ans [list]
lappend ans [list set _LMFILES_ $mp/ib]
lappend ans [list set LOADEDMODULES ib]
set tserr [list {unload ia}]
testouterr_cmd_re sh {unload --no-auto ia} $ans [join $tserr \n]
testouterr_cmd_re sh {unload --auto ia} $ans [join $tserr \n]
# ia should not be impacted
set ans [list]
lappend ans [list unset __MODULES_LMPREREQ]
lappend ans [list set _LMFILES_ $mp/ia]
lappend ans [list set LOADEDMODULES ia]
set tserr [list {unload ib}]
testouterr_cmd_re sh {unload --no-auto ib} $ans [join $tserr \n]
testouterr_cmd_re sh {unload --auto ib} $ans [join $tserr \n]
skip_if_quick_mode
# requirement is found after its dependent
# requirement expressed with 'module load' rather 'prereq'
# 1. load --force --no-auto ibm
# 2. load --no-auto ia
setenv_loaded_module [list ibm ia] [list $mp/ibm $mp/ia]
setenv_var __MODULES_LMPREREQ ibm&ia
# ibm should not be impacted
set ans [list]
lappend ans [list set _LMFILES_ $mp/ibm]
lappend ans [list set LOADEDMODULES ibm]
set tserr [list {unload ia}]
testouterr_cmd_re sh {unload --no-auto ia} $ans [join $tserr \n]
testouterr_cmd_re sh {unload --auto ia} $ans [join $tserr \n]
# ia should not be impacted
set ans [list]
lappend ans [list unset __MODULES_LMPREREQ]
lappend ans [list set _LMFILES_ $mp/ia]
lappend ans [list set LOADEDMODULES ia]
set tserr [list {unload ibm}]
testouterr_cmd_re sh {unload --no-auto ibm} $ans [join $tserr \n]
testouterr_cmd_re sh {unload --auto ibm} $ans [join $tserr \n]
# requirement is found after its dependent, one dummy module loaded before
# requirement expressed with 'module load' rather 'prereq'
# 1. load ih/2
# 1. load --force --no-auto ibm
# 2. load --no-auto ia
setenv_loaded_module [list aa ibm ia] [list $mp/aa $mp/ibm $mp/ia]
setenv_var __MODULES_LMPREREQ ibm&ia
# ia should not be impacted
set ans [list]
lappend ans [list unset __MODULES_LMPREREQ]
lappend ans [list set _LMFILES_ $mp/aa:$mp/ia]
lappend ans [list set LOADEDMODULES aa:ia]
set tserr [list {unload ibm}]
testouterr_cmd_re sh {unload --no-auto ibm} $ans [join $tserr \n]
testouterr_cmd_re sh {unload --auto ibm} $ans [join $tserr \n]
# requirement is found after its dependent and in autoloaded state
# 1. load --force --no-auto ib
# 2. load --force ie
# 3. load --auto ic
# 4. unload --no-auto ie
# 5. unload --no-auto ic
setenv_loaded_module [list ib ia] [list $mp/ib $mp/ia] [list ia]
setenv_var __MODULES_LMPREREQ ib&ia
# ib should not be impacted
set ans [list]
lappend ans [list set _LMFILES_ $mp/ib]
lappend ans [list set LOADEDMODULES ib]
lappend ans [list unset __MODULES_LMTAG]
set tserr [list {unload ia}]
testouterr_cmd_re sh {unload --no-auto ia} $ans [join $tserr \n]
testouterr_cmd_re sh {unload --auto ia} $ans [join $tserr \n]
# ia should not be impacted
set ans [list]
lappend ans [list unset __MODULES_LMPREREQ]
lappend ans [list set _LMFILES_ $mp/ia]
lappend ans [list set LOADEDMODULES ia]
set tserr [list {unload ib}]
testouterr_cmd_re sh {unload --no-auto ib} $ans [join $tserr \n]
testouterr_cmd_re sh {unload --auto ib} $ans [join $tserr \n]
# requirement is found after its dependent and in autoloaded state
# 1. load --force --no-auto ib
# 2. load --force ie
# 3. load --auto ic
# 4. unload --no-auto ie
setenv_loaded_module [list ib ia ic] [list $mp/ib $mp/ia $mp/ic] [list ia]
setenv_var __MODULES_LMPREREQ ib&ia:ic&ia
# ia should go UReqUn
set ans [list]
lappend ans [list set __MODULES_LMPREREQ ib&ia]
lappend ans [list set _LMFILES_ $mp/ib]
lappend ans [list set LOADEDMODULES ib]
lappend ans [list unset __MODULES_LMTAG]
set tserr [list {unload ic} {unload ia} \n[msg_top_unload ic {} ia {}]]
testouterr_cmd_re sh {unload --auto ic} $ans [join $tserr \n]
# ic should go DepUn (not ib)
set ans [list]
lappend ans [list set __MODULES_LMPREREQ ib&ia]
lappend ans [list set _LMFILES_ $mp/ib]
lappend ans [list set LOADEDMODULES ib]
lappend ans [list unset __MODULES_LMTAG]
set tserr [list [msg_unload {ia <aL>} [err_prerequn ic]]]
testouterr_cmd_re sh {unload --no-auto ia} ERR [join $tserr \n]
set tserr [list {unload ic} {unload ia} \n[msg_top_unload {ia <aL>} ic {} {}]]
testouterr_cmd_re sh {unload --auto ia} $ans [join $tserr \n]
# requirement is found after its dependent and in autoloaded state
# 1. load --force --auto ij
# 2. unload --force --no-auto ia
# 3. unload --no-auto ij
# 4. load --force ie
# 5. load --force ia
# 6. load --auto ij
setenv_loaded_module [list ib ia ij] [list $mp/ib $mp/ia $mp/ij] [list ib]
setenv_var __MODULES_LMPREREQ ib&ia:ij&ib
# ib should go UReqUn, not ia
set ans [list]
lappend ans [list unset __MODULES_LMPREREQ]
lappend ans [list set _LMFILES_ $mp/ia]
lappend ans [list set LOADEDMODULES ia]
lappend ans [list unset __MODULES_LMTAG]
set tserr [list {unload ij} {unload ib} \n[msg_top_unload ij {} ib {}]]
testouterr_cmd_re sh {unload --auto ij} $ans [join $tserr \n]
# ib should not be impacted
set ans [list]
lappend ans [list set _LMFILES_ $mp/ib:$mp/ij]
lappend ans [list set LOADEDMODULES ib:ij]
set tserr [list {unload ia}]
testouterr_cmd_re sh {unload --no-auto ia} $ans [join $tserr \n]
testouterr_cmd_re sh {unload --auto ia} $ans [join $tserr \n]
# requirement is found after its dependent and in autoloaded state
# 1. load --force --auto ij
# 2. unload --force --no-auto ia
# 3. unload --no-auto ij
# 4. load --force ie
# 5. load --force --auto ic
# 6. unload --no-auto ic
# 7. load --auto ij
setenv_loaded_module [list ib ia ij] [list $mp/ib $mp/ia $mp/ij] [list ib ia]
setenv_var __MODULES_LMPREREQ ib&ia:ij&ib
# ib should go UReqUn, not ia
set ans [list]
lappend ans [list unset __MODULES_LMPREREQ]
lappend ans [list set _LMFILES_ $mp/ia]
lappend ans [list set LOADEDMODULES ia]
lappend ans [list set __MODULES_LMTAG ia&auto-loaded]
set tserr [list {unload ij} {unload ib} \n[msg_top_unload ij {} ib {}]]
testouterr_cmd_re sh {unload --auto ij} $ans [join $tserr \n]
# ib should not be impacted
set ans [list]
lappend ans [list set _LMFILES_ $mp/ib:$mp/ij]
lappend ans [list set LOADEDMODULES ib:ij]
lappend ans [list set __MODULES_LMTAG ib&auto-loaded]
set tserr [list {unload ia}]
testouterr_cmd_re sh {unload --no-auto ia} $ans [join $tserr \n]
testouterr_cmd_re sh {unload --auto ia} $ans [join $tserr \n]
# one requirement found before and the other found after its dependent in autoloaded state
# 1. load --force --auto if
# 2. unload --force --no-auto ia
# 2. load --force ie
# 3. load --auto ic
# 4. unload --no-auto ie
# 5. unload --no-auto ic
setenv_loaded_module [list ib if ia] [list $mp/ib $mp/if $mp/ia] [list ib ia]
setenv_var __MODULES_LMPREREQ ib&ia:if&ib&ia
# ib and if should not be impacted
set ans [list]
lappend ans [list set _LMFILES_ $mp/ib:$mp/if]
lappend ans [list set LOADEDMODULES ib:if]
lappend ans [list set __MODULES_LMTAG ib&auto-loaded]
set tserr [list {unload ia}]
testouterr_cmd_re sh {unload --no-auto ia} $ans [join $tserr \n]
testouterr_cmd_re sh {unload --auto ia} $ans [join $tserr \n]
# ia should not be impacted
set ans [list]
lappend ans [list unset __MODULES_LMPREREQ]
lappend ans [list set _LMFILES_ $mp/ia]
lappend ans [list set LOADEDMODULES ia]
lappend ans [list set __MODULES_LMTAG ia&auto-loaded]
set tserr [list {unload if} {unload ib} \n[msg_top_unload if {} ib {}]]
testouterr_cmd_re sh {unload --auto if} $ans [join $tserr \n]
# one reflexive conflict loaded after sane situation
# 1. load --auto ii
# 2. load --force ih/1
setenv_loaded_module [list ih/2 ii ih/1] [list $mp/ih/2 $mp/ii $mp/ih/1] [list ih/2]
setenv_var __MODULES_LMPREREQ ii&ih
setenv_var __MODULES_LMCONFLICT ih/2&ih:ih/1&ih
# ih/2 and ii should go DepRe due to conflict solve (auto mode)
set ans [list]
lappend ans [list set __MODULES_LMCONFLICT ih/2&ih]
lappend ans [list set _LMFILES_ $mp/ih/2:$mp/ii]
lappend ans [list set LOADEDMODULES ih/2:ii]
set tserr [list {unload ih/1}]
testouterr_cmd_re sh {unload --no-auto ih/1} $ans [join $tserr \n]
set ans [list]
lappend ans [list set __MODULES_LMCONFLICT ih/2&ih]
lappend ans [list set __MODULES_LMPREREQ ii&ih]
lappend ans [list set _LMFILES_ $mp/ih/2:$mp/ii]
lappend ans [list set LOADEDMODULES ih/2:ii]
lappend ans [list set __MODULES_LMTAG ih/2&auto-loaded]
set tserr [list {unload ii} {unload ih/2} {unload ih/1} {load ih/2} {load ii} \n[msg_top_unload ih/1 {} {} [list ih/2 ii]]]
testouterr_cmd_re sh {unload --auto ih/1} $ans [join $tserr \n]
# ih/1 and ii should go DepRe
set tserr [list [msg_unload {ih/2 <aL>} [err_prerequn ii]]]
testouterr_cmd_re sh {unload --no-auto ih/2} ERR [join $tserr \n]
set ans [list]
lappend ans [list set __MODULES_LMCONFLICT ih/1&ih]
lappend ans [list set __MODULES_LMPREREQ ii&ih]
lappend ans [list set _LMFILES_ $mp/ih/1:$mp/ii]
lappend ans [list set LOADEDMODULES ih/1:ii]
lappend ans [list unset __MODULES_LMTAG]
set tserr [list {unload ih/1} {unload ii} {unload ih/2} {load ih/1} {load ii} \n[msg_top_unload {ih/2 <aL>} {ih/1 ii} {} {{} {ih/1 ii}}]]
testouterr_cmd_re sh {unload --auto ih/2} $ans [join $tserr \n]
# ih/2 should go UReqUn and ih/1 DepRe (auto mode)
set ans [list]
lappend ans [list unset __MODULES_LMPREREQ]
lappend ans [list set _LMFILES_ $mp/ih/2:$mp/ih/1]
lappend ans [list set LOADEDMODULES ih/2:ih/1]
set tserr [list {unload ii}]
testouterr_cmd_re sh {unload --no-auto ii} $ans [join $tserr \n]
set ans [list]
lappend ans [list set __MODULES_LMCONFLICT ih/1&ih]
lappend ans [list unset __MODULES_LMPREREQ]
lappend ans [list set _LMFILES_ $mp/ih/1]
lappend ans [list set LOADEDMODULES ih/1]
lappend ans [list unset __MODULES_LMTAG]
set tserr [list {unload ii} {unload ih/1} {unload ih/2} {load ih/1} \n[msg_top_unload ii {} ih/2 ih/1]]
testouterr_cmd_re sh {unload --auto ii} $ans [join $tserr \n]
# one reflexive conflict loaded after sane situation
# requirement expressed with 'module load' rather 'prereq'
# 1. load --auto iim
# 2. load --force ih/1
setenv_loaded_module [list ih/2 iim ih/1] [list $mp/ih/2 $mp/iim $mp/ih/1] [list ih/2]
setenv_var __MODULES_LMPREREQ iim&ih
setenv_var __MODULES_LMCONFLICT ih/2&ih:ih/1&ih
# ih/2 should go UReqUn (no-auto mode)
set ans [list]
lappend ans [list set __MODULES_LMCONFLICT ih/1&ih]
lappend ans [list unset __MODULES_LMPREREQ]
lappend ans [list set _LMFILES_ $mp/ih/1]
lappend ans [list set LOADEDMODULES ih/1]
lappend ans [list unset __MODULES_LMTAG]
set tserr [list {unload iim} {unload ih/2} \n[msg_top_unload iim {} ih/2 {}]]
testouterr_cmd_re sh {unload --no-auto iim} $ans [join $tserr \n]
# ih/2 should go UReqUn and ih/1 DepRe (auto mode)
set ans [list]
lappend ans [list set __MODULES_LMCONFLICT ih/1&ih]
lappend ans [list unset __MODULES_LMPREREQ]
lappend ans [list set _LMFILES_ $mp/ih/1]
lappend ans [list set LOADEDMODULES ih/1]
lappend ans [list unset __MODULES_LMTAG]
set tserr [list {unload iim} {unload ih/1} {unload ih/2} {load ih/1} \n[msg_top_unload iim {} ih/2 ih/1]]
testouterr_cmd_re sh {unload --auto iim} $ans [join $tserr \n]
# one reflexive conflict loaded after sane situation, one reflexive conflict load not uasked in first position
# requirement expressed with 'module load' rather 'prereq'
setenv_loaded_module [list ih/0 ih/2 iim ih/1] [list $mp/ih/0 $mp/ih/2 $mp/iim $mp/ih/1] [list ih/0 ih/2]
setenv_var __MODULES_LMPREREQ iim&ih
setenv_var __MODULES_LMCONFLICT ih/0&ih:ih/2&ih:ih/1&ih
# ih/2 should go UReqUn (closest requirement to unloading module)
if {$install_unloadmatchorder eq {returnlast}} {
set ans [list]
lappend ans [list set __MODULES_LMCONFLICT ih/0&ih:ih/1&ih]
lappend ans [list unset __MODULES_LMPREREQ]
lappend ans [list set _LMFILES_ $mp/ih/0:$mp/ih/1]
lappend ans [list set LOADEDMODULES ih/0:ih/1]
lappend ans [list set __MODULES_LMTAG ih/0&auto-loaded]
set tserr [list {unload iim} {unload ih/2} \n[msg_top_unload iim {} ih/2 {}]]
} else {
set ans [list]
lappend ans [list set __MODULES_LMCONFLICT ih/2&ih:ih/1&ih]
lappend ans [list unset __MODULES_LMPREREQ]
lappend ans [list set _LMFILES_ $mp/ih/2:$mp/ih/1]
lappend ans [list set LOADEDMODULES ih/2:ih/1]
lappend ans [list set __MODULES_LMTAG ih/2&auto-loaded]
set tserr [list {unload iim} {unload ih/0} \n[msg_top_unload iim {} ih/0 {}]]
}
testouterr_cmd_re sh {unload --no-auto iim} $ans [join $tserr \n]
testouterr_cmd_re sh {unload --auto iim} $ans [join $tserr \n]
# one conflict prior and one reflexive conflict after
# 1. load ig
# 2. load --auto --force ii
# 3. load --force ih/1
setenv_loaded_module [list ig ih/2 ii ih/1] [list $mp/ig $mp/ih/2 $mp/ii $mp/ih/1] [list ih/2]
setenv_var __MODULES_LMPREREQ ii&ih
setenv_var __MODULES_LMCONFLICT ig&ih/2:ih/2&ih:ih/1&ih
# cannot reload ih/2 after ig conflict solved since a conflict with ih/1 is still there
set ans [list]
lappend ans [list set __MODULES_LMCONFLICT ih/2&ih:ih/1&ih]
lappend ans [list set _LMFILES_ $mp/ih/2:$mp/ii:$mp/ih/1]
lappend ans [list set LOADEDMODULES ih/2:ii:ih/1]
set tserr [list {unload ig}]
testouterr_cmd_re sh {unload --auto ig} $ans [join $tserr \n]
# ig, ii and ih/1 should go DepRe (auto mode)
set tserr [list [msg_unload {ih/2 <aL>} [err_prerequn ii]]]
testouterr_cmd_re sh {unload --no-auto ih/2} ERR [join $tserr \n]
set ans [list]
lappend ans [list set __MODULES_LMCONFLICT ig&ih/2:ih/1&ih]
lappend ans [list set __MODULES_LMPREREQ ii&ih]
lappend ans [list set _LMFILES_ $mp/ig:$mp/ih/1:$mp/ii]
lappend ans [list set LOADEDMODULES ig:ih/1:ii]
lappend ans [list unset __MODULES_LMTAG]
set tserr [list {unload ih/1} {unload ii} {unload ig} {unload ih/2} {load ig} {load ih/1} {load ii} \n[msg_top_unload {ih/2 <aL>} {ih/1 ii ig} {} {{} {ig ih/1 ii}}]]
testouterr_cmd_re sh {unload --auto ih/2} $ans [join $tserr \n]
# ih/2 and ii should go DepRe as conflict with ih/1 is solved
# cannot reload ih/2 after ih/1 conflict solved since a conflict with ig is still there
set ans [list]
lappend ans [list set __MODULES_LMCONFLICT ig&ih/2:ih/2&ih]
lappend ans [list set _LMFILES_ $mp/ig:$mp/ih/2:$mp/ii]
lappend ans [list set LOADEDMODULES ig:ih/2:ii]
set tserr [list {unload ih/1}]
testouterr_cmd_re sh {unload --no-auto ih/1} $ans [join $tserr \n]
testouterr_cmd_re sh {unload --auto ih/1} $ans [join $tserr \n]
#
# Cleanup
#
reset_test_env
|