Skip to content

Commit

Permalink
testsuite: check MODULES_COLLECTION_PIN_VERSION
Browse files Browse the repository at this point in the history
  • Loading branch information
xdelaruelle committed Dec 12, 2017
1 parent 9dcc701 commit a789b35
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 9 deletions.
3 changes: 2 additions & 1 deletion testsuite/home/.module/default
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module use testsuite/modulefiles
module load loc_rc1/1.0
module load load/15
module load verssort
module load verssort/1.10
module load coll/a
module load loc_dv2/1.0

4 changes: 4 additions & 0 deletions testsuite/modules.00-init/010-environ.exp
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,9 @@ catch {unset env(LESS)}
catch {unset env(PAGER)}
catch {unset env(MODULES_PAGER)}

# clean any collection configuration
catch {unset env(MODULES_COLLECTION_PIN_VERSION)}
catch {unset env(MODULES_COLLECTION_TARGET)}

set env(MODULERCFILE) "$env(TESTSUITEDIR)/etc/empty"
catch {unset env(MODULESHOME)}
14 changes: 10 additions & 4 deletions testsuite/modules.61-coll/010-init_ts.exp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ set cdmod3n "verssort"
# this modulefile is default version for module $cdmod3n
set cdmod3 "$cdmod3n/1.10"
set cdmod4 "coll/a"
set cdmod5 "loc_dv2/1.0"
set cdmod5n "loc_dv2"
set c1modpath1 "$modpath"
set c1modpath1re "$modpathre"
set c1modpath2 "$modpath.other"
Expand All @@ -72,8 +74,10 @@ set c4modpath1re "$modpathre"
set c4modpath2 "$modpath.other"
set c4modpath2re "$modpathre.other"

set cdlmf "$cdmodpath1/$cdmod1:$cdmodpath1/$cdmod2:$cdmodpath1/$cdmod3:$cdmodpath1/$cdmod4"
set cdlm "$cdmod1:$cdmod2:$cdmod3:$cdmod4"
set cdlmf "$cdmodpath1/$cdmod1:$cdmodpath1/$cdmod2:$cdmodpath1/$cdmod3:$cdmodpath1/$cdmod4:$cdmodpath1/$cdmod5"
set cdlm "$cdmod1:$cdmod2:$cdmod3:$cdmod4:$cdmod5"
set cdlmf_part "$cdmodpath1/$cdmod1:$cdmodpath1/$cdmod2:$cdmodpath1/$cdmod3:$cdmodpath1/$cdmod4:$cdmodpath1/$cdmod5n/2.0"
set cdlm_part "$cdmod1:$cdmod2:$cdmod3:$cdmod4:$cdmod5n/2.0"
set cdmodpath "$cdmodpath1"
set c1lmf "$c1modpath1/$cdmod1:$c1modpath1/$cdmod2:$c1modpath1/$cdmod3:$c1modpath1/$cdmod4:$c1modpath1/$c1mod5:$c1modpath1/$c1mod6"
set c1lm "$cdmod1:$cdmod2:$cdmod3:$cdmod4:$c1mod5:$c1mod6"
Expand All @@ -86,8 +90,10 @@ set c4modpath "$c4modpath1:$c4modpath2"

set mlu "module use --append"
set mll "module load"
set cdcont "$mlu $cdmodpath1\n$mll $cdmod1\n$mll $cdmod2\n$mll $cdmod3n\n$mll $cdmod4\n"
set cdcontre "$mlu $cdmodpath1re\n$mll $cdmod1\n$mll $cdmod2\n$mll $cdmod3n\n$mll $cdmod4\n"
set cdcont "$mlu $cdmodpath1\n$mll $cdmod1\n$mll $cdmod2\n$mll $cdmod3n\n$mll $cdmod4\n$mll $cdmod5n\n"
set cdcontre "$mlu $cdmodpath1re\n$mll $cdmod1\n$mll $cdmod2\n$mll $cdmod3n\n$mll $cdmod4\n$mll $cdmod5n\n"
set cdcontpin "$mlu $cdmodpath1\n$mll $cdmod1\n$mll $cdmod2\n$mll $cdmod3\n$mll $cdmod4\n$mll $cdmod5\n"
set cdcontrepin "$mlu $cdmodpath1re\n$mll $cdmod1\n$mll $cdmod2\n$mll $cdmod3\n$mll $cdmod4\n$mll $cdmod5\n"
set c1cont1 "$mlu $c1modpath1\n$mlu $c1modpath2\n$mll $cdmod1\n$mll $cdmod2\n$mll $cdmod3n\n$mll $cdmod4\n$mll $c1mod5\n$mll $c1mod6\n"
set c1cont1re "$mlu $c1modpath1re\n$mlu $c1modpath2re\n$mll $cdmod1\n$mll $cdmod2\n$mll $cdmod3n\n$mll $cdmod4\n$mll $c1mod5\n$mll $c1mod6\n"
set c1cont2 "$mlu $c2modpath1\n$mlu $c1modpath2\n$mll $cdmod1\n$mll $cdmod2\n$mll $cdmod3n\n$mll $c2mod4\n$mll $c2mod5\n$mll $c2mod6\n"
Expand Down
14 changes: 13 additions & 1 deletion testsuite/modules.61-coll/030-save.exp
Original file line number Diff line number Diff line change
Expand Up @@ -76,21 +76,31 @@ testouterr_cmd "ALL" "save" "ERR" "$emptyenverrmsg"

#
# test saving default collection
# with module version pinned or not
#

