File: 301-interp-command.exp

package info (click to toggle)
modules 5.6.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 23,036 kB
  • sloc: exp: 79,659; sh: 6,142; tcl: 5,900; makefile: 1,492; ansic: 474; python: 265; csh: 202; perl: 47; ruby: 44; lisp: 13
file content (180 lines) | stat: -rw-r--r-- 6,270 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
##############################################################################
#   Modules Revision 3.0
#   Providing a flexible user environment
#
#   File:		modules.50-cmds/%M%
#   Revision:		%I%
#   First Edition:	2017/06/20
#   Last Mod.:		%U%, %G%
#
#   Authors:		Xavier Delaruelle, xavier.delaruelle@cea.fr
#
#   Description:	Testuite testsequence
#   Command:		load, unload, switch, help, display, test, whatis
#   Modulefiles:	spread, spreadrc
#   Sub-Command:
#
#   Comment:	%C{
#			Tests how modulefile and modulerc interpreter let spread
#           variable, procedure and commands definitions from one
#           interpretation to another.
#		}C%
#
##############################################################################

skip_if_quick_mode

# ensure auto symbolic versions are not set for these tests
setenv_var MODULES_ADVANCED_VERSION_SPEC 0

set mod "spread"
set mod1 "$mod/3.0"
set mod2 "$mod/4.0"
set modfile1 "$modpath/$mod1"
set modfilere1 "$modpathre/$mod1"
set modfile2 "$modpath/$mod2"
set modfilere2 "$modpathre/$mod2"

# mod1 and mod2 are designed to output any incorrect behavior detected
# so when nothing is displayed it means test went as expected
set spreadres ""

set mod1disph "$modlin\n$modfilere1:\n"
set mod2disph "$modlin\n$modfilere2:\n"
set mod1dispres "$mod"

set mod1helph "$modlin\nModule Specific Help for $modfilere1:\n"
set mod2helph "$modlin\nModule Specific Help for $modfilere2:\n"
set mod1helpres "$mod"
set mod2helpres "$warn_msgs: Unable to find ModulesHelp in $modfilere2."

set mod1testh "$modlin\nModule Specific Test for $modfilere1:\n"
set mod2testh "$modlin\nModule Specific Test for $modfilere2:\n"
set mod1testres "$mod\nTest result: PASS"
set mod2testres "$warn_msgs: Unable to find ModulesTest in $modfilere2."

#
#  For sh shell only (no need to check every shells)
#

lappend ans [list set _LMFILES_ "$modfile1:$modfile2"]
lappend ans [list set LOADEDMODULES "$mod1:$mod2"]


#
#  The tests
#

testouterr_cmd_re "sh" "load $mod1 $mod2" $ans "$spreadres"
testouterr_cmd_re "sh" "display $mod1 $mod2" "OK" "$mod1disph\n$mod1dispres\n$mod2disph\n$spreadres$modlin"
testouterr_cmd_re "sh" "help $mod1 $mod2" "OK" "$mod1helph\n$mod1helpres\n$mod2helph\n$spreadres$mod2helpres\n$modlin"
testouterr_cmd_re "sh" "test $mod1 $mod2" "OK" "$mod1testh\n$mod1testres\n$mod2testh\n$spreadres$mod2testres\n$modlin"
# avail/whatis have already been tested in 300-interp

# tests looping on same modulefile
testouterr_cmd_re "sh" "display $mod1 $mod1" "OK" "$mod1disph\n$mod1dispres\n$mod1disph\n$spreadres$mod1dispres\n$modlin"
testouterr_cmd_re "sh" "help $mod1 $mod1" "OK" "$mod1helph\n$mod1helpres\n$mod1helph\n$spreadres$mod1helpres\n$modlin"
testouterr_cmd_re "sh" "test $mod1 $mod1" "OK" "$mod1testh\n$mod1testres\n$mod1testh\n$spreadres$mod1testres\n$modlin"

# Set up the environment for test that require mod1 to be loaded
setenv_loaded_module $mod1 $modfile1

# test switching
set ans [list]
lappend ans [list set _LMFILES_ $modfile2]
lappend ans [list set LOADEDMODULES $mod2]
testouterr_cmd_re "sh" "switch $mod1 $mod2" $ans "$spreadres"

