Debian Codegraph @

testsuite/modules.50-cmds/039-unsetenv-env.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: 2018/04/15
8 # Last Mod.: %U%, %G%
9 #
10 # Authors: Xavier Delaruelle, [email protected]
11 #
12 # Description: Testuite testsequence
13 # Command: load, unload, display, help, test
14 # Modulefiles: unsetenv/0.6
15 # Sub-Command:
16 #
17 # Comment: %C{
18 # Check the effect of 'unsetenv' command on $env() array
19 # variable through the different modulefile evaluation mode
20 # }C%
21 #
22 ##############################################################################
23
24 skip_if_quick_mode
25
26 set module "unsetenv/0.6"
27 set modulefile "$modpath/$module"
28 set modulefilere "$modpathre/$module"
29
30 #
31 # test load mode
32 #
33
34 # test with value not set to variable prior to load
35 set ans [list]
36 lappend ans [list unset TS1]
37 lappend ans [list set TS2 ""]
38 lappend ans [list set _LMFILES_ $modulefile]
39 lappend ans [list set LOADEDMODULES $module]
40 testouterr_cmd "sh" "load $module" $ans ""
41
42 # test with value set to variable prior to load
43 setenv_var TS1 "no"
44 testouterr_cmd "sh" "load $module" $ans ""
45
46
47 #
48 # test unload mode
49 #
50
51 # test with module loaded but vanished env vars
52 unsetenv_path_var TS1
53 setenv_loaded_module $module $modulefile
54 set ans [list]
55 lappend ans [list unset TS2]
56 lappend ans [list unset _LMFILES_]
57 lappend ans [list unset LOADEDMODULES]
58 testouterr_cmd "sh" "unload $module" $ans ""
59
60 # test with value set to variable prior to unload
61 setenv_var TS1 "no"
62 testouterr_cmd "sh" "unload $module" $ans ""
63
64 # restore environment
65 unsetenv_loaded_module
66 unsetenv_path_var TS1
67
68
69 #
70 # test display mode
71 #
72
73 # test with value not set to variable prior to display
74 set tserr "$modlin
75 $modulefilere:
76
77 unsetenv\tTS1
78 setenv\t\tTS2 {}
79 $modlin"
80 testouterr_cmd_re "sh" "display $module" "" $tserr
81
82 # test with value set to variable prior to display
83 setenv_var TS1 "no"
84 testouterr_cmd_re "sh" "display $module" "" $tserr
85
86 # restore environment
87 unsetenv_path_var TS1
88
89
90 #
91 # test help mode
92 #
93
94 # test with value not set to variable prior to load
95 set tserr "$modlin
96 Module Specific Help for $modulefilere:
97
98 $warn_msgs: Unable to find ModulesHelp in $modulefilere.
99 $modlin"
100 testouterr_cmd_re "sh" "help $module" "" $tserr
101
102 # test with value set to variable prior to load
103 setenv_var TS1 "no"
104 testouterr_cmd_re "sh" "help $module" "" $tserr
105
106 # restore environment
107 unsetenv_path_var TS1
108
109
110 #
111 # test test mode
112 #
113
114 # test with value not set to variable prior to load
115 set tserr "$modlin
116 Module Specific Test for $modulefilere:
117
118 $warn_msgs: Unable to find ModulesTest in $modulefilere.
119 $modlin"
120 testouterr_cmd_re "sh" "test $module" "" $tserr
121
122 # test with value set to variable prior to load
123 setenv_var TS1 "no"
124 testouterr_cmd_re "sh" "test $module" "" $tserr
125
126 # restore environment
127 unsetenv_path_var TS1
128
129
130 #
131 # Cleanup
132 #
133
134 reset_test_env