Debian Codegraph @

testsuite/modules.50-cmds/402-source-sh-ignore.exp

raw
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: 2024/02/10
8 # Last Mod.: %U%, %G%
9 #
10 # Authors: Xavier Delaruelle, [email protected]
11 #
12 # Description: Testuite testsequence
13 # Command:
14 # Modulefiles: source-sh
15 # Sub-Command: *
16 #
17 # Comment: %C{
18 # Check '--ignore' option of 'source-sh' modulefile command
19 # }C%
20 #
21 ##############################################################################
22
23 set mp $modpath.4
24 set mpre [regsub -all "\(\[.+?\]\)" $mp {\\\1}]
25
26 # setup specific environment
27 setenv_path_var MODULEPATH $mp
28
29 if {[cmpversion $tclsh_version 8.6] == -1} {
30 set custom_error_trace " invoked from within
31 \"if \{\[info exists env(TESTSUITE_SOURCE_SH)\]\} \{
32 switch -- \$env(TESTSUITE_SOURCE_SH) \{
33 ignore_bad1 \{
34 source-sh --ignore alias
35 ...\""
36 } else {
37 set custom_error_trace {}
38 }
39
40
41 #
42 # simple test
43 #
44
45 setenv_var TESTSUITE_SOURCE_SH ignore2
46
47 set ans [list]
48 lappend ans [list set _LMFILES_ $mp/source-sh/1]
49 lappend ans [list set LOADEDMODULES source-sh/1]
50 lappend ans [list set __MODULES_LMSOURCESH source-sh/1\&bash\ testsuite/example/sh-to-mod.sh\ arg1\|chdir\ $modpath.2\|complete\ bash\ cmd\ \{\}\|complete\ bash\ mycmd\ \{\}\|complete\ bash\ othercmd\ \{\}\|prepend-path\ FOOPATH\ /path/to/dir1\ /path/to/dir2\ /path/to/dir3\|prepend-path\ FOOPATHCB\ /path/to/dir1\ /path/to/d\\\{r2\ /path/to/dir3\|prepend-path\ FOOPATHEM\ \{\}\ /path/to/dir1\ /path/to/dir2\ /path/to/dir3\|prepend-path\ FOOPATHWC\ /path/to/dir1\ /path/to/d\*r2\ /path/to/dir3\|setenv\ FOO\ value\|setenv\ FOOARG1\ arg1\|setenv\ FOOCB\ va\\\{ue\|setenv\ FOOEM\ \{\}\|setenv\ FOOPATHSP\ \{/path/to/dir1\ /path/to/dir2\ /path/to/dir3\}\|setenv\ FOOPATHSPEM\ \{/path/to/dir1\ /path/to/dir2\ /path/to/dir3\ \}\|setenv\ FOOSP\ \{value\ \}\|setenv\ FOOWC\ va\*ue]
51 lappend ans [list set FOOPATHEM :/path/to/dir1:/path/to/dir2:/path/to/dir3]
52 lappend ans [list set FOOPATHSP {/path/to/dir1 /path/to/dir2 /path/to/dir3}]
53 lappend ans [list set FOOPATHCB /path/to/dir1:/path/to/d\{r2:/path/to/dir3]
54 lappend ans [list set FOOEM {}]
55 lappend ans [list set FOOARG1 {arg1}]
56 lappend ans [list set FOOSP {value }]
57 lappend ans [list set FOOPATH /path/to/dir1:/path/to/dir2:/path/to/dir3]
58 lappend ans [list set FOOCB va\{ue]
59 lappend ans [list set __MODULES_SHARE_FOOPATHEM :1]
60 lappend ans [list set FOOPATHWC /path/to/dir1:/path/to/d\*r2:/path/to/dir3]
61 lappend ans [list set FOO value]
62 lappend ans [list set __MODULES_LMREFRESH source-sh/1]
63 lappend ans [list set FOOWC va\*ue]
64 lappend ans [list set FOOPATHSPEM {/path/to/dir1 /path/to/dir2 /path/to/dir3 }]
65 lappend ans [list out {complete -o default -F _cmd cmd;}]
66 lappend ans [list out {complete -u othercmd;}]
67 lappend ans [list out {complete -j -P '"%' -S '"' mycmd;}]
68 lappend ans [list chdir $modpath.2]
69 testouterr_cmd bash {load source-sh/1} $ans {}
70
71 set tserr "$modlin $mpre $modlin
72 \\s*source-sh/1: source-sh/1"
73 testouterr_cmd_re bash {whatis source-sh/1} OK $tserr
74
75 set tserr "-------------------------------------------------------------------
76 $mp/source-sh/1:
77
78 chdir\t\t$modpath.2
79 complete\tbash cmd {-o default -F _cmd}
80 complete\tbash mycmd {-j -P '\"%' -S '\"'}
81 complete\tbash othercmd -u
82 prepend-path\tFOOPATH /path/to/dir1 /path/to/dir2 /path/to/dir3
83 prepend-path\tFOOPATHCB /path/to/dir1 /path/to/d\{r2 /path/to/dir3
84 prepend-path\tFOOPATHEM {} /path/to/dir1 /path/to/dir2 /path/to/dir3
85 prepend-path\tFOOPATHWC /path/to/dir1 /path/to/d\*r2 /path/to/dir3
86 setenv\t\tFOO value
87 setenv\t\tFOOARG1 arg1
88 setenv\t\tFOOCB va\{ue
89 setenv\t\tFOOEM {}
90 setenv\t\tFOOPATHSP {/path/to/dir1 /path/to/dir2 /path/to/dir3}
91 setenv\t\tFOOPATHSPEM {/path/to/dir1 /path/to/dir2 /path/to/dir3 }
92 setenv\t\tFOOSP {value }
93 setenv\t\tFOOWC va*ue
94 module-whatis\tsource-sh/1
95 -------------------------------------------------------------------"
96 testouterr_cmd bash {display source-sh/1} OK $tserr
97
98 skip_if_quick_mode
99
100 setenv_loaded_module [list source-sh/1] [list $mp/source-sh/1]
101 setenv_var __MODULES_LMREFRESH source-sh/1
102 setenv_var __MODULES_LMSOURCESH source-sh/1\&bash\ testsuite/example/sh-to-mod.sh\ arg1\|chdir\ $modpath.2\|complete\ bash\ cmd\ \{\}\|complete\ bash\ mycmd\ \{\}\|complete\ bash\ othercmd\ \{\}\|prepend-path\ FOOPATH\ /path/to/dir1\ /path/to/dir2\ /path/to/dir3\|prepend-path\ FOOPATHCB\ /path/to/dir1\ /path/to/d\\\{r2\ /path/to/dir3\|prepend-path\ FOOPATHEM\ \{\}\ /path/to/dir1\ /path/to/dir2\ /path/to/dir3\|prepend-path\ FOOPATHWC\ /path/to/dir1\ /path/to/d\*r2\ /path/to/dir3\|setenv\ FOO\ value\|setenv\ FOOARG1\ arg1\|setenv\ FOOCB\ va\\\{ue\|setenv\ FOOEM\ \{\}\|setenv\ FOOPATHSP\ \{/path/to/dir1\ /path/to/dir2\ /path/to/dir3\}\|setenv\ FOOPATHSPEM\ \{/path/to/dir1\ /path/to/dir2\ /path/to/dir3\ \}\|setenv\ FOOSP\ \{value\ \}\|setenv\ FOOWC\ va\*ue
103 setenv_path_var FOOPATHEM {} /path/to/dir1 /path/to/dir2 /path/to/dir3
104 setenv_path_var FOOPATHCB /path/to/dir1:/path/to/d\{r2:/path/to/dir3
105 setenv_path_var FOOPATHWC /path/to/dir1:/path/to/d\*r2:/path/to/dir3
106 setenv_path_var FOOPATH /path/to/dir1:/path/to/dir2:/path/to/dir3
107 setenv_var FOOPATHSP {/path/to/dir1 /path/to/dir2 /path/to/dir3}
108 setenv_var FOOEM {}
109 setenv_var FOOARG1 {arg1}
110 setenv_var FOOSP {value }
111 setenv_var FOOCB va\{ue
112 setenv_var FOOWC va\*ue
113 setenv_var FOO value
114 setenv_var FOOPATHSPEM {/path/to/dir1 /path/to/dir2 /path/to/dir3 }
115
116 testouterr_cmd bash {display source-sh/1} OK $tserr
117
118 # unload (same content as set when loaded)
119 set ans [list]
120 lappend ans [list unset _LMFILES_]
121 lappend ans [list unset LOADEDMODULES]
122 lappend ans [list unset __MODULES_LMSOURCESH]
123 lappend ans [list unset FOOPATHEM]
124 lappend ans [list unset FOOPATHSP]
125 lappend ans [list unset FOOPATHCB]
126 lappend ans [list unset FOOEM]
127 lappend ans [list unset FOOARG1]
128 lappend ans [list unset FOOSP]
129 lappend ans [list unset FOOPATH]
130 lappend ans [list unset FOOCB]
131 lappend ans [list unset __MODULES_SHARE_FOOPATHEM]
132 lappend ans [list unset FOOPATHWC]
133 lappend ans [list unset FOO]
134 lappend ans [list unset __MODULES_LMREFRESH]
135 lappend ans [list unset FOOWC]
136 lappend ans [list unset FOOPATHSPEM]
137 lappend ans [list out {complete -r cmd;}]
138 lappend ans [list out {complete -r othercmd;}]
139 lappend ans [list out {complete -r mycmd;}]
140 testouterr_cmd bash {unload source-sh/1} $ans {}
141
142 # unload (different content as set when loaded)
143 setenv_var __MODULES_LMSOURCESH source-sh/1\&bash\ testsuite/example/sh-to-mod.sh\ arg1\|chdir\ $modpath.2\|complete\ bash\ cmd\ \{\}\|complete\ bash\ mycmd\ \{\}\|complete\ bash\ othercmd\ \{\}\|prepend-path\ FOOPATH\ /path/to/dir1\ /path/to/dir2\ /path/to/dir3\|prepend-path\ FOOPATHCB\ /path/to/dir1\ /path/to/d\\\{r2\ /path/to/dir3\|prepend-path\ FOOPATHEM\ \{\}\ /path/to/dir1\ /path/to/dir2\ /path/to/dir3\|prepend-path\ FOOPATHWC\ /path/to/dir1\ /path/to/d\*r2\ /path/to/dir3\|set-alias\ alfoo\ \{\}\|setenv\ FOOARG1\ arg2\|setenv\ FOOCB\ va\\\{ue\|setenv\ FOOEM\ \{\}\|setenv\ FOOPATHSP\ \{/path/to/dir1\ /path/to/dir2\ /path/to/dir3\}\|setenv\ FOOPATHSPEM\ \{/path/to/dir1\ /path/to/dir2\ /path/to/dir3\ \}\|setenv\ FOOSP\ \{value\ \}\|setenv\ FOOWC\ va\*ue
144 set ans [list]
145 lappend ans [list unset _LMFILES_]
146 lappend ans [list unset LOADEDMODULES]
147 lappend ans [list unset __MODULES_LMSOURCESH]
148 lappend ans [list unset FOOPATHEM]
149 lappend ans [list unset FOOPATHSP]
150 lappend ans [list unset FOOPATHCB]
151 lappend ans [list unset FOOEM]
152 lappend ans [list unset FOOARG1]
153 lappend ans [list unset FOOSP]
154 lappend ans [list unset FOOPATH]
155 lappend ans [list unset FOOCB]
156 lappend ans [list unset __MODULES_SHARE_FOOPATHEM]
157 lappend ans [list unset FOOPATHWC]
158 lappend ans [list unset __MODULES_LMREFRESH]
159 lappend ans [list unset FOOPATHSPEM]
160 lappend ans [list unset FOOWC]
161 lappend ans [list unalias alfoo]
162 lappend ans [list out {complete -r cmd;}]
163 lappend ans [list out {complete -r othercmd;}]
164 lappend ans [list out {complete -r mycmd;}]
165 testouterr_cmd bash {unload source-sh/1} $ans {}
166
167 # display (different content as set when loaded)
168 set tserr "-------------------------------------------------------------------
169 $mp/source-sh/1:
170
171 chdir\t\t$modpath.2
172 complete\tbash cmd {-o default -F _cmd}
173 complete\tbash mycmd {-j -P '\"%' -S '\"'}
174 complete\tbash othercmd -u
175 prepend-path\tFOOPATH /path/to/dir1 /path/to/dir2 /path/to/dir3
176 prepend-path\tFOOPATHCB /path/to/dir1 /path/to/d\{r2 /path/to/dir3
177 prepend-path\tFOOPATHEM {} /path/to/dir1 /path/to/dir2 /path/to/dir3
178 prepend-path\tFOOPATHWC /path/to/dir1 /path/to/d\*r2 /path/to/dir3
179 set-alias\talfoo {}
180 setenv\t\tFOOARG1 arg2
181 setenv\t\tFOOCB va\{ue
182 setenv\t\tFOOEM {}
183 setenv\t\tFOOPATHSP {/path/to/dir1 /path/to/dir2 /path/to/dir3}
184 setenv\t\tFOOPATHSPEM {/path/to/dir1 /path/to/dir2 /path/to/dir3 }
185 setenv\t\tFOOSP {value }
186 setenv\t\tFOOWC va*ue
187 module-whatis\tsource-sh/1
188 -------------------------------------------------------------------"
189 testouterr_cmd bash {display source-sh/1} OK $tserr
190
191 set tserr "$modlin $mpre $modlin
192 \\s*source-sh/1: source-sh/1"
193 testouterr_cmd_re bash {whatis source-sh/1} OK $tserr
194
195 unsetenv_loaded_module
196 unsetenv_var __MODULES_LMREFRESH
197 unsetenv_var __MODULES_LMSOURCESH
198 unsetenv_path_var FOOPATHEM
199 unsetenv_path_var FOOPATHCB
200 unsetenv_path_var FOOPATHWC
201 unsetenv_path_var FOOPATH
202 unsetenv_var FOOPATHSP
203 unsetenv_var FOOEM
204 unsetenv_var FOOARG1
205 unsetenv_var FOOSP
206 unsetenv_var FOOCB
207 unsetenv_var FOOWC
208 unsetenv_var FOO
209 unsetenv_var FOOPATHSPEM
210
211
212 #
213 # issues
214 #
215
216 setenv_var TESTSUITE_SOURCE_SH ignore_bad1
217
218 set line_num [expr {[cmpversion $tclsh_version 8.6] == -1 ? 2 : 5}]
219 set tserr [msg_load source-sh/1 [msg_moderr {wrong # args: should be "source-sh ?--ignore? ?eltlist? shell script ?arg ...?"} {source-sh --ignore alias} $mp/source-sh/1 $line_num {} {} {} $custom_error_trace]]
220 testouterr_cmd bash {load source-sh/1} ERR $tserr
221
222 setenv_var TESTSUITE_SOURCE_SH ignore_bad2
223
224 set line_num [expr {[cmpversion $tclsh_version 8.6] == -1 ? 2 : 8}]
225 set tserr [msg_load source-sh/1 [msg_moderr {Missing value for '--ignore' option} {source-sh --ignore} $mp/source-sh/1 $line_num {} {} {} $custom_error_trace]]
226 testouterr_cmd bash {load source-sh/1} ERR $tserr
227
228 setenv_loaded_module [list source-sh/1] [list $mp/source-sh/1]
229 set tserr [msg_unload source-sh/1 [msg_moderr {Missing value for '--ignore' option} {source-sh --ignore} $mp/source-sh/1 $line_num {} {} {} $custom_error_trace]]
230 testouterr_cmd bash {unload source-sh/1} ERR $tserr
231 unsetenv_loaded_module
232
233 set tserr "-------------------------------------------------------------------
234 $mp/source-sh/1:
235
236 [msg_moderr {Missing value for '--ignore' option} {source-sh --ignore} $mp/source-sh/1 $line_num { } {} {} $custom_error_trace]
237 -------------------------------------------------------------------"
238 testouterr_cmd bash {display source-sh/1} ERR $tserr
239
240 set tserr "$modlin $mpre $modlin
241 \\s*source-sh/1: source-sh/1"
242 testouterr_cmd_re bash {whatis source-sh/1} OK $tserr
243
244 setenv_var TESTSUITE_SOURCE_SH ignore_bad3
245
246 set line_num [expr {[cmpversion $tclsh_version 8.6] == -1 ? 2 : 11}]
247 set tserr [msg_load source-sh/1 [msg_moderr {Invalid ignored element 'bash'} {source-sh --ignore bash testsuite/example/sh-to-mod.sh arg1} $mp/source-sh/1 $line_num {} {} {} $custom_error_trace]]
248 testouterr_cmd bash {load source-sh/1} ERR $tserr
249
250 setenv_var TESTSUITE_SOURCE_SH ignore_bad4
251
252 set line_num [expr {[cmpversion $tclsh_version 8.6] == -1 ? 2 : 14}]
253 set tserr [msg_load source-sh/1 [msg_moderr {Invalid ignored element 'foo'} {source-sh --ignore {foo} bash testsuite/example/sh-to-mod.sh arg1} $mp/source-sh/1 $line_num {} {} {} $custom_error_trace]]
254 testouterr_cmd bash {load source-sh/1} ERR $tserr
255
256 setenv_var TESTSUITE_SOURCE_SH ignore_bad5
257
258 set line_num [expr {[cmpversion $tclsh_version 8.6] == -1 ? 2 : 17}]
259 set tserr [msg_load source-sh/1 [msg_moderr {Invalid ignored element 'foo'} {source-sh --ignore alias:foo bash testsuite/example/sh-to-mod.sh arg1} $mp/source-sh/1 $line_num {} {} {} $custom_error_trace]]
260 testouterr_cmd bash {load source-sh/1} ERR $tserr
261
262 setenv_var TESTSUITE_SOURCE_SH ignore_bad6
263
264 set line_num [expr {[cmpversion $tclsh_version 8.6] == -1 ? 2 : 20}]
265 set tserr [msg_load source-sh/1 [msg_moderr {Invalid ignored element 'foo'} {source-sh --ignore foo:bar bash testsuite/example/sh-to-mod.sh arg1} $mp/source-sh/1 $line_num {} {} {} $custom_error_trace]]
266 testouterr_cmd bash {load source-sh/1} ERR $tserr
267
268 setenv_var TESTSUITE_SOURCE_SH ignore_bad7
269
270 set line_num [expr {[cmpversion $tclsh_version 8.6] == -1 ? 2 : 23}]
271 set tserr [msg_load source-sh/1 [msg_moderr {Invalid ignored element 'alias function'} {source-sh --ignore {alias function} bash testsuite/example/sh-to-mod.sh arg1} $mp/source-sh/1 $line_num {} {} {} $custom_error_trace]]
272 testouterr_cmd bash {load source-sh/1} ERR $tserr
273
274 setenv_var TESTSUITE_SOURCE_SH ignore_bad8
275
276 set line_num [expr {[cmpversion $tclsh_version 8.6] == -1 ? 2 : 26}]
277 set tserr [msg_load source-sh/1 [msg_moderr {Invalid option '--foo'} {source-sh --foo bash testsuite/example/sh-to-mod.sh arg1} $mp/source-sh/1 $line_num {} {} {} $custom_error_trace]]
278 testouterr_cmd bash {load source-sh/1} ERR $tserr
279
280 setenv_var TESTSUITE_SOURCE_SH ignore_bad9
281
282 set line_num [expr {[cmpversion $tclsh_version 8.6] == -1 ? 2 : 29}]
283 set tserr [msg_load source-sh/1 [msg_moderr {wrong # args: should be "source-sh ?--ignore? ?eltlist? shell script ?arg ...?"} {source-sh --ignore alias bash} $mp/source-sh/1 $line_num {} {} {} $custom_error_trace]]
284 testouterr_cmd bash {load source-sh/1} ERR $tserr
285
286 setenv_var TESTSUITE_SOURCE_SH ignore_pos1
287
288 set line_num [expr {[cmpversion $tclsh_version 8.6] == -1 ? 2 : 32}]
289 set tserr [msg_load source-sh/1 [msg_moderr {Script '--ignore' cannot be found} {source-sh bash --ignore envvar:chdir testsuite/example/sh-to-mod.sh} $mp/source-sh/1 $line_num {} {} {} $custom_error_trace]]
290 testouterr_cmd bash {load source-sh/1} ERR $tserr
291
292 setenv_var TESTSUITE_SOURCE_SH ignore_pos2
293
294 set ans [list]
295 lappend ans [list set _LMFILES_ $mp/source-sh/1]
296 lappend ans [list set LOADEDMODULES source-sh/1]
297 lappend ans [list set __MODULES_LMSOURCESH source-sh/1\&bash\ testsuite/example/sh-to-mod.sh\ --ignore\ complete\|chdir\ $modpath.2\|complete\ bash\ cmd\ \{\}\|complete\ bash\ mycmd\ \{\}\|complete\ bash\ othercmd\ \{\}\|prepend-path\ FOOPATH\ /path/to/dir1\ /path/to/dir2\ /path/to/dir3\|prepend-path\ FOOPATHCB\ /path/to/dir1\ /path/to/d\\\{r2\ /path/to/dir3\|prepend-path\ FOOPATHEM\ \{\}\ /path/to/dir1\ /path/to/dir2\ /path/to/dir3\|prepend-path\ FOOPATHWC\ /path/to/dir1\ /path/to/d\*r2\ /path/to/dir3\|set-alias\ alcb\ \{\}\|set-alias\ alem\ \{\}\|set-alias\ alfoo\ \{\}\|set-alias\ alsp\ \{\}\|set-function\ funccb\ \{\}\|set-function\ funcfoo\ \{\}\|set-function\ funcnl\ \{\}\|set-function\ funcsp\ \{\}\|set-function\ funcwc\ \{\}\|setenv\ FOO\ value\|setenv\ FOOARG1\ --ignore\|setenv\ FOOARG2\ complete\|setenv\ FOOCB\ va\\\{ue\|setenv\ FOOEM\ \{\}\|setenv\ FOOPATHSP\ \{/path/to/dir1\ /path/to/dir2\ /path/to/dir3\}\|setenv\ FOOPATHSPEM\ \{/path/to/dir1\ /path/to/dir2\ /path/to/dir3\ \}\|setenv\ FOOSP\ \{value\ \}\|setenv\ FOOWC\ va\*ue]
298 lappend ans [list set FOOPATHEM :/path/to/dir1:/path/to/dir2:/path/to/dir3]
299 lappend ans [list set FOOPATHSP {/path/to/dir1 /path/to/dir2 /path/to/dir3}]
300 lappend ans [list set FOOPATHCB /path/to/dir1:/path/to/d\{r2:/path/to/dir3]
301 lappend ans [list set FOOEM {}]
302 lappend ans [list set FOOSP {value }]
303 lappend ans [list set FOOARG1 {--ignore}]
304 lappend ans [list set FOOARG2 {complete}]
305 lappend ans [list set FOOPATH /path/to/dir1:/path/to/dir2:/path/to/dir3]
306 lappend ans [list set FOOCB va\{ue]
307 lappend ans [list set __MODULES_SHARE_FOOPATHEM :1]
308 lappend ans [list set FOOPATHWC /path/to/dir1:/path/to/d\*r2:/path/to/dir3]
309 lappend ans [list set FOO value]
310 lappend ans [list set __MODULES_LMREFRESH source-sh/1]
311 lappend ans [list set FOOWC va\*ue]
312 lappend ans [list set FOOPATHSPEM {/path/to/dir1 /path/to/dir2 /path/to/dir3 }]
313 lappend ans [list alias alsp {echo f\"o; echo b\\\"r; echo f\'o}]
314 lappend ans [list alias alfoo {echo $(grep "report .Modules " ../../modulecmd.tcl | tr -d \\ 2>/dev/null | awk '{print $3}')}]
315 lappend ans [list alias alcb echo\ f\{o]
316 lappend ans [list alias alem {}]
317 lappend ans [list funcfoo "() { echo foo; }; export -f funcfoo;"]
318 lappend ans [list funccb "() { echo f\{o; }; export -f funccb;"]
319 lappend ans [list funcwc "() { echo sou*sh; }; export -f funcwc;"]
320 lappend ans [list funcnl "() { echo foo;
321 echo bar; }; export -f funcnl;"]
322 lappend ans [list funcsp "() { echo f\\\"o;
323 echo b\\\\\\\"r;
324 echo f\\'o; }; export -f funcsp;"]
325 lappend ans [list out {complete -o default -F _cmd cmd;}]
326 lappend ans [list out {complete -u othercmd;}]
327 lappend ans [list out {complete -j -P '"%' -S '"' mycmd;}]
328 lappend ans [list chdir $modpath.2]
329 testouterr_cmd bash {load source-sh/1} $ans {}
330
331
332 #
333 # additional tests
334 #
335
336 setenv_var TESTSUITE_SOURCE_SH ignore_empty1
337
338 set ans [list]
339 lappend ans [list set _LMFILES_ $mp/source-sh/1]
340 lappend ans [list set LOADEDMODULES source-sh/1]
341 lappend ans [list set __MODULES_LMSOURCESH source-sh/1\&bash\ testsuite/example/sh-to-mod.sh\ arg1\|chdir\ $modpath.2\|complete\ bash\ cmd\ \{\}\|complete\ bash\ mycmd\ \{\}\|complete\ bash\ othercmd\ \{\}\|prepend-path\ FOOPATH\ /path/to/dir1\ /path/to/dir2\ /path/to/dir3\|prepend-path\ FOOPATHCB\ /path/to/dir1\ /path/to/d\\\{r2\ /path/to/dir3\|prepend-path\ FOOPATHEM\ \{\}\ /path/to/dir1\ /path/to/dir2\ /path/to/dir3\|prepend-path\ FOOPATHWC\ /path/to/dir1\ /path/to/d\*r2\ /path/to/dir3\|set-alias\ alcb\ \{\}\|set-alias\ alem\ \{\}\|set-alias\ alfoo\ \{\}\|set-alias\ alsp\ \{\}\|set-function\ funccb\ \{\}\|set-function\ funcfoo\ \{\}\|set-function\ funcnl\ \{\}\|set-function\ funcsp\ \{\}\|set-function\ funcwc\ \{\}\|setenv\ FOO\ value\|setenv\ FOOARG1\ arg1\|setenv\ FOOCB\ va\\\{ue\|setenv\ FOOEM\ \{\}\|setenv\ FOOPATHSP\ \{/path/to/dir1\ /path/to/dir2\ /path/to/dir3\}\|setenv\ FOOPATHSPEM\ \{/path/to/dir1\ /path/to/dir2\ /path/to/dir3\ \}\|setenv\ FOOSP\ \{value\ \}\|setenv\ FOOWC\ va\*ue]
342 lappend ans [list set FOOPATHEM :/path/to/dir1:/path/to/dir2:/path/to/dir3]
343 lappend ans [list set FOOPATHSP {/path/to/dir1 /path/to/dir2 /path/to/dir3}]
344 lappend ans [list set FOOPATHCB /path/to/dir1:/path/to/d\{r2:/path/to/dir3]
345 lappend ans [list set FOOEM {}]
346 lappend ans [list set FOOARG1 {arg1}]
347 lappend ans [list set FOOSP {value }]
348 lappend ans [list set FOOPATH /path/to/dir1:/path/to/dir2:/path/to/dir3]
349 lappend ans [list set FOOCB va\{ue]
350 lappend ans [list set __MODULES_SHARE_FOOPATHEM :1]
351 lappend ans [list set FOOPATHWC /path/to/dir1:/path/to/d\*r2:/path/to/dir3]
352 lappend ans [list set FOO value]
353 lappend ans [list set __MODULES_LMREFRESH source-sh/1]
354 lappend ans [list set FOOWC va\*ue]
355 lappend ans [list set FOOPATHSPEM {/path/to/dir1 /path/to/dir2 /path/to/dir3 }]
356 lappend ans [list alias alsp {echo f\"o; echo b\\\"r; echo f\'o}]
357 lappend ans [list alias alfoo {echo $(grep "report .Modules " ../../modulecmd.tcl | tr -d \\ 2>/dev/null | awk '{print $3}')}]
358 lappend ans [list alias alcb echo\ f\{o]
359 lappend ans [list alias alem {}]
360 lappend ans [list funcfoo "() { echo foo; }; export -f funcfoo;"]
361 lappend ans [list funccb "() { echo f\{o; }; export -f funccb;"]
362 lappend ans [list funcwc "() { echo sou*sh; }; export -f funcwc;"]
363 lappend ans [list funcnl "() { echo foo;
364 echo bar; }; export -f funcnl;"]
365 lappend ans [list funcsp "() { echo f\\\"o;
366 echo b\\\\\\\"r;
367 echo f\\'o; }; export -f funcsp;"]
368 lappend ans [list out {complete -o default -F _cmd cmd;}]
369 lappend ans [list out {complete -u othercmd;}]
370 lappend ans [list out {complete -j -P '"%' -S '"' mycmd;}]
371 lappend ans [list chdir $modpath.2]
372 testouterr_cmd bash {load source-sh/1} $ans {}
373
374
375 setenv_var TESTSUITE_SOURCE_SH ignore1
376
377 set ans [list]
378 lappend ans [list set _LMFILES_ $mp/source-sh/1]
379 lappend ans [list set LOADEDMODULES source-sh/1]
380 lappend ans [list set __MODULES_LMSOURCESH source-sh/1\&bash\ testsuite/example/sh-to-mod.sh\|chdir\ $modpath.2\|complete\ bash\ cmd\ \{\}\|complete\ bash\ mycmd\ \{\}\|complete\ bash\ othercmd\ \{\}\|prepend-path\ FOOPATH\ /path/to/dir1\ /path/to/dir2\ /path/to/dir3\|prepend-path\ FOOPATHCB\ /path/to/dir1\ /path/to/d\\\{r2\ /path/to/dir3\|prepend-path\ FOOPATHEM\ \{\}\ /path/to/dir1\ /path/to/dir2\ /path/to/dir3\|prepend-path\ FOOPATHWC\ /path/to/dir1\ /path/to/d\*r2\ /path/to/dir3\|set-function\ funccb\ \{\}\|set-function\ funcfoo\ \{\}\|set-function\ funcnl\ \{\}\|set-function\ funcsp\ \{\}\|set-function\ funcwc\ \{\}\|setenv\ FOO\ value\|setenv\ FOOCB\ va\\\{ue\|setenv\ FOOEM\ \{\}\|setenv\ FOOPATHSP\ \{/path/to/dir1\ /path/to/dir2\ /path/to/dir3\}\|setenv\ FOOPATHSPEM\ \{/path/to/dir1\ /path/to/dir2\ /path/to/dir3\ \}\|setenv\ FOOSP\ \{value\ \}\|setenv\ FOOWC\ va\*ue]
381 lappend ans [list set FOOPATHEM :/path/to/dir1:/path/to/dir2:/path/to/dir3]
382 lappend ans [list set FOOPATHSP {/path/to/dir1 /path/to/dir2 /path/to/dir3}]
383 lappend ans [list set FOOPATHCB /path/to/dir1:/path/to/d\{r2:/path/to/dir3]
384 lappend ans [list set FOOEM {}]
385 lappend ans [list set FOOSP {value }]
386 lappend ans [list set FOOPATH /path/to/dir1:/path/to/dir2:/path/to/dir3]
387 lappend ans [list set FOOCB va\{ue]
388 lappend ans [list set __MODULES_SHARE_FOOPATHEM :1]
389 lappend ans [list set FOOPATHWC /path/to/dir1:/path/to/d\*r2:/path/to/dir3]
390 lappend ans [list set FOO value]
391 lappend ans [list set __MODULES_LMREFRESH source-sh/1]
392 lappend ans [list set FOOPATHSPEM {/path/to/dir1 /path/to/dir2 /path/to/dir3 }]
393 lappend ans [list set FOOWC va\*ue]
394 lappend ans [list funcfoo "() { echo foo; }; export -f funcfoo;"]
395 lappend ans [list funccb "() { echo f\{o; }; export -f funccb;"]
396 lappend ans [list funcwc "() { echo sou*sh; }; export -f funcwc;"]
397 lappend ans [list funcnl "() { echo foo;
398 echo bar; }; export -f funcnl;"]
399 lappend ans [list funcsp "() { echo f\\\"o;
400 echo b\\\\\\\"r;
401 echo f\\'o; }; export -f funcsp;"]
402 lappend ans [list out {complete -o default -F _cmd cmd;}]
403 lappend ans [list out {complete -u othercmd;}]
404 lappend ans [list out {complete -j -P '"%' -S '"' mycmd;}]
405 lappend ans [list chdir $modpath.2]
406 testouterr_cmd bash {load source-sh/1} $ans {}
407
408
409 setenv_var TESTSUITE_SOURCE_SH ignore3
410
411 set ans [list]
412 lappend ans [list set __MODULES_LMREFRESH source-sh/1]
413 lappend ans [list set _LMFILES_ $mp/source-sh/1]
414 lappend ans [list set LOADEDMODULES source-sh/1]
415 lappend ans [list set __MODULES_LMSOURCESH source-sh/1\&bash\ testsuite/example/sh-to-mod.sh\|complete\ bash\ cmd\ \{\}\|complete\ bash\ mycmd\ \{\}\|complete\ bash\ othercmd\ \{\}\|set-alias\ alcb\ \{\}\|set-alias\ alem\ \{\}\|set-alias\ alfoo\ \{\}\|set-alias\ alsp\ \{\}\|set-function\ funccb\ \{\}\|set-function\ funcfoo\ \{\}\|set-function\ funcnl\ \{\}\|set-function\ funcsp\ \{\}\|set-function\ funcwc\ \{\}]
416 lappend ans [list alias alsp {echo f\"o; echo b\\\"r; echo f\'o}]
417 lappend ans [list alias alfoo {echo $(grep "report .Modules " ../../modulecmd.tcl | tr -d \\ 2>/dev/null | awk '{print $3}')}]
418 lappend ans [list alias alcb echo\ f\{o]
419 lappend ans [list alias alem {}]
420 lappend ans [list funcfoo "() { echo foo; }; export -f funcfoo;"]
421 lappend ans [list funccb "() { echo f\{o; }; export -f funccb;"]
422 lappend ans [list funcwc "() { echo sou*sh; }; export -f funcwc;"]
423 lappend ans [list funcnl "() { echo foo;
424 echo bar; }; export -f funcnl;"]
425 lappend ans [list funcsp "() { echo f\\\"o;
426 echo b\\\\\\\"r;
427 echo f\\'o; }; export -f funcsp;"]
428 lappend ans [list out {complete -o default -F _cmd cmd;}]
429 lappend ans [list out {complete -u othercmd;}]
430 lappend ans [list out {complete -j -P '"%' -S '"' mycmd;}]
431 testouterr_cmd bash {load source-sh/1} $ans {}
432
433
434 setenv_var TESTSUITE_SOURCE_SH ignore4
435
436 set ans [list]
437 lappend ans [list set _LMFILES_ $mp/source-sh/1]
438 lappend ans [list set LOADEDMODULES source-sh/1]
439 lappend ans [list set __MODULES_LMSOURCESH source-sh/1\&bash\ testsuite/example/sh-to-mod.sh\|chdir\ $modpath.2\|prepend-path\ FOOPATH\ /path/to/dir1\ /path/to/dir2\ /path/to/dir3\|prepend-path\ FOOPATHCB\ /path/to/dir1\ /path/to/d\\\{r2\ /path/to/dir3\|prepend-path\ FOOPATHEM\ \{\}\ /path/to/dir1\ /path/to/dir2\ /path/to/dir3\|prepend-path\ FOOPATHWC\ /path/to/dir1\ /path/to/d\*r2\ /path/to/dir3\|set-alias\ alcb\ \{\}\|set-alias\ alem\ \{\}\|set-alias\ alfoo\ \{\}\|set-alias\ alsp\ \{\}\|set-function\ funccb\ \{\}\|set-function\ funcfoo\ \{\}\|set-function\ funcnl\ \{\}\|set-function\ funcsp\ \{\}\|set-function\ funcwc\ \{\}\|setenv\ FOO\ value\|setenv\ FOOCB\ va\\\{ue\|setenv\ FOOEM\ \{\}\|setenv\ FOOPATHSP\ \{/path/to/dir1\ /path/to/dir2\ /path/to/dir3\}\|setenv\ FOOPATHSPEM\ \{/path/to/dir1\ /path/to/dir2\ /path/to/dir3\ \}\|setenv\ FOOSP\ \{value\ \}\|setenv\ FOOWC\ va\*ue]
440 lappend ans [list set FOOPATHEM :/path/to/dir1:/path/to/dir2:/path/to/dir3]
441 lappend ans [list set FOOPATHSP {/path/to/dir1 /path/to/dir2 /path/to/dir3}]
442 lappend ans [list set FOOPATHCB /path/to/dir1:/path/to/d\{r2:/path/to/dir3]
443 lappend ans [list set FOOEM {}]
444 lappend ans [list set FOOSP {value }]
445 lappend ans [list set FOOPATH /path/to/dir1:/path/to/dir2:/path/to/dir3]
446 lappend ans [list set FOOCB va\{ue]
447 lappend ans [list set __MODULES_SHARE_FOOPATHEM :1]
448 lappend ans [list set FOOPATHWC /path/to/dir1:/path/to/d\*r2:/path/to/dir3]
449 lappend ans [list set FOO value]
450 lappend ans [list set __MODULES_LMREFRESH source-sh/1]
451 lappend ans [list set FOOPATHSPEM {/path/to/dir1 /path/to/dir2 /path/to/dir3 }]
452 lappend ans [list set FOOWC va\*ue]
453 lappend ans [list alias alsp {echo f\"o; echo b\\\"r; echo f\'o}]
454 lappend ans [list alias alfoo {echo $(grep "report .Modules " ../../modulecmd.tcl | tr -d \\ 2>/dev/null | awk '{print $3}')}]
455 lappend ans [list alias alcb echo\ f\{o]
456 lappend ans [list alias alem {}]
457 lappend ans [list funcfoo "() { echo foo; }; export -f funcfoo;"]
458 lappend ans [list funccb "() { echo f\{o; }; export -f funccb;"]
459 lappend ans [list funcwc "() { echo sou*sh; }; export -f funcwc;"]
460 lappend ans [list funcnl "() { echo foo;
461 echo bar; }; export -f funcnl;"]
462 lappend ans [list funcsp "() { echo f\\\"o;
463 echo b\\\\\\\"r;
464 echo f\\'o; }; export -f funcsp;"]
465 lappend ans [list chdir $modpath.2]
466 testouterr_cmd bash {load source-sh/1} $ans {}
467
468
469 setenv_var TESTSUITE_SOURCE_SH ignore5
470
471 set ans [list]
472 lappend ans [list set _LMFILES_ $mp/source-sh/1]
473 lappend ans [list set LOADEDMODULES source-sh/1]
474 lappend ans [list set __MODULES_LMSOURCESH source-sh/1\&bash\ testsuite/example/sh-to-mod.sh\|chdir\ $modpath.2]
475 lappend ans [list chdir $modpath.2]
476 testouterr_cmd bash {load source-sh/1} $ans {}
477
478
479 setenv_var TESTSUITE_SOURCE_SH ignore6
480
481 set ans [list]
482 lappend ans [list set _LMFILES_ $mp/source-sh/1]
483 lappend ans [list set LOADEDMODULES source-sh/1]
484 lappend ans [list set __MODULES_LMSOURCESH source-sh/1\&bash\ testsuite/example/sh-to-mod.sh]
485 testouterr_cmd bash {load source-sh/1} $ans {}
486
487 setenv_loaded_module [list source-sh/1] [list $mp/source-sh/1]
488 setenv_var __MODULES_LMSOURCESH source-sh/1\&bash\ testsuite/example/sh-to-mod.sh
489 set ans [list]
490 lappend ans [list unset _LMFILES_]
491 lappend ans [list unset LOADEDMODULES]
492 lappend ans [list unset __MODULES_LMSOURCESH]
493 testouterr_cmd bash {unload source-sh/1} $ans {}
494
495 unsetenv_var __MODULES_LMSOURCESH
496 unsetenv_loaded_module
497
498
499 #
500 # Cleanup
501 #
502
503 reset_test_env