# Set up the environment for test that require mod1 and mod2 to be loaded
setenv_loaded_module [list $mod1 $mod2] [list $modfile1 $modfile2]

testouterr_cmd "sh" "list -t" "OK" "$cur_loaded\n$mod1\n$mod2"
# test unloading
set ans [list]
lappend ans [list unset _LMFILES_]
lappend ans [list unset LOADEDMODULES]
testouterr_cmd_re "sh" "unload $mod1 $mod2" $ans "$spreadres"

# Clean up the environment
unsetenv_loaded_module


#
# Test spreading with modulerc and modulefile
#

set mod "spreadrc"
set mod1 "$mod/dir3/1.0"
set mod2 "$mod/dir4/1.0"
set modfile1 "$modpath/$mod1"
set modfilere1 "$modpathre/$mod1"
set modfile2 "$modpath/$mod2"
set modfilere2 "$modpathre/$mod2"

# mod1 and mod2 are designed to output any incorrect behavior detected
# so when nothing is displayed it means test went as expected
set spreadres ""

set mod1disph "$modlin\n$modfilere1:\n"
set mod2disph "$modlin\n$modfilere2:\n"
set mod1dispres "spreadmod"

set mod1helph "$modlin\nModule Specific Help for $modfilere1:\n"
set mod2helph "$modlin\nModule Specific Help for $modfilere2:\n"
set mod1helpres "spreadmod"
set mod2helpres "$warn_msgs: Unable to find ModulesHelp in $modfilere2."

set mod1testh "$modlin\nModule Specific Test for $modfilere1:\n"
set mod2testh "$modlin\nModule Specific Test for $modfilere2:\n"
set mod1testres "spreadmod\nTest result: PASS"
set mod2testres "$warn_msgs: Unable to find ModulesTest in $modfilere2."

#
#  For sh shell only (no need to check every shells)
#

set ans [list]
lappend ans [list set _LMFILES_ "$modfile1:$modfile2"]
lappend ans [list set LOADEDMODULES "$mod1:$mod2"]


#
#  The tests
#

testouterr_cmd_re "sh" "load $mod1 $mod2" $ans "$spreadres"
testouterr_cmd_re "sh" "display $mod1 $mod2" "OK" "$mod1disph\n$mod1dispres\n$mod2disph\n$spreadres$modlin"
testouterr_cmd_re "sh" "help $mod1 $mod2" "OK" "$mod1helph\n$mod1helpres\n$mod2helph\n$spreadres$mod2helpres\n$modlin"
testouterr_cmd_re "sh" "test $mod1 $mod2" "OK" "$mod1testh\n$mod1testres\n$mod2testh\n$spreadres$mod2testres\n$modlin"
# avail/whatis have already been tested in 300-interp

# tests looping on same modulefile
testouterr_cmd_re "sh" "display $mod1 $mod1" "OK" "$mod1disph\n$mod1dispres\n$mod1disph\n$spreadres$mod1dispres\n$modlin"
testouterr_cmd_re "sh" "help $mod1 $mod1" "OK" "$mod1helph\n$mod1helpres\n$mod1helph\n$spreadres$mod1helpres\n$modlin"
testouterr_cmd_re "sh" "test $mod1 $mod1" "OK" "$mod1testh\n$mod1testres\n$mod1testh\n$spreadres$mod1testres\n$modlin"

# Set up the environment for test that require mod1 to be loaded
setenv_loaded_module $mod1 $modfile1

# test switching
set ans [list]
lappend ans [list set _LMFILES_ $modfile2]
lappend ans [list set LOADEDMODULES $mod2]
testouterr_cmd_re "sh" "switch $mod1 $mod2" $ans "$spreadres"

# Set up the environment for test that require mod1 and mod2 to be loaded
setenv_loaded_module [list $mod1 $mod2] [list $modfile1 $modfile2]

testouterr_cmd "sh" "list -t" "OK" "$cur_loaded\n$mod1\n$mod2"
# test unloading
set ans [list]
lappend ans [list unset _LMFILES_]
lappend ans [list unset LOADEDMODULES]
testouterr_cmd_re "sh" "unload $mod1 $mod2" $ans "$spreadres"


#
#  Cleanup
#

reset_test_env