| 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: 2018/10/21 |
| 8 |
# Last Mod.: %U%, %G% |
| 9 |
# |
| 10 |
# Authors: Xavier Delaruelle, [email protected] |
| 11 |
# |
| 12 |
# Description: Testuite testsequence |
| 13 |
# Command: display, avail |
| 14 |
# Modulefiles: use, user |
| 15 |
# Sub-Command: |
| 16 |
# |
| 17 |
# Comment: %C{ |
| 18 |
# Modulefile find cache tests |
| 19 |
# }C% |
| 20 |
# |
| 21 |
############################################################################## |
| 22 |
|
| 23 |
skip_if_quick_mode |
| 24 |
|
| 25 |
# skip tests if implicit_default option could not be overridden |
| 26 |
if {[is_config_locked implicit_default]} { |
| 27 |
send_user "\tskipping tests as implicit_default could not be overridden\n" |
| 28 |
} else { |
| 29 |
|
| 30 |
# ignore prebuilt cache file as it changes expected debug output |
| 31 |
ignore_modulecache_if_built |
| 32 |
|
| 33 |
# ensure avail tests are made using in depth mode |
| 34 |
setenv_var MODULES_AVAIL_INDEPTH 1 |
| 35 |
|
| 36 |
# ensure avail tests have implicit default enabled |
| 37 |
setenv_var MODULES_IMPLICIT_DEFAULT 1 |
| 38 |
|
| 39 |
# ensure regular avail search match is set for these tests |
| 40 |
setenv_var MODULES_SEARCH_MATCH starts_with |
| 41 |
|
| 42 |
# ensure auto symbolic versions are not set for these tests |
| 43 |
setenv_var MODULES_ADVANCED_VERSION_SPEC 0 |
| 44 |
|
| 45 |
set mp $modpath.memcache |
| 46 |
set mpre $modpathre.memcache |
| 47 |
|
| 48 |
# setup specific environment |
| 49 |
setenv_path_var MODULEPATH $mp |
| 50 |
|
| 51 |
# check correct result is obtained on display |
| 52 |
set tsdisp "$mpre/foo/2:\n\nsetenv\t\tts ok" |
| 53 |
set tserr $modlin\n$tsdisp\n$modlin\n$tsdisp\n$modlin |
| 54 |
testouterr_cmd_re sh {display foo foo} OK $tserr |
| 55 |
|
| 56 |
# check correct result is obtained on avail |
| 57 |
set tsav $mpre:\nfoo/1\nfoo/2\nfoo1/1\nfoo1/2 |
| 58 |
set tserr $tsav |
| 59 |
testouterr_cmd_re sh {avail -t foo foo} OK $tserr |
| 60 |
|
| 61 |
# verify if cache is taken into account on display |
| 62 |
set tserr "(.*)+ |
| 63 |
DEBUG findModules: finding 'foo' in $mpre .* |
| 64 |
(.*)+ |
| 65 |
DEBUG findModules: create cache entry .* |
| 66 |
(.*)+ |
| 67 |
DEBUG getModules: create cache entry .* |
| 68 |
(.*)+ |
| 69 |
DEBUG getModules: use cache entry .* |
| 70 |
(.*)+" |
| 71 |
testouterr_cmd_re sh {display -D foo foo} OK $tserr |
| 72 |
|
| 73 |
# verify if cache is taken into account on avail |
| 74 |
set tserr "(.*)+ |
| 75 |
DEBUG findModules: finding 'foo\\*' in $mpre .* |
| 76 |
(.*)+ |
| 77 |
DEBUG findModules: create cache entry .* |
| 78 |
(.*)+ |
| 79 |
DEBUG getModules: create cache entry .* |
| 80 |
(.*)+ |
| 81 |
DEBUG getModules: use cache entry .* |
| 82 |
(.*)+" |
| 83 |
testouterr_cmd_re sh {avail -D -t foo foo} OK $tserr |
| 84 |
|
| 85 |
# test situations where cache should or should not be reused depending |
| 86 |
# on consecutive similar queries |
| 87 |
|
| 88 |
set tserr "(.*)+ |
| 89 |
DEBUG \\\[#1:load:look/1\\\] findModules: finding 'foo1\\*' in $mpre .* |
| 90 |
DEBUG \\\[#1:load:look/1\\\] findModules: found foo1\\S* foo1\\S* |
| 91 |
DEBUG \\\[#1:load:look/1\\\] findModules: create cache entry .* |
| 92 |
(.*)+ |
| 93 |
foo1/1 foo1/2 |
| 94 |
(.*)+ |
| 95 |
DEBUG \\\[#1:load:look/1\\\] findModules: finding 'foo\\*' in $mpre .* |
| 96 |
DEBUG \\\[#1:load:look/1\\\] findModules: found foo\\S* foo\\S* foo\\S* foo\\S* |
| 97 |
DEBUG \\\[#1:load:look/1\\\] findModules: create cache entry .* |
| 98 |
(.*)+ |
| 99 |
foo/1 foo/2 foo1/1 foo1/2 |
| 100 |
(.*)+" |
| 101 |
testerr_cmd_re sh {load -D look/1} $tserr |
| 102 |
|
| 103 |
set tserr "(.*)+ |
| 104 |
DEBUG \\\[#1:load:look/2\\\] findModules: finding 'foo\\*' in $mpre .* |
| 105 |
DEBUG \\\[#1:load:look/2\\\] findModules: found foo\\S* foo\\S* foo\\S* foo\\S* |
| 106 |
DEBUG \\\[#1:load:look/2\\\] findModules: create cache entry .* |
| 107 |
(.*)+ |
| 108 |
foo/1 foo/2 foo1/1 foo1/2 |
| 109 |
(.*)+ |
| 110 |
DEBUG \\\[#1:load:look/2\\\] findModules: finding 'foo1\\*' in $mpre .* |
| 111 |
DEBUG \\\[#1:load:look/2\\\] findModules: use cache entry .* |
| 112 |
(.*)+ |
| 113 |
foo1/1 foo1/2 |
| 114 |
(.*)+ |
| 115 |
Get modules: {foo1/1 foo1/2} matching 'foo1' in.* |
| 116 |
(.*)+" |
| 117 |
testerr_cmd_re sh {load -D look/2} $tserr |
| 118 |
|
| 119 |
set tserr "(.*)+ |
| 120 |
DEBUG \\\[#1:load:look/3\\\] findModules: finding '\\*' in $mpre .* |
| 121 |
(.*)+ |
| 122 |
DEBUG \\\[#1:load:look/3\\\] findModules: create cache entry .* |
| 123 |
(.*)+ |
| 124 |
DEBUG \\\[#1:load:look/3\\\] findModules: finding 'f\\*' in $mpre .* |
| 125 |
DEBUG \\\[#1:load:look/3\\\] findModules: use cache entry .* |
| 126 |
(.*)+ |
| 127 |
foo/1 foo/2 foo1/1 foo1/2 |
| 128 |
(.*)+ |
| 129 |
Get modules: {foo\\S* foo\\S* foo\\S* foo\\S*} matching 'f' in.* |
| 130 |
(.*)+" |
| 131 |
testerr_cmd_re sh {load -D look/3} $tserr |
| 132 |
|
| 133 |
set tserr "(.*)+ |
| 134 |
DEBUG \\\[#1:load:look/4\\\] findModules: finding 'f\\*' in $mpre .* |
| 135 |
DEBUG \\\[#1:load:look/4\\\] findModules: found foo\\S* foo\\S* foo\\S* foo\\S* |
| 136 |
DEBUG \\\[#1:load:look/4\\\] findModules: create cache entry .* |
| 137 |
(.*)+ |
| 138 |
foo/1 foo/2 foo1/1 foo1/2 |
| 139 |
(.*)+ |
| 140 |
DEBUG \\\[#1:load:look/4\\\] findModules: finding '\\*' in $mpre .* |
| 141 |
(.*)+ |
| 142 |
DEBUG \\\[#1:load:look/4\\\] findModules: create cache entry .* |
| 143 |
(.*)+" |
| 144 |
testerr_cmd_re sh {load -D look/4} $tserr |
| 145 |
|
| 146 |
set tserr "(.*)+ |
| 147 |
DEBUG \\\[#1:load:look/5\\\] findModules: finding 'foo1' in $mpre .* |
| 148 |
DEBUG \\\[#1:load:look/5\\\] findModules: found foo1\\S* foo1\\S* |
| 149 |
DEBUG \\\[#1:load:look/5\\\] findModules: create cache entry .* |
| 150 |
(.*)+ |
| 151 |
DEBUG \\\[#1:load:look/5\\\] findModules: finding 'foo' in $mpre .* |
| 152 |
DEBUG \\\[#1:load:look/5\\\] findModules: found foo\\S* foo\\S* |
| 153 |
DEBUG \\\[#1:load:look/5\\\] findModules: create cache entry .* |
| 154 |
(.*)+" |
| 155 |
testerr_cmd_re sh {load -D look/5} $tserr |
| 156 |
|
| 157 |
set tserr "(.*)+ |
| 158 |
DEBUG \\\[#1:load:look/6\\\] findModules: finding 'foo' in $mpre .* |
| 159 |
DEBUG \\\[#1:load:look/6\\\] findModules: found foo\\S* foo\\S* |
| 160 |
DEBUG \\\[#1:load:look/6\\\] findModules: create cache entry .* |
| 161 |
(.*)+ |
| 162 |
DEBUG \\\[#1:load:look/6\\\] findModules: finding 'foo1' in $mpre .* |
| 163 |
DEBUG \\\[#1:load:look/6\\\] findModules: found foo1\\S* foo1\\S* |
| 164 |
DEBUG \\\[#1:load:look/6\\\] findModules: create cache entry .* |
| 165 |
(.*)+" |
| 166 |
testerr_cmd_re sh {load -D look/6} $tserr |
| 167 |
|
| 168 |
set tserr "(.*)+ |
| 169 |
DEBUG \\\[#1:load:look/7\\\] findModules: finding '\\*' in $mpre .* |
| 170 |
(.*)+ |
| 171 |
DEBUG \\\[#1:load:look/7\\\] findModules: create cache entry .* |
| 172 |
(.*)+ |
| 173 |
DEBUG \\\[#1:load:look/7\\\] findModules: finding 'foo' in $mpre .* |
| 174 |
DEBUG \\\[#1:load:look/7\\\] findModules: use cache entry .* |
| 175 |
(.*)+ |
| 176 |
Get modules: {foo foo/1 foo/2} matching 'foo' in.* |
| 177 |
(.*)+" |
| 178 |
testerr_cmd_re sh {load -D look/7} $tserr |
| 179 |
|
| 180 |
# test with a modulename containing space and other special chars |
| 181 |
set tserr "(.*)+ |
| 182 |
DEBUG \\\[#1:load:look/8\\\] findModules: finding 'sp cial\\*' in $mpre .* |
| 183 |
(.*)+ |
| 184 |
DEBUG \\\[#1:load:look/8\\\] findModules: create cache entry .* |
| 185 |
(.*)+ |
| 186 |
DEBUG \\\[#1:load:look/8\\\] getModules: use cache entry .* |
| 187 |
(.*)+ |
| 188 |
'sp cial/1' |
| 189 |
(.*)+ |
| 190 |
Get modules: {{sp cial/1}} matching '{sp cial}' in.* |
| 191 |
(.*)+" |
| 192 |
testerr_cmd_re sh {load -D look/8} $tserr |
| 193 |
|
| 194 |
|
| 195 |
# |
| 196 |
# Cleanup |
| 197 |
# |
| 198 |
|
| 199 |
reset_test_env |
| 200 |
|
| 201 |
} |