From 03478024fef5ea6abb684db59989b3feb6649ca3 Mon Sep 17 00:00:00 2001 From: Xavier Delaruelle Date: Thu, 21 Jun 2018 05:53:48 +0200 Subject: [PATCH] ts: add coll tests for --notuasked flag --- testsuite/home/coll10 | 5 ++ testsuite/home/coll9 | 5 ++ testsuite/modules.61-coll/010-init_ts.exp | 15 ++++++ testsuite/modules.61-coll/030-save.exp | 12 +++++ testsuite/modules.61-coll/040-restore.exp | 57 +++++++++++++++++++++++ testsuite/modules.61-coll/999-cleanup.exp | 15 ++++++ 6 files changed, 109 insertions(+) create mode 100644 testsuite/home/coll10 create mode 100644 testsuite/home/coll9 diff --git a/testsuite/home/coll10 b/testsuite/home/coll10 new file mode 100644 index 00000000..dd9e68d8 --- /dev/null +++ b/testsuite/home/coll10 @@ -0,0 +1,5 @@ +module use --append testsuite/modulefiles +module load coll/c +module load --notuasked --notuasked coll/a +module load coll/b + diff --git a/testsuite/home/coll9 b/testsuite/home/coll9 new file mode 100644 index 00000000..483285b3 --- /dev/null +++ b/testsuite/home/coll9 @@ -0,0 +1,5 @@ +module use --append testsuite/modulefiles +module load coll/c +module load --notuasked coll/a +module load coll/b + diff --git a/testsuite/modules.61-coll/010-init_ts.exp b/testsuite/modules.61-coll/010-init_ts.exp index df29f71c..d44cd61f 100644 --- a/testsuite/modules.61-coll/010-init_ts.exp +++ b/testsuite/modules.61-coll/010-init_ts.exp @@ -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" diff --git a/testsuite/modules.61-coll/030-save.exp b/testsuite/modules.61-coll/030-save.exp index 3a402e7d..beb89ca9 100644 --- a/testsuite/modules.61-coll/030-save.exp +++ b/testsuite/modules.61-coll/030-save.exp @@ -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 # diff --git a/testsuite/modules.61-coll/040-restore.exp b/testsuite/modules.61-coll/040-restore.exp index 495bcbd0..78c2fb1d 100644 --- a/testsuite/modules.61-coll/040-restore.exp +++ b/testsuite/modules.61-coll/040-restore.exp @@ -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 diff --git a/testsuite/modules.61-coll/999-cleanup.exp b/testsuite/modules.61-coll/999-cleanup.exp index 347ce918..4614f76c 100644 --- a/testsuite/modules.61-coll/999-cleanup.exp +++ b/testsuite/modules.61-coll/999-cleanup.exp @@ -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