| 1 |
############################################################################## |
| 2 |
# Modules Revision 3.0 |
| 3 |
# Providing a flexible user environment |
| 4 |
# |
| 5 |
# File: modules.20-locate/%M% |
| 6 |
# Revision: %I% |
| 7 |
# First Edition: 2020/08/15 |
| 8 |
# Last Mod.: %U%, %G% |
| 9 |
# |
| 10 |
# Authors: Xavier Delaruelle, [email protected] |
| 11 |
# |
| 12 |
# Description: Testuite testsequence |
| 13 |
# Command: avail, load |
| 14 |
# Modulefiles: |
| 15 |
# Sub-Command: |
| 16 |
# |
| 17 |
# Comment: %C{ |
| 18 |
# Disable hiding with '--before' or '--after' options of |
| 19 |
# 'module-hide' command |
| 20 |
# }C% |
| 21 |
# |
| 22 |
############################################################################## |
| 23 |
|
| 24 |
# ensure avail tests are made using in depth mode |
| 25 |
setenv_var MODULES_AVAIL_INDEPTH 1 |
| 26 |
|
| 27 |
# ensure avail tests have implicit default enabled |
| 28 |
setenv_var MODULES_IMPLICIT_DEFAULT 1 |
| 29 |
|
| 30 |
# ensure regular avail search match is set for these tests |
| 31 |
setenv_var MODULES_SEARCH_MATCH starts_with |
| 32 |
|
| 33 |
# ensure extended default and advanced version specifiers are enabled for these tests |
| 34 |
setenv_var MODULES_ADVANCED_VERSION_SPEC 1 |
| 35 |
setenv_var MODULES_EXTENDED_DEFAULT 1 |
| 36 |
|
| 37 |
set mp $modpath.2 |
| 38 |
set mpre $modpathre.2 |
| 39 |
setenv_path_var MODULEPATH $mp |
| 40 |
|
| 41 |
setenv_var MODULERCFILE $env(TESTSUITEDIR)/etc/modulerc.hide |
| 42 |
|
| 43 |
|
| 44 |
set ans [list] |
| 45 |
lappend ans [list set __MODULES_LMALTNAME hide1/5.0&as|hide1/latest] |
| 46 |
lappend ans [list set _LMFILES_ $mp/hide1/5.0] |
| 47 |
lappend ans [list set LOADEDMODULES hide1/5.0] |
| 48 |
|
| 49 |
set ans2 [list] |
| 50 |
lappend ans2 [list set __MODULES_LMALTNAME hide1/5.0&as|hide1/latest] |
| 51 |
lappend ans2 [list set _LMFILES_ $mp/hide1/5.0] |
| 52 |
lappend ans2 [list set LOADEDMODULES hide1/5.0] |
| 53 |
lappend ans2 [list ERR] |
| 54 |
|
| 55 |
set tserr1 $mp:\nhide1/5.0 |
| 56 |
set tserr2 $err_path'hide1@5:' |
| 57 |
|
| 58 |
# test --before option |
| 59 |
setenv_var TESTSUITE_HIDE_BEFORE_SET1 1 |
| 60 |
testouterr_cmd sh {load hide1@5:} $ans {} |
| 61 |
testouterr_cmd sh {avail -t hide1@5:} OK $tserr1 |
| 62 |
unsetenv_var TESTSUITE_HIDE_BEFORE_SET1 |
| 63 |
|
| 64 |
skip_if_quick_mode |
| 65 |
|
| 66 |
setenv_var TESTSUITE_HIDE_BEFORE_SET2 1 |
| 67 |
testouterr_cmd sh {load hide1@5:} ERR $tserr2 |
| 68 |
testouterr_cmd sh {avail -t hide1@5:} OK {} |
| 69 |
unsetenv_var TESTSUITE_HIDE_BEFORE_SET2 |
| 70 |
|
| 71 |
setenv_var TESTSUITE_HIDE_BEFORE_SET3 1 |
| 72 |
testouterr_cmd sh {load hide1@5:} $ans {} |
| 73 |
testouterr_cmd sh {avail -t hide1@5:} OK $tserr1 |
| 74 |
unsetenv_var TESTSUITE_HIDE_BEFORE_SET3 |
| 75 |
|
| 76 |
setenv_var TESTSUITE_HIDE_BEFORE_SET4 1 |
| 77 |
testouterr_cmd sh {load hide1@5:} ERR $tserr2 |
| 78 |
testouterr_cmd sh {avail -t hide1@5:} OK {} |
| 79 |
unsetenv_var TESTSUITE_HIDE_BEFORE_SET4 |
| 80 |
|
| 81 |
setenv_var TESTSUITE_HIDE_BEFORE_SET5 1 |
| 82 |
testouterr_cmd sh {load hide1@5:} $ans {} |
| 83 |
testouterr_cmd sh {avail -t hide1@5:} OK $tserr1 |
| 84 |
unsetenv_var TESTSUITE_HIDE_BEFORE_SET5 |
| 85 |
|
| 86 |
setenv_var TESTSUITE_HIDE_BEFORE_SET6 1 |
| 87 |
testouterr_cmd sh {load hide1@5:} $ans {} |
| 88 |
testouterr_cmd sh {avail -t hide1@5:} OK $tserr1 |
| 89 |
unsetenv_var TESTSUITE_HIDE_BEFORE_SET6 |
| 90 |
|
| 91 |
# test --after option |
| 92 |
setenv_var TESTSUITE_HIDE_AFTER_SET1 1 |
| 93 |
testouterr_cmd sh {load hide1@5:} $ans {} |
| 94 |
testouterr_cmd sh {avail -t hide1@5:} OK $tserr1 |
| 95 |
unsetenv_var TESTSUITE_HIDE_AFTER_SET1 |
| 96 |
|
| 97 |
setenv_var TESTSUITE_HIDE_AFTER_SET2 1 |
| 98 |
testouterr_cmd sh {load hide1@5:} ERR $tserr2 |
| 99 |
testouterr_cmd sh {avail -t hide1@5:} OK {} |
| 100 |
unsetenv_var TESTSUITE_HIDE_AFTER_SET2 |
| 101 |
|
| 102 |
setenv_var TESTSUITE_HIDE_AFTER_SET3 1 |
| 103 |
testouterr_cmd sh {load hide1@5:} $ans {} |
| 104 |
testouterr_cmd sh {avail -t hide1@5:} OK $tserr1 |
| 105 |
unsetenv_var TESTSUITE_HIDE_AFTER_SET3 |
| 106 |
|
| 107 |
setenv_var TESTSUITE_HIDE_AFTER_SET4 1 |
| 108 |
testouterr_cmd sh {load hide1@5:} ERR $tserr2 |
| 109 |
testouterr_cmd sh {avail -t hide1@5:} OK {} |
| 110 |
unsetenv_var TESTSUITE_HIDE_AFTER_SET4 |
| 111 |
|
| 112 |
setenv_var TESTSUITE_HIDE_AFTER_SET5 1 |
| 113 |
testouterr_cmd sh {load hide1@5:} $ans {} |
| 114 |
testouterr_cmd sh {avail -t hide1@5:} OK $tserr1 |
| 115 |
unsetenv_var TESTSUITE_HIDE_AFTER_SET5 |
| 116 |
|
| 117 |
setenv_var TESTSUITE_HIDE_AFTER_SET6 1 |
| 118 |
testouterr_cmd sh {load hide1@5:} $ans {} |
| 119 |
testouterr_cmd sh {avail -t hide1@5:} OK $tserr1 |
| 120 |
unsetenv_var TESTSUITE_HIDE_AFTER_SET6 |
| 121 |
|
| 122 |
setenv_var TESTSUITE_HIDE_AFTER_SET7 1 |
| 123 |
testouterr_cmd sh {load hide1@5:} ERR $tserr2 |
| 124 |
testouterr_cmd sh {avail -t hide1@5:} OK {} |
| 125 |
unsetenv_var TESTSUITE_HIDE_AFTER_SET7 |
| 126 |
|
| 127 |
# test cumulative use of --before and --after options |
| 128 |
setenv_var TESTSUITE_HIDE_BEFORE_AFTER_SET1 1 |
| 129 |
testouterr_cmd sh {load hide1@5:} ERR $tserr2 |
| 130 |
testouterr_cmd sh {avail -t hide1@5:} OK {} |
| 131 |
unsetenv_var TESTSUITE_HIDE_BEFORE_AFTER_SET1 |
| 132 |
|
| 133 |
setenv_var TESTSUITE_HIDE_BEFORE_AFTER_SET2 1 |
| 134 |
testouterr_cmd sh {load hide1@5:} ERR $tserr2 |
| 135 |
testouterr_cmd sh {avail -t hide1@5:} OK {} |
| 136 |
unsetenv_var TESTSUITE_HIDE_BEFORE_AFTER_SET2 |
| 137 |
|
| 138 |
setenv_var TESTSUITE_HIDE_BEFORE_AFTER_SET3 1 |
| 139 |
testouterr_cmd sh {load hide1@5:} ERR $tserr2 |
| 140 |
testouterr_cmd sh {avail -t hide1@5:} OK {} |
| 141 |
unsetenv_var TESTSUITE_HIDE_BEFORE_AFTER_SET3 |
| 142 |
|
| 143 |
setenv_var TESTSUITE_HIDE_BEFORE_AFTER_SET4 1 |
| 144 |
testouterr_cmd sh {load hide1@5:} $ans {} |
| 145 |
testouterr_cmd sh {avail -t hide1@5:} OK $tserr1 |
| 146 |
unsetenv_var TESTSUITE_HIDE_BEFORE_AFTER_SET4 |
| 147 |
|
| 148 |
|
| 149 |
set ans [list] |
| 150 |
lappend ans [list set __MODULES_LMALTNAME hide1/5.0&as|hide1/latest] |
| 151 |
lappend ans [list set _LMFILES_ $mp/hide1/5.0] |
| 152 |
lappend ans [list set LOADEDMODULES hide1/5.0] |
| 153 |
lappend ans [list ERR] |
| 154 |
|
| 155 |
if {[cmpversion $tclsh_version 8.6] == -1} { |
| 156 |
set custom " invoked from within |
| 157 |
\"if \{\[info exists env(TESTSUITE_HIDE_BEFORE_AFTER_ERR_SET1)\]\} \{ |
| 158 |
module-hide --after hide1/5.0 |
| 159 |
\}\"" |
| 160 |
set linenum 318 |
| 161 |
} else { |
| 162 |
set custom {} |
| 163 |
set linenum 319 |
| 164 |
} |
| 165 |
set tserr2 [msg_moderr {Incorrect --after value 'hide1/5.0' (valid date time format is 'YYYY-MM-DD[THH:MM]')} {module-hide --after hide1/5.0} $mp/hide1/.modulerc $linenum { } {} {} $custom] |
| 166 |
|
| 167 |
if {[cmpversion $tclsh_version 8.6] == -1} { |
| 168 |
set custom " invoked from within |
| 169 |
\"if \{\[info exists env(TESTSUITE_HIDE_BEFORE_AFTER_ERR_SET2)\]\} \{ |
| 170 |
module-hide --before hide1/5.0 --after |
| 171 |
\}\"" |
| 172 |
set linenum 321 |
| 173 |
} else { |
| 174 |
set custom {} |
| 175 |
set linenum 322 |
| 176 |
} |
| 177 |
set tserr3 [msg_moderr {Incorrect --before value 'hide1/5.0' (valid date time format is 'YYYY-MM-DD[THH:MM]')} {module-hide --before hide1/5.0 --after} $mp/hide1/.modulerc $linenum { } {} {} $custom] |
| 178 |
|
| 179 |
if {[cmpversion $tclsh_version 8.6] == -1} { |
| 180 |
set custom " invoked from within |
| 181 |
\"if \{\[info exists env(TESTSUITE_HIDE_BEFORE_AFTER_ERR_SET3)\]\} \{ |
| 182 |
module-hide --after |
| 183 |
\}\"" |
| 184 |
set linenum 324 |
| 185 |
} else { |
| 186 |
set custom {} |
| 187 |
set linenum 325 |
| 188 |
} |
| 189 |
set tserr4 [msg_moderr {Missing value for '--after' option} {module-hide --after} $mp/hide1/.modulerc $linenum { } {} {} $custom] |
| 190 |
|
| 191 |
if {[cmpversion $tclsh_version 8.6] == -1} { |
| 192 |
set custom " invoked from within |
| 193 |
\"if \{\[info exists env(TESTSUITE_HIDE_BEFORE_AFTER_ERR_SET4)\]\} \{ |
| 194 |
module-hide --after 2020-06-12T23 hide1/5.0 |
| 195 |
\}\"" |
| 196 |
set linenum 327 |
| 197 |
} else { |
| 198 |
set custom {} |
| 199 |
set linenum 328 |
| 200 |
} |
| 201 |
set tserr5 [msg_moderr {Incorrect --after value '2020-06-12T23' (valid date time format is 'YYYY-MM-DD[THH:MM]')} {module-hide --after 2020-06-12T23 hide1/5.0} $mp/hide1/.modulerc $linenum { } {} {} $custom] |
| 202 |
|
| 203 |
if {[cmpversion $tclsh_version 8.6] == -1} { |
| 204 |
set custom " invoked from within |
| 205 |
\"if \{\[info exists env(TESTSUITE_HIDE_BEFORE_AFTER_ERR_SET5)\]\} \{ |
| 206 |
module-hide --before 2029 hide1/5.0 |
| 207 |
\}\"" |
| 208 |
set linenum 330 |
| 209 |
} else { |
| 210 |
set custom {} |
| 211 |
set linenum 331 |
| 212 |
} |
| 213 |
set tserr6 [msg_moderr {Incorrect --before value '2029' (valid date time format is 'YYYY-MM-DD[THH:MM]')} {module-hide --before 2029 hide1/5.0} $mp/hide1/.modulerc $linenum { } {} {} $custom] |
| 214 |
|
| 215 |
if {[cmpversion $tclsh_version 8.6] == -1} { |
| 216 |
set custom " invoked from within |
| 217 |
\"if \{\[info exists env(TESTSUITE_HIDE_BEFORE_AFTER_ERR_SET6)\]\} \{ |
| 218 |
module-hide --after 2020-06-01T10:20:53 hide1/5.0 |
| 219 |
\}\"" |
| 220 |
set linenum 333 |
| 221 |
} else { |
| 222 |
set custom {} |
| 223 |
set linenum 334 |
| 224 |
} |
| 225 |
set tserr7 [msg_moderr {Incorrect --after value '2020-06-01T10:20:53' (valid date time format is 'YYYY-MM-DD[THH:MM]')} {module-hide --after 2020-06-01T10:20:53 hide1/5.0} $mp/hide1/.modulerc $linenum { } {} {} $custom] |
| 226 |
|
| 227 |
# test erroneous specification of --before and --after options |
| 228 |
setenv_var TESTSUITE_HIDE_BEFORE_AFTER_ERR_SET1 1 |
| 229 |
testouterr_cmd sh {load hide1@5:} $ans $tserr2 |
| 230 |
testouterr_cmd sh {avail -t hide1@5:} OK $tserr1 |
| 231 |
unsetenv_var TESTSUITE_HIDE_BEFORE_AFTER_ERR_SET1 |
| 232 |
|
| 233 |
setenv_var TESTSUITE_HIDE_BEFORE_AFTER_ERR_SET2 1 |
| 234 |
testouterr_cmd sh {load hide1@5:} $ans $tserr3 |
| 235 |
testouterr_cmd sh {avail -t hide1@5:} OK $tserr1 |
| 236 |
unsetenv_var TESTSUITE_HIDE_BEFORE_AFTER_ERR_SET2 |
| 237 |
|
| 238 |
setenv_var TESTSUITE_HIDE_BEFORE_AFTER_ERR_SET3 1 |
| 239 |
testouterr_cmd sh {load hide1@5:} $ans $tserr4 |
| 240 |
testouterr_cmd sh {avail -t hide1@5:} OK $tserr1 |
| 241 |
unsetenv_var TESTSUITE_HIDE_BEFORE_AFTER_ERR_SET3 |
| 242 |
|
| 243 |
setenv_var TESTSUITE_HIDE_BEFORE_AFTER_ERR_SET4 1 |
| 244 |
testouterr_cmd sh {load hide1@5:} $ans $tserr5 |
| 245 |
testouterr_cmd sh {avail -t hide1@5:} OK $tserr1 |
| 246 |
unsetenv_var TESTSUITE_HIDE_BEFORE_AFTER_ERR_SET4 |
| 247 |
|
| 248 |
setenv_var TESTSUITE_HIDE_BEFORE_AFTER_ERR_SET5 1 |
| 249 |
testouterr_cmd sh {load hide1@5:} $ans $tserr6 |
| 250 |
testouterr_cmd sh {avail -t hide1@5:} OK $tserr1 |
| 251 |
unsetenv_var TESTSUITE_HIDE_BEFORE_AFTER_ERR_SET5 |
| 252 |
|
| 253 |
setenv_var TESTSUITE_HIDE_BEFORE_AFTER_ERR_SET6 1 |
| 254 |
testouterr_cmd sh {load hide1@5:} $ans $tserr7 |
| 255 |
testouterr_cmd sh {avail -t hide1@5:} OK $tserr1 |
| 256 |
unsetenv_var TESTSUITE_HIDE_BEFORE_AFTER_ERR_SET6 |
| 257 |
|
| 258 |
|
| 259 |
# |
| 260 |
# Cleanup |
| 261 |
# |
| 262 |
|
| 263 |
reset_test_env |