# setup environment state
if { $verbose > 0 } {
send_user "\tSetup _LMFILES_ = $cdlmf\n"
send_user "\tSetup LOADEDMODULES = $cdlm\n"
send_user "\tSetup MODULEPATH = $cdmodpath\n"
send_user "\tSetup MODULES_COLLECTION_PIN_VERSION = 0\n"
}
set env(_LMFILES_) "$cdlmf"
set env(LOADEDMODULES) "$cdlm"
set env(MODULEPATH) "$cdmodpath"
set env(MODULES_COLLECTION_PIN_VERSION) "0"

# test only sh shell as this test does not produce shell output
testoutfile_cmd "sh" "save" "OK" "$hometestdotmod/default" "$cdcont"

# now test save with module version pinning enabled
if { $verbose > 0 } {
send_user "\tSetup MODULES_COLLECTION_PIN_VERSION = 1\n"
}
set env(MODULES_COLLECTION_PIN_VERSION) "1"
testoutfile_cmd "sh" "save" "OK" "$hometestdotmod/default" "$cdcontpin"


#
# test saving named collection
Expand All @@ -101,10 +111,12 @@ if { $verbose > 0 } {
send_user "\tSetup _LMFILES_ = $c1lmf\n"
send_user "\tSetup LOADEDMODULES = $c1lm\n"
send_user "\tSetup MODULEPATH = $c1modpath\n"
send_user "\tUnset MODULES_COLLECTION_PIN_VERSION\n"
}
set env(_LMFILES_) "$c1lmf"
set env(LOADEDMODULES) "$c1lm"
set env(MODULEPATH) "$c1modpath"
unset env(MODULES_COLLECTION_PIN_VERSION)

# test only sh shell as this test does not produce shell output
testoutfile_cmd "sh" "save $coll1" "OK" "$hometestdotmod/$coll1" "$c1cont1"
Expand Down Expand Up @@ -185,7 +197,7 @@ unset ORIG_HOME
# _LMFILES_ and LOADEDMODULES already restored during last test
if { $verbose > 0 } {
send_user "\tRestore MODULEPATH = $modpath\n"
send_user "\tRestore MODULES_COLLECTION_TARGET = ''\n"
send_user "\tUnset MODULES_COLLECTION_TARGET\n"
}
set env(MODULEPATH) $modpath
unset env(MODULES_COLLECTION_TARGET)
Expand Down
23 changes: 21 additions & 2 deletions testsuite/modules.61-coll/040-restore.exp
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,27 @@ lappend ans [list set MODULEPATH $cdmodpath]
testouterr_cmd_re "ALL" "restore" $ans "$cderrmsg"


#
# test restoring default collection saved with version pinned and with parts
# of this environment already loaded (default version comparison)
#

if { $verbose > 0 } {
send_user "\tSetup _LMFILES_ = $cdlmf_part\n"
send_user "\tSetup LOADEDMODULES = $cdlm_part\n"
send_user "\tSetup MODULEPATH = $cdmodpath\n"
}
set env(_LMFILES_) $cdlmf_part
set env(LOADEDMODULES) $cdlm_part
set env(MODULEPATH) "$cdmodpath"

set ans [list]
lappend ans [list setpath LOADEDMODULES $cdlm]
lappend ans [list setpath _LMFILES_ $cdlmf]

testouterr_cmd_re "sh" "restore" $ans ""


#
# test restoring collection that only adds path to use and mods to load
#
Expand All @@ -94,11 +115,9 @@ testouterr_cmd_re "ALL" "restore" $ans "$cderrmsg"
if { $verbose > 0 } {
send_user "\tSetup _LMFILES_ = $cdlmf\n"
send_user "\tSetup LOADEDMODULES = $cdlm\n"
send_user "\tSetup MODULEPATH = $cdmodpath\n"
}
set env(_LMFILES_) "$cdlmf"
set env(LOADEDMODULES) "$cdlm"
set env(MODULEPATH) "$cdmodpath"

set ans [list]
lappend ans [list setpath MODULEPATH $c1modpath]
Expand Down
2 changes: 1 addition & 1 deletion testsuite/modules.61-coll/060-saveshow.exp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ testouterr_cmd "ALL" "saveshow $badcontfp" "ERR" "$badcontfperrmsg"
#

# test only sh shell as this test does not produce shell output
testouterr_cmd_re "sh" "saveshow" "OK" "$modlin\n$homewithcolldotmodre/$colld:\n\n$cdcontre\n$modlin$"
testouterr_cmd_re "sh" "saveshow" "OK" "$modlin\n$homewithcolldotmodre/$colld:\n\n$cdcontrepin\n$modlin$"


#
Expand Down
6 changes: 6 additions & 0 deletions testsuite/modules.61-coll/999-cleanup.exp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ unset mlu
unset mll
unset cdcont
unset cdcontre
unset cdcontpin
unset cdcontrepin
unset c1cont1
unset c1cont1re
unset c1cont2
Expand All @@ -55,6 +57,8 @@ unset c4contre
unset cdlmf
unset cdlm
unset cdmodpath
unset cdlmf_part
unset cdlm_part
unset c1lmf
unset c1lm
unset c1modpath
Expand All @@ -77,6 +81,8 @@ unset c1mod6
unset c1mod5
unset c1modpath2
unset c1modpath1
unset cdmod5
unset cdmod5n
unset cdmod4
unset cdmod3
unset cdmod3n
Expand Down

0 comments on commit a789b35

Please sign in to comment.