Debian Codegraph @

testsuite/modules.10-use/032-prepend.exp

raw
1 ##############################################################################
2 # Modules Revision 3.0
3 # Providing a flexible user environment
4 #
5 # File: modules.10-use/%M%
6 # Revision: %I%
7 # First Edition: 2017/05/27
8 # Last Mod.: %U%, %G%
9 #
10 # Authors: Xavier Delaruelle, [email protected]
11 #
12 # Description: Testuite testsequence
13 # Command: use --prepend
14 # Sub-Command:
15 #
16 # Comment: %C{
17 # Check prepending a new path to the current lists of
18 # module paths.
19 # }C%
20 #
21 ##############################################################################
22
23 skip_if_quick_mode
24
25 #
26 # Variables for this test
27 #
28
29 set path "$modpath.2"
30 set badpath "$modpath.bad"
31 set mod_path "$path:$modpath"
32 set loaded_path "$modpath"
33
34 set use "use --prepend"
35
36 #
37 # The tests ...
38 #
39
40 lappend ans [list set MODULEPATH $mod_path]
41 test_cmd_re "ALL" "$use $path" $ans
42
43 #
44 # test if use non-existent modulefile directory
45 #
46
47 set ans [list]
48 lappend ans [list set MODULEPATH $badpath:$modpath]
49 testouterr_cmd_re "ALL" "$use $badpath" $ans {}
50
51 #
52 # test with uninitialized MODULEPATH
53 #
54
55 unsetenv_path_var MODULEPATH
56
57 set ans [list]
58 lappend ans [list set MODULEPATH $path]
59 test_cmd_re "ALL" "$use $path" $ans
60
61 setenv_path_var MODULEPATH $modpath
62
63 #
64 # test with already loaded path
65 # re-export (C version does no modification)
66 #
67 set ans [list]
68 lappend ans [list set MODULEPATH $loaded_path]
69 test_cmd "ALL" "$use $loaded_path" $ans
70
71
72 #
73 # Test usage of variable reference
74 #
75
76 set ans [list]
77 lappend ans [list set MODULEPATH \$TESTSUITEDIR/modulefiles.2:$modpath]
78 testouterr_cmd "sh" "$use \$TESTSUITEDIR/modulefiles.2" $ans {}
79
80 setenv_path_var MODULEPATH \$TESTSUITEDIR/modulefiles.2 $modpath
81 testouterr_cmd "sh" "$use \$TESTSUITEDIR/modulefiles.2" $ans {}
82
83 set ans [list]
84 lappend ans [list set MODULEPATH $env(TESTSUITEDIR)/modulefiles.2:\$TESTSUITEDIR/modulefiles.2:$modpath]
85 testouterr_cmd "sh" "$use $env(TESTSUITEDIR)/modulefiles.2" $ans {}
86
87 setenv_path_var MODULEPATH $env(TESTSUITEDIR)/modulefiles.2 $modpath
88 set ans [list]
89 lappend ans [list set MODULEPATH \$TESTSUITEDIR/modulefiles.2:$env(TESTSUITEDIR)/modulefiles.2:$modpath]
90 testouterr_cmd "sh" "$use \$TESTSUITEDIR/modulefiles.2" $ans {}
91
92 setenv_path_var MODULEPATH $modpath
93
94
95 # test overriding options
96 set ans [list]
97 lappend ans [list set MODULEPATH $path:$modpath]
98 testouterr_cmd sh "use -a -p $path" $ans {}
99
100
101 #
102 # Cleanup
103 #
104
105 reset_test_env