ts: add coll tests for --notuasked flag

This commit is contained in:
Xavier Delaruelle
2018-06-21 05:53:48 +02:00
parent 5e916a47b8
commit 03478024fe
6 changed files with 109 additions and 0 deletions

5
testsuite/home/coll10 Normal file
View File

@@ -0,0 +1,5 @@
module use --append testsuite/modulefiles
module load coll/c
module load --notuasked --notuasked coll/a
module load coll/b

5
testsuite/home/coll9 Normal file
View File

@@ -0,0 +1,5 @@
module use --append testsuite/modulefiles
module load coll/c
module load --notuasked coll/a
module load coll/b

View File

@@ -59,6 +59,12 @@ set coll7fpre "$homewithcollre/$coll7"
set coll8 "coll8"
set coll8f "coll8.$colltarget"
set coll8fp "$homewithcoll/$coll8"
set coll9 "coll9"
set coll9f "coll9.$colltarget"
set coll9fp "$homewithcoll/$coll9"
set coll10 "coll10"
set coll10f "coll10.$colltarget"
set coll10fp "$homewithcoll/$coll10"
set cdmodpath1 "$modpath"
set cdmodpath1re "$modpathre"
@@ -109,6 +115,10 @@ set c8modpath1 $modpath
set c8mod1 $c7mod1
set c8mod2 $c7mod2
set c8mod3 $c7mod3
set c9modpath1 $modpath
set c9mod1 $c2mod4
set c9mod2 $c2mod5
set c9mod3 $c2mod6
set cdlmf "$cdmodpath1/$cdmod1:$cdmodpath1/$cdmod2:$cdmodpath1/$cdmod3:$cdmodpath1/$cdmod4:$cdmodpath1/$cdmod5"
set cdlm "$cdmod1:$cdmod2:$cdmod3:$cdmod4:$cdmod5"
@@ -132,6 +142,10 @@ set c7lm "$c7mod1:$c7mod2:$c7mod3"
set c8modpath "$c8modpath1"
set c8lmf $c7lmf
set c8lm $c7lm
set c9modpath "$c9modpath1"
set c9lmf "$c9modpath1/$c9mod1:$c9modpath1/$c9mod2:$c9modpath1/$c9mod3"
set c9lm "$c9mod1:$c9mod2:$c9mod3"
set c9lmnua "$c9mod2"
set mlu "module use --append"
set mll "module load"
@@ -148,4 +162,5 @@ set c6cont "$mlu $c6modpath1\n$mlu $c6modpath2\n$mlu $c6modpath3\n$mll $c6mod1n\
set c7cont "$mll $c7mod1\n$mll $c7mod2\n$mll $c7mod3\n"
set c7contre "$mll $c7mod1rel\n$mll $c7mod2rel\n$mll $c7mod3rel\n"
set c8cont "$mlu $c8modpath1\n$mll $c8mod1\n$mll $c8mod2\n$mll $c8mod3\n"
set c9cont "$mlu $c9modpath1\n$mll $c9mod1\n$mll --notuasked $c9mod2\n$mll $c9mod3\n"

View File

@@ -207,6 +207,18 @@ setenv_loaded_module [split $c8lm ":"] [split $c8lmf ":"]
testoutfile_cmd "sh" "save $coll8" "OK" "$hometestdotmod/$coll8f" "$c8cont"
#
# test saving collection with some modulefiles loaded not asked by user
#
# setup environment state
eval setenv_path_var MODULEPATH [split $c9modpath ":"]
setenv_loaded_module [split $c9lm ":"] [split $c9lmf ":"] [split $c9lmnua ":"]
# test only sh shell as this test does not produce shell output
testoutfile_cmd "sh" "save $coll9" "OK" "$hometestdotmod/$coll9f" "$c9cont"
#
# test unsetting HOME
#

View File

@@ -31,6 +31,8 @@ set c3errmsg ""
set c4errmsg "unload $c2mod6\nunload $c2mod5\nunload $c2mod4"
set badcontfp "$homewithcoll/.Xresources"
set badcontfperrmsg "$error_msgs: $badcontfp is not a valid collection"
set c9errmsg "load $c9mod1\nload $c9mod2\nload $c9mod3"
set c9errmsg2 "unload $c9mod3\nunload $c9mod2\nload $c9mod2\nload $c9mod3"
# set HOME to location containing collections
@@ -285,6 +287,59 @@ lappend ans [list setpath MODULEPATH $c8modpath]
testouterr_cmd_re "sh" "restore $coll8fp" $ans ""
#
# test restoring collection with some modulefiles loaded not asked by user
#
set ans [list]
lappend ans [list setpath LOADEDMODULES $c9lm]
lappend ans [list setpath _LMFILES_ $c9lmf]
lappend ans [list setpath MODULEPATH $c9modpath]
lappend ans [list setpath MODULES_LMNOTUASKED $c9lmnua]
testouterr_cmd_re "sh" "restore $coll9fp" $ans $c9errmsg
#
# test restoring collection with some modulefiles loaded not asked by user
#
set ans [list]
lappend ans [list setpath LOADEDMODULES $c9lm]
lappend ans [list setpath _LMFILES_ $c9lmf]
lappend ans [list setpath MODULEPATH $c9modpath]
lappend ans [list setpath MODULES_LMNOTUASKED $c9lmnua]
testouterr_cmd_re "sh" "restore $coll10fp" $ans $c9errmsg
#
# test restoring collection with some modulefiles loaded not asked by user
# from a situation where all modulefiles where loaded asked by user
#
eval setenv_path_var MODULEPATH [split $c9modpath ":"]
setenv_loaded_module [split $c9lm ":"] [split $c9lmf ":"]
set ans [list]
lappend ans [list setpath LOADEDMODULES $c9lm]
lappend ans [list setpath _LMFILES_ $c9lmf]
lappend ans [list setpath MODULES_LMNOTUASKED $c9lmnua]
testouterr_cmd_re "sh" "restore $coll9fp" $ans $c9errmsg2
#
# test restoring collection with some modulefiles loaded not asked by user
# from a situation where not user asked information is already correct
#
eval setenv_path_var MODULEPATH [split $c9modpath ":"]
setenv_loaded_module [split $c9lm ":"] [split $c9lmf ":"] [split $c9lmnua ":"]
testouterr_cmd_re "sh" "restore $coll9fp" "" ""
#
# test restoring nonexistent default collection when
# MODULES_COLLECTION_TARGET is set
@@ -345,6 +400,8 @@ unset c2errmsg
unset c1errmsgf2
unset c3errmsg
unset c4errmsg
unset c9errmsg
unset c9errmsg2
unset badcontfp
unset badcontfperrmsg

View File

@@ -57,6 +57,7 @@ unset c6cont
unset c7cont
unset c7contre
unset c8cont
unset c9cont
unset cdlmf
unset cdlm
@@ -80,7 +81,15 @@ unset c7modpath
unset c8lmf
unset c8lm
unset c8modpath
unset c9lmf
unset c9lm
unset c9lmnua
unset c9modpath
unset c9mod3
unset c9mod2
unset c9mod1
unset c9modpath1
unset c8mod3
unset c8mod2
unset c8mod1
@@ -146,6 +155,12 @@ unset coll7fpre
unset coll8
unset coll8f
unset coll8fp
unset coll9
unset coll9f
unset coll9fp
unset coll10
unset coll10f
unset coll10fp
unset nohomeerrmsg