Debian Codegraph @

testsuite/modules.20-locate/150-lmod-hide.exp

raw
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: 2024/02/22
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: avail
16 #
17 # Comment: %C{
18 # Check hide-modulefile and hide-version modulefile commands
19 # }C%
20 #
21 ##############################################################################
22
23 skip_if_quick_mode
24
25 set mp $modpath.4
26 set mpre $modpathre.4
27
28 # setup specific environment
29 setenv_path_var MODULEPATH $mp
30
31 # ensure avail tests are made using in depth mode
32 setenv_var MODULES_AVAIL_INDEPTH 1
33
34 # ensure regular avail search match is set for these tests
35 setenv_var MODULES_SEARCH_MATCH starts_with
36
37
38 if {[cmpversion $tclsh_version 8.6] == -1} {
39 set custom " invoked from within
40 \"if \{\[info exists env(TESTSUITE_HIDE)\]\} \{
41 switch -- \$env(TESTSUITE_HIDE) \{
42 hide_modulefile_bad1 \{
43 hide-modulefile
44 \}
45 ...\""
46 } else {
47 set custom {}
48 }
49
50
51 #
52 # hide-modulefile
53 #
54
55 setenv_var TESTSUITE_HIDE hide_modulefile_bad1
56
57 set tserr $mp:\nhide/1
58 testouterr_cmd sh {avail -t hide/1} OK $tserr
59
60 set ans [list]
61 lappend ans [list set _LMFILES_ $mp/hide/1]
62 lappend ans [list set LOADEDMODULES hide/1]
63 lappend ans [list ERR]
64 set line_num [expr {[cmpversion $tclsh_version 8.6] == -1 ? 2 : 5}]
65 set tserr [msg_moderr {wrong # args: should be "hide-modulefile modfile"} {hide-modulefile} $mp/hide/.modulerc $line_num { } {} {} $custom {invoked from within}]
66 testouterr_cmd sh {load hide/1} $ans $tserr
67
68
69 setenv_var TESTSUITE_HIDE hide_modulefile_bad2
70
71 set tserr $mp:\nhide/1
72 testouterr_cmd sh {avail -t hide/1} OK $tserr
73
74 set ans [list]
75 lappend ans [list set _LMFILES_ $mp/hide/1]
76 lappend ans [list set LOADEDMODULES hide/1]
77 lappend ans [list ERR]
78 set line_num [expr {[cmpversion $tclsh_version 8.6] == -1 ? 2 : 8}]
79 set tserr [msg_moderr {wrong # args: should be "hide-modulefile modfile"} {hide-modulefile path1 path2} $mp/hide/.modulerc $line_num { } {} {} $custom {invoked from within}]
80 testouterr_cmd sh {load hide/1} $ans $tserr
81
82
83 setenv_var TESTSUITE_HIDE hide_modulefile1
84
85 set tserr "$mp:\nhide/2"
86 testouterr_cmd sh {avail -t hide} OK $tserr
87
88
89 setenv_var TESTSUITE_HIDE hide_modulefile2
90
91 set tserr "$mp:\nhide/2"
92 testouterr_cmd sh {avail -t hide} OK $tserr
93
94
95 setenv_var TESTSUITE_HIDE hide_modulefile3
96
97 set tserr "$mp:\nhide/2"
98 testouterr_cmd sh {avail -t hide} OK {}
99
100
101 setenv_var TESTSUITE_HIDE hide_modulefile4
102
103 set tserr "$mp:\nhide/1\nhide/2"
104 testouterr_cmd sh {avail -t hide} OK $tserr
105
106
107 #
108 # hide-version
109 #
110
111 setenv_var TESTSUITE_HIDE hide_version_bad1
112
113 set tserr $mp:\nhide/1
114 testouterr_cmd sh {avail -t hide/1} OK $tserr
115
116 set ans [list]
117 lappend ans [list set _LMFILES_ $mp/hide/1]
118 lappend ans [list set LOADEDMODULES hide/1]
119 lappend ans [list ERR]
120 set line_num [expr {[cmpversion $tclsh_version 8.6] == -1 ? 2 : 23}]
121 set tserr [msg_moderr {wrong # args: should be "hide-version modfile"} {hide-version} $mp/hide/.modulerc $line_num { } {} {} $custom {invoked from within}]
122 testouterr_cmd sh {load hide/1} $ans $tserr
123
124
125 setenv_var TESTSUITE_HIDE hide_version_bad2
126
127 set tserr $mp:\nhide/1
128 testouterr_cmd sh {avail -t hide/1} OK $tserr
129
130 set ans [list]
131 lappend ans [list set _LMFILES_ $mp/hide/1]
132 lappend ans [list set LOADEDMODULES hide/1]
133 lappend ans [list ERR]
134 set line_num [expr {[cmpversion $tclsh_version 8.6] == -1 ? 2 : 26}]
135 set tserr [msg_moderr {wrong # args: should be "hide-version modfile"} {hide-version path1 path2} $mp/hide/.modulerc $line_num { } {} {} $custom {invoked from within}]
136 testouterr_cmd sh {load hide/1} $ans $tserr
137
138
139 setenv_var TESTSUITE_HIDE hide_version1
140
141 set tserr "$mp:\nhide/2"
142 testouterr_cmd sh {avail -t hide} OK $tserr
143
144
145 setenv_var TESTSUITE_HIDE hide_version2
146
147 set tserr "$mp:\nhide/2"
148 testouterr_cmd sh {avail -t hide} OK $tserr
149
150
151 setenv_var TESTSUITE_HIDE hide_version3
152
153 set tserr "$mp:\nhide/2"
154 testouterr_cmd sh {avail -t hide} OK {}
155
156
157 setenv_var TESTSUITE_HIDE hide_version4
158
159 set tserr "$mp:\nhide/1\nhide/2"
160 testouterr_cmd sh {avail -t hide} OK $tserr
161
162
163 #
164 # Cleanup
165 #
166
167 reset_test_env