Debian Codegraph @

testsuite/modules.70-maint/030-purge.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: 1995/12/06
8 # Last Mod.: %U%, %G%
9 #
10 # Authors: Jens Hamisch, [email protected]
11 #
12 # Description: Testuite testsequence
13 # Command: purge
14 # Modulefiles: setenv/1.0
15 # Sub-Command:
16 #
17 # Comment: %C{
18 # Tests the module command 'purge'
19 # }C%
20 #
21 ##############################################################################
22
23 #
24 # Variables. This test forces a module load command. It will result in the
25 # environment variables "_LMFILES_", "LOADEDMODULES" and "testsuite" to
26 # be set up
27 #
28
29 set module "setenv/1.0"
30 set modulefile "$modpath/$module"
31
32 #
33 # Check this only for the /bin/csh
34 #
35
36 lappend ans [list unset _LMFILES_]
37 lappend ans [list unset LOADEDMODULES]
38 lappend ans [list unset testsuite]
39
40 #
41 # Set up the environment pointing to the single module file being load
42 #
43
44 setenv_loaded_module $module $modulefile
45
46 #
47 # The tests
48 #
49
50 test_cmd "csh" "purge" $ans
51
52 # command nickname tests
53 test_cmd "csh" "pu" $ans
54
55 skip_if_quick_mode
56
57
58 # setup LOADEDMODULES/_LMFILES_ with an empty element
59 setenv_loaded_module [list {} $module] [list {} $modulefile]
60
61 set ans [list]
62 # empty elements are ignored but stick to the variable, they should be removed
63 lappend ans [list set _LMFILES_ ""]
64 lappend ans [list set LOADEDMODULES ""]
65 lappend ans [list unset testsuite]
66
67 test_cmd "sh" "purge" $ans
68
69 # restore LOADEDMODULES/_LMFILES_
70 setenv_loaded_module $module $modulefile
71
72
73 #
74 # purge when loaded environment is inconsistent
75 #
76
77 setenv_loaded_module [list foo bar] "/path/to/foo"
78
79 testouterr_cmd_re "sh" "purge" "ERR" "$err_loinconsist\n LOADEDMODULES=foo bar\n _LMFILES_=/path/to/foo"
80
81
82 #
83 # Cleanup
84 #
85
86 reset_test_env