Debian Codegraph @

testsuite/modules.70-maint/321-tag_abbrev.exp

raw
1 ##############################################################################
2 # Modules Revision 3.0
3 # Providing a flexible user environment
4 #
5 # File: modules.70-maint/%M%
6 # Revision: %I%
7 # First Edition: 2020/11/17
8 # Last Mod.: %U%, %G%
9 #
10 # Authors: Xavier Delaruelle, [email protected]
11 #
12 # Description: Testuite testsequence
13 # Command:
14 # Modulefiles: tag
15 # Sub-Command: load, unload, list
16 #
17 # Comment: %C{
18 # Test tag_abbrev mechanism
19 # }C%
20 #
21 ##############################################################################
22
23 set mp $modpath.3
24 set mpre [regsub -all "\(\[.+?\]\)" $mp {\\\1}]
25
26 # setup specific environment
27 setenv_path_var MODULEPATH $mp
28
29 # ensure advanced version specifiers are enabled as we use
30 # tag definition using this syntax
31 setenv_var MODULES_ADVANCED_VERSION_SPEC 1
32
33
34 # activate module-tag definitions over tag modulefiles
35 setenv_var TESTSUITE_MODULE_TAG_SET4 1
36
37 # abbrev applied on specific tag, no abbrev for loaded tag
38 setenv_var MODULES_TAG_ABBREV bar=B:foo=F
39 set tserr "$mp:
40 tag/5.0 <BaR:F>
41 tag/6.0 <BaR:F>
42 tag/7.0"
43 testouterr_cmd sh {avail -t tag@5:7} OK $tserr
44
45 skip_if_quick_mode
46
47 set ans [list]
48 lappend ans [list set _LMFILES_ $mp/tag/5.0]
49 lappend ans [list set LOADEDMODULES tag/5.0]
50 lappend ans [list set __MODULES_LMTAG tag/5.0&foo&BaR]
51 testouterr_cmd sh {load tag/5.0} $ans {}
52
53 # test module designation when loading
54 set tserr [msg_load {tag/5.0 <BaR:F>}]
55 testouterr_cmd sh {load -v tag/5.0} $ans $tserr
56
57 # test with tag/5.0 loaded
58 setenv_loaded_module [list tag/5.0] [list $mp/tag/5.0]
59 setenv_var __MODULES_LMTAG tag/5.0&foo&BaR
60 set tserr "$mp:
61 tag/5.0 <BaR:F:loaded>"
62 testouterr_cmd sh {avail -t tag/5.0} OK $tserr
63
64 testouterr_cmd sh {list} OK "$cur_loaded
65 1) tag/5.0 <BaR:F>
66
67 Key:
68 <module-tag> <F>=foo "
69
70
71 # abbrev set for loaded tag, abbrev set on an icase tag
72 setenv_var MODULES_TAG_ABBREV BaR=B:foo=F:loaded=aL
73
74 set tserr "$mp:
75 tag/5.0 <aL:B:F>"
76 testouterr_cmd sh {avail -t tag/5.0} OK $tserr
77
78 testouterr_cmd sh {list} OK "$cur_loaded
79 1) tag/5.0 <B:F>
80
81 Key:
82 <module-tag> <F>=foo <B>=BaR "
83
84
85 # abbrev disabled for custom and loaded tag
86 setenv_var MODULES_TAG_ABBREV BaR=B:foo=:loaded=
87
88 set tserr "$mp:
89 tag/5.0 <B>"
90 testouterr_cmd sh {avail -t tag/5.0} OK $tserr
91
92 testouterr_cmd sh {list} OK "$cur_loaded
93 1) tag/5.0 <B>
94
95 Key:
96 <module-tag> <B>=BaR "
97
98
99 # all abbrev disabled
100 setenv_var MODULES_TAG_ABBREV BaR=:foo=:loaded=
101
102 set tserr "$mp:
103 tag/5.0"
104 testouterr_cmd sh {avail -t tag/5.0} OK $tserr
105
106 testouterr_cmd sh {list} OK "$cur_loaded
107 1) tag/5.0 "
108
109
110 # all abbrev disabled with MODULES_TAG_ABBREV defined empty
111 setenv_var MODULES_TAG_ABBREV {}
112
113 set tserr "$mp:
114 tag/5.0 <BaR:foo:loaded>"
115 testouterr_cmd sh {avail -t tag/5.0} OK $tserr
116
117 testouterr_cmd sh {list} OK "$cur_loaded
118 1) tag/5.0 <BaR:foo>
119
120 Key:
121 <module-tag> "
122
123
124 # abbrev including space character
125 setenv_var MODULES_TAG_ABBREV {foo=f o:loaded= l:BaR:r }
126
127 set tserr "$mp:
128 tag/5.0 < l:f o:r >"
129 testouterr_cmd sh {avail -t tag/5.0} OK $tserr
130
131 testouterr_cmd sh {list} OK "$cur_loaded
132 1) tag/5.0 <f o:r >
133
134 Key:
135 <module-tag> <f o>=foo <r >=BaR "
136
137
138 # badly set MODULES_TAG_ABBREV
139 setenv_var MODULES_TAG_ABBREV {foo:loaded=L}
140
141 unsetenv_loaded_module
142 set tserr "$mp:
143 tag/5.0 <BaR:foo>"
144 testouterr_cmd sh {avail -t tag/5.0} OK $tserr
145
146 setenv_loaded_module [list tag/5.0] [list $mp/tag/5.0]
147 setenv_var __MODULES_LMTAG tag/5.0&foo&BaR
148 testouterr_cmd sh {list} OK "$warn_msgs: Ignore invalid value set in MODULES_TAG_ABBREV (foo:loaded=L)
149 $cur_loaded
150 1) tag/5.0 <BaR:foo>
151
152 Key:
153 <module-tag> "
154
155
156 # badly set MODULES_TAG_ABBREV (2)
157 setenv_var MODULES_TAG_ABBREV {:loaded=L}
158
159 unsetenv_loaded_module
160 set tserr "$mp:
161 tag/5.0 <BaR:foo>"
162 testouterr_cmd sh {avail -t tag/5.0} OK $tserr
163
164 setenv_loaded_module [list tag/5.0] [list $mp/tag/5.0]
165 setenv_var __MODULES_LMTAG tag/5.0&foo&BaR
166 testouterr_cmd sh {list} OK "$warn_msgs: Ignore invalid value set in MODULES_TAG_ABBREV (:loaded=L)
167 $cur_loaded
168 1) tag/5.0 <BaR:foo>
169
170 Key:
171 <module-tag> "
172
173
174 # check excepted siteconfig file is installed
175 set is_stderr_tty [siteconfig_isStderrTty]
176 if {$is_stderr_tty} {
177
178 setenv_var TESTSUITE_ENABLE_SITECONFIG_BADTAGABBREVDFLVALUE 1
179 unsetenv_var MODULES_TAG_ABBREV
180 testouterr_cmd sh {list} OK "$warn_msgs: Ignore invalid default value for 'tag_abbrev' config (loaded)
181 $cur_loaded
182 1) tag/5.0 <BaR:foo>
183
184 Key:
185 <module-tag> "
186
187 setenv_var MODULES_TAG_ABBREV {loaded=L}
188 testouterr_cmd sh {list} OK "$cur_loaded
189 1) tag/5.0 <BaR:foo>
190
191 Key:
192 <module-tag> "
193
194 setenv_var MODULES_TAG_ABBREV {:loaded=L}
195 testouterr_cmd sh {list} OK "$warn_msgs: Ignore invalid value set in MODULES_TAG_ABBREV (:loaded=L)
196 $warn_msgs: Ignore invalid default value for 'tag_abbrev' config (loaded)
197 $cur_loaded
198 1) tag/5.0 <BaR:foo>
199
200 Key:
201 <module-tag> "
202
203 unsetenv_var TESTSUITE_ENABLE_SITECONFIG_BADTAGABBREVDFLVALUE
204
205 }
206
207 unsetenv_var TESTSUITE_MODULE_TAG_SET4
208
209
210 #
211 # Cleanup
212 #
213
214 reset_test_env