| 1 |
############################################################################## |
| 2 |
# Modules Release Tcl |
| 3 |
# Providing a flexible user environment |
| 4 |
# |
| 5 |
# File: modules.61-coll/%M% |
| 6 |
# Revision: %I% |
| 7 |
# First Edition: 2016/08/16 |
| 8 |
# Last Mod.: %U%, %G% |
| 9 |
# |
| 10 |
# Authors: Xavier Delaruelle, [email protected] |
| 11 |
# |
| 12 |
# Description: Testuite testsequence |
| 13 |
# Command: |
| 14 |
# Modulefiles: |
| 15 |
# Sub-Command: |
| 16 |
# |
| 17 |
# Comment: %C{ |
| 18 |
# Test the module 'saveshow' command |
| 19 |
# }C% |
| 20 |
# |
| 21 |
############################################################################## |
| 22 |
|
| 23 |
set cbadnerrmsg [err_coll_notfound $collbadn] |
| 24 |
set cbadfperrmsg [err_coll_notfound $collbadfp] |
| 25 |
set cbadterrmsg [err_coll_notfound $colld $colltarget] |
| 26 |
set badcontfp "$homewithcoll/.Xresources" |
| 27 |
set badcontfperrmsg [err_coll_notvalid $badcontfp] |
| 28 |
|
| 29 |
|
| 30 |
# set HOME to location containing collections |
| 31 |
if {$verbose} { |
| 32 |
send_user "\tSetup HOME = $homewithcoll\n" |
| 33 |
} |
| 34 |
set env(HOME) "$homewithcoll" |
| 35 |
|
| 36 |
|
| 37 |
# |
| 38 |
# test showing nonexistent collection |
| 39 |
# |
| 40 |
|
| 41 |
testouterr_cmd "ALL" "saveshow $collbadn" "ERR" "$cbadnerrmsg" |
| 42 |
|
| 43 |
|
| 44 |
# |
| 45 |
# test showing nonexistent collection specified as a filepath |
| 46 |
# |
| 47 |
|
| 48 |
testouterr_cmd "ALL" "describe $collbadfp" "ERR" "$cbadfperrmsg" |
| 49 |
|
| 50 |
|
| 51 |
# |
| 52 |
# test showing existent file which is not a collection |
| 53 |
# |
| 54 |
|
| 55 |
testouterr_cmd "ALL" "des $badcontfp" "ERR" "$badcontfperrmsg" |
| 56 |
|
| 57 |
|
| 58 |
# |
| 59 |
# test showing collection requiring an upcoming version of Modules |
| 60 |
# test effect of mcookie configuration with this collection |
| 61 |
# |
| 62 |
|
| 63 |
testouterr_cmd sh "saveshow $coll48" ERR [collerr_minverreqns $coll48fp 99] |
| 64 |
testouterr_cmd sh "saveshow $coll48fp" ERR [collerr_minverreqns $coll48fp 99] |
| 65 |
|
| 66 |
setenv_var MODULES_MCOOKIE_CHECK eval |
| 67 |
testouterr_cmd sh "saveshow $coll48" ERR [collerr_minverreqns $coll48fp 99] |
| 68 |
setenv_var MODULES_MCOOKIE_CHECK always |
| 69 |
|
| 70 |
setenv_var MODULES_MCOOKIE_VERSION_CHECK 0 |
| 71 |
testouterr_cmd sh "saveshow $coll48" ERR [collerr_minverreqns $coll48fp 99] |
| 72 |
setenv_var MODULES_MCOOKIE_VERSION_CHECK 1 |
| 73 |
|
| 74 |
|
| 75 |
# |
| 76 |
# test showing default collection |
| 77 |
# |
| 78 |
|
| 79 |
# test only sh shell as this test does not produce shell output |
| 80 |
testouterr_cmd_re "sh" "saveshow" "OK" "$modlin\n$homewithcolldotmodre/$colld:\n\n$cdcontrepin\n$modlin" |
| 81 |
|
| 82 |
skip_if_quick_mode |
| 83 |
|
| 84 |
# |
| 85 |
# test showing named collection |
| 86 |
# using old fashioned way to define paths (no --append property) |
| 87 |
# |
| 88 |
|
| 89 |
# test only sh shell as this test does not produce shell output |
| 90 |
testouterr_cmd_re "sh" "saveshow $coll1" "OK" "$modlin\n$homewithcolldotmodre/$coll1:\n\n$presavedc1cont1re\n$modlin" |
| 91 |
|
| 92 |
|
| 93 |
# |
| 94 |
# test showing collection specified as a filepath when |
| 95 |
# MODULES_COLLECTION_TARGET is set. target should be ignored |
| 96 |
# |
| 97 |
|
| 98 |
# setup environment state |
| 99 |
if {$verbose} { |
| 100 |
send_user "\tSetup MODULES_COLLECTION_TARGET = $colltarget\n" |
| 101 |
} |
| 102 |
set env(MODULES_COLLECTION_TARGET) "$colltarget" |
| 103 |
|
| 104 |
# test only sh shell as this test does not produce shell output |
| 105 |
testouterr_cmd_re "sh" "saveshow $homewithcolldotmod/$coll1" "OK" "$modlin\n$homewithcolldotmodre/$coll1:\n\n$presavedc1cont1re\n$modlin" |
| 106 |
|
| 107 |
|
| 108 |
# |
| 109 |
# test showing collection not mentioning module to load |
| 110 |
# when MODULES_COLLECTION_TARGET is set |
| 111 |
# |
| 112 |
|
| 113 |
# test only sh shell as this test does not produce shell output |
| 114 |
testouterr_cmd_re "sh" "saveshow $coll4" "OK" "$modlin\n$homewithcolldotmodre/$coll4f:\n\n$c4contre\n$modlin" |
| 115 |
|
| 116 |
|
| 117 |
# |
| 118 |
# test displaying same collection than before but with a modulepath |
| 119 |
# prepended rather appended |
| 120 |
# |
| 121 |
|
| 122 |
testouterr_cmd_re "sh" "saveshow $coll5fp" "OK" "$modlin\n$coll5fpre:\n\n$c4contre\n$modlin" |
| 123 |
|
| 124 |
|
| 125 |
# |
| 126 |
# test displaying collection with no modulepath and modulefiles loaded as fullpath |
| 127 |
# |
| 128 |
|
| 129 |
testouterr_cmd_re "sh" "saveshow $coll7fp" "OK" "$modlin\n$coll7fpre:\n\n$c7contre\n$modlin" |
| 130 |
|
| 131 |
|
| 132 |
# |
| 133 |
# test showing nonexistent default collection when |
| 134 |
# MODULES_COLLECTION_TARGET is set |
| 135 |
# |
| 136 |
|
| 137 |
testouterr_cmd "ALL" "saveshow default" "ERR" "$cbadterrmsg" |
| 138 |
|
| 139 |
# no collection name specified, if default collection does not exists |
| 140 |
# initial environment is displayed |
| 141 |
set tserr "$modlin\ninitial environment:\n\n\n$modlin" |
| 142 |
testouterr_cmd_re ALL saveshow OK $tserr |
| 143 |
|
| 144 |
# same effect if __init__ name is provided |
| 145 |
testouterr_cmd_re sh {saveshow __init__} OK $tserr |
| 146 |
|
| 147 |
# set specific initial environment |
| 148 |
setenv_var __MODULES_LMINIT "module use --append $c9modpath1:module load $c9mod3" |
| 149 |
set tserr "$modlin |
| 150 |
initial environment: |
| 151 |
|
| 152 |
module use --append [escre $c9modpath1] |
| 153 |
module load $c9mod3 |
| 154 |
|
| 155 |
$modlin" |
| 156 |
testouterr_cmd_re sh saveshow OK $tserr |
| 157 |
testouterr_cmd_re sh {saveshow __init__} OK $tserr |
| 158 |
|
| 159 |
unsetenv_var __MODULES_LMINIT |
| 160 |
|
| 161 |
|
| 162 |
# |
| 163 |
# test displaying collection with no modulepath and modulefiles loaded as fullpath |
| 164 |
# |
| 165 |
|
| 166 |
unsetenv_var MODULES_COLLECTION_TARGET |
| 167 |
|
| 168 |
if {!$is_symlink_supported} { |
| 169 |
send_user "\tskipping tests over '$modpath wspace' modulepath as symbolic links are not supported on filesystem\n" |
| 170 |
} else { |
| 171 |
|
| 172 |
testouterr_cmd_re sh "saveshow $coll15fp" OK "$modlin\n$coll15fpre:\n\n$c15contre\n$modlin" |
| 173 |
testouterr_cmd_re sh "saveshow $coll16fp" OK "$modlin\n$coll16fpre:\n\n$c16contre\n$modlin" |
| 174 |
|
| 175 |
} |
| 176 |
|
| 177 |
# |
| 178 |
# test displaying collection with modulepath starting with variable reference |
| 179 |
# |
| 180 |
|
| 181 |
testouterr_cmd_re sh "saveshow $coll17fp" OK "$modlin\n$coll17fpre:\n\n$c17contre\n$modlin" |
| 182 |
|
| 183 |
# |
| 184 |
# variant tests |
| 185 |
# |
| 186 |
|
| 187 |
# ensure advanced_version_spec is enabled to record variant |
| 188 |
setenv_var MODULES_ADVANCED_VERSION_SPEC 1 |
| 189 |
|
| 190 |
# test with collection_pin_version enabled |
| 191 |
setenv_var MODULES_COLLECTION_PIN_VERSION 1 |
| 192 |
|
| 193 |
testouterr_cmd sh "saveshow $coll19fp" OK "$sep_line\n$coll19fp:\n\n$c19cont\n$sep_line" |
| 194 |
testouterr_cmd sh "saveshow $coll25fp" OK "$sep_line\n$coll25fp:\n\n$c25cont\n$sep_line" |
| 195 |
testouterr_cmd sh "saveshow $coll26fp" OK "$sep_line\n$coll26fp:\n\n$c26cont\n$sep_line" |
| 196 |
|
| 197 |
# test with collection_pin_version enabled |
| 198 |
setenv_var MODULES_COLLECTION_PIN_VERSION 0 |
| 199 |
|
| 200 |
testouterr_cmd sh "saveshow $coll19fp" OK "$sep_line\n$coll19fp:\n\n$c19cont\n$sep_line" |
| 201 |
testouterr_cmd sh "saveshow $coll25fp" OK "$sep_line\n$coll25fp:\n\n$c25cont\n$sep_line" |
| 202 |
testouterr_cmd sh "saveshow $coll26fp" OK "$sep_line\n$coll26fp:\n\n$c26cont\n$sep_line" |
| 203 |
|
| 204 |
# disable advanced_version_spec |
| 205 |
setenv_var MODULES_ADVANCED_VERSION_SPEC 0 |
| 206 |
|
| 207 |
# each variant set is considered a module to load |
| 208 |
testouterr_cmd sh "saveshow $coll19fp" OK "$sep_line\n$coll19fp:\n\n$c19contnoavs\n$sep_line" |
| 209 |
testouterr_cmd sh "saveshow $coll26fp" OK "$sep_line\n$coll26fp:\n\n$c26contnoavs\n$sep_line" |
| 210 |
|
| 211 |
# test showing collection with bad module specification |
| 212 |
setenv_var MODULES_ADVANCED_VERSION_SPEC 1 |
| 213 |
testouterr_cmd sh "saveshow $coll27fp" ERR "$error_msgs: $msg_nomodnameinarg 'foo=val'" |
| 214 |
testouterr_cmd sh "saveshow $coll28fp" ERR "$error_msgs: $msg_nomodnameinarg '@1.0'" |
| 215 |
testouterr_cmd sh "saveshow $coll29fp" OK "$sep_line\n$coll29fp:\n\n$c29cont\n$sep_line" |
| 216 |
|
| 217 |
# test showing collection with variant shortcut set |
| 218 |
setenv_var MODULES_VARIANT_SHORTCUT foo=% |
| 219 |
testouterr_cmd sh "saveshow $coll36fp" OK "$sep_line\n$coll36fp:\n\n$c36cont\n$sep_line" |
| 220 |
unsetenv_var MODULES_VARIANT_SHORTCUT |
| 221 |
|
| 222 |
unsetenv_var MODULES_ADVANCED_VERSION_SPEC |
| 223 |
unsetenv_var MODULES_COLLECTION_PIN_VERSION |
| 224 |
|
| 225 |
|
| 226 |
# |
| 227 |
# tag tests |
| 228 |
# |
| 229 |
|
| 230 |
# ensure advanced_version_spec is enabled to record variant |
| 231 |
setenv_var MODULES_ADVANCED_VERSION_SPEC 1 |
| 232 |
|
| 233 |
setenv_var TESTSUITE_TAG_OPT colltag1 |
| 234 |
testouterr_cmd_re sh "saveshow $coll37fp" OK "$modlin\n$coll37fpre:\n\n$c37contre\n$modlin" |
| 235 |
testouterr_cmd_re sh "saveshow $coll38fp" OK "$modlin\n$coll38fpre:\n\n$c38contre\n$modlin" |
| 236 |
|
| 237 |
unsetenv_var MODULES_ADVANCED_VERSION_SPEC |
| 238 |
|
| 239 |
setenv_var TESTSUITE_TAG_OPT colltag2 |
| 240 |
testouterr_cmd_re sh "saveshow $coll39fp" OK "$modlin\n$coll39fpre:\n\n$c39contre\n$modlin" |
| 241 |
testouterr_cmd_re sh "saveshow $coll40fp" OK "$modlin\n$coll40fpre:\n\n$c40contre\n$modlin" |
| 242 |
testouterr_cmd_re sh "saveshow $coll41fp" OK "$modlin\n$coll41fpre:\n\n$c41contre\n$modlin" |
| 243 |
testouterr_cmd_re sh "saveshow $coll42fp" OK "$modlin\n$coll42fpre:\n\n$c42contre\n$modlin" |
| 244 |
|
| 245 |
setenv_var MODULES_ADVANCED_VERSION_SPEC 1 |
| 246 |
set tserr "$error_msgs: $msg_nomodnameinarg '--tag'" |
| 247 |
testouterr_cmd_re sh "saveshow $coll43fp" ERR $tserr |
| 248 |
setenv_var MODULES_ADVANCED_VERSION_SPEC 0 |
| 249 |
testouterr_cmd_re sh "saveshow $coll43fp" OK "$modlin\n$coll43fpre:\n\n$c43contre\n$modlin" |
| 250 |
unsetenv_var MODULES_ADVANCED_VERSION_SPEC |
| 251 |
|
| 252 |
unsetenv_var TESTSUITE_TAG_OPT |
| 253 |
|
| 254 |
|
| 255 |
# |
| 256 |
# test unsetting HOME |
| 257 |
# |
| 258 |
|
| 259 |
if {$verbose} { |
| 260 |
send_user "\tUnset HOME \n" |
| 261 |
} |
| 262 |
unset env(HOME) |
| 263 |
|
| 264 |
testouterr_cmd "sh" "saveshow" "ERR" $nohomeerrmsg |
| 265 |
|
| 266 |
# restore default testsuite home |
| 267 |
if {$verbose} { |
| 268 |
send_user "\tRestore HOME = $ORIG_HOME\n" |
| 269 |
} |
| 270 |
set env(HOME) $ORIG_HOME |
| 271 |
|
| 272 |
|
| 273 |
# |
| 274 |
# Cleanup |
| 275 |
# |
| 276 |
|
| 277 |
reset_test_env |