| 1 |
############################################################################## |
| 2 |
# Modules Revision 3.0 |
| 3 |
# Providing a flexible user environment |
| 4 |
# |
| 5 |
# File: modules.50-cmds/%M% |
| 6 |
# Revision: %I% |
| 7 |
# First Edition: 2021/03/30 |
| 8 |
# Last Mod.: %U%, %G% |
| 9 |
# |
| 10 |
# Authors: Xavier Delaruelle, [email protected] |
| 11 |
# |
| 12 |
# Description: Testuite testsequence |
| 13 |
# Command: whatis, search |
| 14 |
# Modulefiles: variant |
| 15 |
# Sub-Command: |
| 16 |
# |
| 17 |
# Comment: %C{ |
| 18 |
# Test whatis evaluation mode with variant |
| 19 |
# }C% |
| 20 |
# |
| 21 |
############################################################################## |
| 22 |
|
| 23 |
skip_if_quick_mode |
| 24 |
|
| 25 |
set mp $modpath.3 |
| 26 |
set mpre $modpathre.3 |
| 27 |
setenv_path_var MODULEPATH $mp |
| 28 |
|
| 29 |
setenv_var MODULES_ADVANCED_VERSION_SPEC 1 |
| 30 |
|
| 31 |
|
| 32 |
setenv_var TESTSUITE_VARIANT 1 |
| 33 |
set tserr "$modlin $mpre $modlin |
| 34 |
\\s+variant/6.0: variant/6.0" |
| 35 |
testouterr_cmd_re sh {whatis variant/6.0 foo=val1 bar=2} OK $tserr |
| 36 |
testouterr_cmd_re sh {whatis variant/6.0 foo=val3 foo=val1 bar=2} OK $tserr |
| 37 |
testouterr_cmd_re sh {whatis variant/6.0} OK $tserr |
| 38 |
testouterr_cmd_re sh {whatis variant/6.0 unk=val} ERR "$err_path'variant/6.0 unk=val'" |
| 39 |
testouterr_cmd_re sh {whatis variant/6.0 foo=val4 foo=val1 bar=2} ERR "$err_path'variant/6.0 foo=val4 foo=val1 bar=2'" |
| 40 |
|
| 41 |
testouterr_cmd_re sh {search variant} OK $tserr |
| 42 |
testouterr_cmd_re sh {search variant/6.0} OK $tserr |
| 43 |
|
| 44 |
setenv_var TESTSUITE_VARIANT 2 |
| 45 |
# variant/4.0 reacts to TESTSUITE_VARIANT=2 in scan mode |
| 46 |
set tserr "variant/4.0 |
| 47 |
$modlin $mpre $modlin |
| 48 |
\\s+variant/6.0: variant/6.0" |
| 49 |
testouterr_cmd_re sh {whatis variant/6.0 foo=val1 bar=2} OK $tserr |
| 50 |
set tserr "$modlin $mpre $modlin |
| 51 |
\\s+variant/6.0: variant/6.0" |
| 52 |
testouterr_cmd_re sh {whatis variant/6.0} OK $tserr |
| 53 |
|
| 54 |
setenv_var TESTSUITE_VARIANT 3 |
| 55 |
set tserr "$modlin $mpre $modlin |
| 56 |
\\s+variant/6.0: variant/6.0 -" |
| 57 |
testouterr_cmd_re sh {whatis variant/6.0 foo=val1 bar=2} OK $tserr |
| 58 |
testouterr_cmd_re sh {whatis variant/6.0} OK $tserr |
| 59 |
|
| 60 |
setenv_var TESTSUITE_VARIANT 4 |
| 61 |
testouterr_cmd_re sh {whatis variant/6.0 foo=val1 bar=2} OK $tserr |
| 62 |
testouterr_cmd_re sh {whatis variant/6.0} OK $tserr |
| 63 |
|
| 64 |
setenv_var TESTSUITE_VARIANT 5 |
| 65 |
testouterr_cmd_re sh {whatis variant/6.0 foo=val1 bar=2} OK {} |
| 66 |
testouterr_cmd_re sh {whatis variant/6.0} OK {} |
| 67 |
|
| 68 |
setenv_var TESTSUITE_VARIANT 6 |
| 69 |
testouterr_cmd_re sh {whatis variant/6.0 foo=val1 bar=2} ERR "$err_path'variant/6.0 foo=val1 bar=2'" |
| 70 |
testouterr_cmd_re sh {whatis variant/6.0} OK {} |
| 71 |
|
| 72 |
setenv_var TESTSUITE_VARIANT 7 |
| 73 |
set tserr "$modlin $mpre $modlin |
| 74 |
\\s+variant/6.0: variant/6.0 " |
| 75 |
testouterr_cmd_re sh {whatis variant/6.0 foo=val1 bar=2} ERR "$err_path'variant/6.0 foo=val1 bar=2'" |
| 76 |
testouterr_cmd_re sh {whatis variant/6.0} OK $tserr |
| 77 |
|
| 78 |
setenv_var TESTSUITE_VARIANT 8 |
| 79 |
testouterr_cmd_re sh {whatis variant/6.0 foo=val1 bar=2} ERR "$err_path'variant/6.0 foo=val1 bar=2'" |
| 80 |
testouterr_cmd_re sh {whatis variant/6.0} OK {} |
| 81 |
|
| 82 |
# test @loaded version specifier |
| 83 |
setenv_var TESTSUITE_VARIANT 3 |
| 84 |
setenv_loaded_module [list variant/6.0] [list $mp/variant/6.0] |
| 85 |
setenv_var __MODULES_LMVARIANT {variant/6.0&foo|val3|0|0&bar|2|0|0} |
| 86 |
set tserr "$modlin $mpre $modlin |
| 87 |
\\s+variant/6.0: variant/6.0 -" |
| 88 |
testouterr_cmd_re sh {whatis variant@loaded} OK $tserr |
| 89 |
testouterr_cmd_re sh {whatis variant@loaded bar=1} OK $tserr |
| 90 |
unsetenv_loaded_module |
| 91 |
unsetenv_var __MODULES_LMVARIANT |
| 92 |
|
| 93 |
# specified variants taken into account (module returned if match) |
| 94 |
setenv_var TESTSUITE_VARIANT 1 |
| 95 |
set tserr "$modlin $mpre $modlin\n\\s+variant/6.0: variant/6.0" |
| 96 |
testouterr_cmd_re sh {whatis [email protected] foo=val1 baz=2} ERR "$err_path'[email protected] foo=val1 baz=2'" |
| 97 |
testouterr_cmd_re sh {whatis [email protected] baz=2} ERR "$err_path'[email protected] baz=2'" |
| 98 |
testouterr_cmd_re sh {whatis [email protected] foo=val4} ERR "$err_path'[email protected] foo=val4'" |
| 99 |
testouterr_cmd_re sh {whatis [email protected] foo=val1 bar=2} OK $tserr |
| 100 |
testouterr_cmd_re sh {whatis [email protected] foo=val1} OK $tserr |
| 101 |
testouterr_cmd_re sh {whatis [email protected] bar=2} OK $tserr |
| 102 |
# no module name/version, but variant specified |
| 103 |
testouterr_cmd_re sh {whatis foo=val3 bar=3} OK $tserr |
| 104 |
|
| 105 |
# shortcut variant specification |
| 106 |
setenv_var MODULES_VARIANT_SHORTCUT foo=% |
| 107 |
set tserr "$modlin $mpre $modlin\n\\s+variant/6.0: variant/6.0" |
| 108 |
testouterr_cmd_re sh {whatis [email protected] %val1 baz=2} ERR "$err_path'[email protected] %val1 baz=2'" |
| 109 |
testouterr_cmd_re sh {whatis [email protected] %val1 bar=2} OK $tserr |
| 110 |
testouterr_cmd_re sh {whatis [email protected] %val2} OK $tserr |
| 111 |
# no module name/version, but variant specified |
| 112 |
testouterr_cmd_re sh {whatis %val3 bar=3} OK $tserr |
| 113 |
unsetenv_var MODULES_VARIANT_SHORTCUT |
| 114 |
|
| 115 |
# boolean variant |
| 116 |
testouterr_cmd sh {whatis [email protected] -foo +bar} ERR "$err_path'[email protected] -foo +bar'" |
| 117 |
setenv_var TESTSUITE_VARIANT bool1 |
| 118 |
set tserr "$modlin $mpre $modlin\n\\s+variant/6.0: variant/6.0" |
| 119 |
testouterr_cmd_re sh {whatis [email protected] -foo +bar} OK $tserr |
| 120 |
testouterr_cmd_re sh {whatis [email protected] ~foo} OK $tserr |
| 121 |
testouterr_cmd_re sh {whatis [email protected] +bar} OK $tserr |
| 122 |
# no module name/version, but variant specified |
| 123 |
testouterr_cmd_re sh {whatis ~bar} OK $tserr |
| 124 |
|
| 125 |
# free value variant |
| 126 |
setenv_var TESTSUITE_VARIANT free3 |
| 127 |
set tserr "$modlin $mpre $modlin\n\\s+variant/6.0: variant/6.0" |
| 128 |
testouterr_cmd_re sh {whatis variant/6.0 foo=val1} OK $tserr |
| 129 |
testouterr_cmd_re sh {whatis variant/6.0 foo=no} OK $tserr |
| 130 |
# no module name/version, but variant specified |
| 131 |
testouterr_cmd_re sh {whatis foo=anything} OK $tserr |
| 132 |
unsetenv_var TESTSUITE_VARIANT |
| 133 |
|
| 134 |
# when advanced_version_spec is disabled, variant spec are considered as modulefile spec |
| 135 |
setenv_var MODULES_ADVANCED_VERSION_SPEC 0 |
| 136 |
setenv_var TESTSUITE_VARIANT 1 |
| 137 |
set tserr "$modlin $mpre $modlin\n\\s+var=val: var=val\n\\s+variant/6.0: variant/6.0" |
| 138 |
testouterr_cmd_re sh {whatis variant/6.0 var=val} OK $tserr |
| 139 |
|
| 140 |
|
| 141 |
# |
| 142 |
# Cleanup |
| 143 |
# |
| 144 |
|
| 145 |
reset_test_env |