Debian Codegraph @

testsuite/install.00-init/024-ml.exp

raw
1 ##############################################################################
2 # Modules Revision 3.0
3 # Providing a flexible user environment
4 #
5 # File: modules.00-init/%M%
6 # Revision: %I%
7 # First Edition: 2019/11/29
8 # Last Mod.: %U%, %G%
9 #
10 # Authors: Xavier Delaruelle, [email protected]
11 #
12 # Description: Testuite testsequence
13 # Command:
14 # Sub-Command:
15 #
16 # Comment: %C{
17 # Check basic set of ml commands on all shells
18 # }C%
19 #
20 ##############################################################################
21
22
23 if {$install_ml ne {y}} {
24 send_user "\tSkipping ml command tests, as it is disabled\n"
25 } else {
26 set bad_cmd "$error_msgs: Unable to locate a modulefile for 'foo'"
27 set bad_cmd_re "(ml: )?$bad_cmd"
28
29 #
30 # The tests
31 #
32
33 if {$verbose} {
34 send_user "\tChecking basic set of ml commands\n"
35 }
36
37 foreach shell $shell_list {
38 testall_cmd_re "$shell" "ml --version" {} "Modules Release \\S+ (\\S+)" 0
39 testall_cmd "$shell" "ml foo" "" "$bad_cmd" 1
40 testall_cmd "$shell" "ml use $share_modpath\; ml purge\; ml null\; ml list -t" "" "$cur_loaded\nnull" 0
41 testall_cmd "$shell" "ml use $share_modpath\; ml purge\; ml null\; ml -null\; ml" "" "$no_loaded" 0
42 testall_cmd "$shell" "ml is-loaded unk" "" "" 1
43 testall_cmd "$shell" "ml use $share_modpath\; ml null\; ml is-loaded null" "" "" 0
44 testall_cmd "$shell" "ml info-loaded unk" "" "" 0
45 testall_cmd "$shell" "ml use $share_modpath\; ml load null\; ml info-loaded null" "null" "" 0
46 }
47
48 # ensure tools used in complex shell alias definition are available
49 if {[find_bin grep] ne "" && [find_bin tr] ne "" && [find_bin awk] ne ""} {
50 foreach shell $shell_list {
51 if {$shell eq {csh} || $shell eq {tcsh}} {
52 # alias evaluation leads to a syntax error if wa_277 is enabled
53 testall_cmd_re "$shell" "ml $testsuite_modpath/alias/3.0\; testsuite; ts2; ts3" [expr {$install_wa277 eq {y} ? {} : "Release\nhttp://an.example.web\\?&param=one\nselect\\\[type==BAR && osrel==FOO\\\] myapp"}] ".*" [expr {$install_wa277 eq {y} ? 1 : 0}]
54 } else {
55 testall_cmd_re "$shell" "ml $testsuite_modpath/alias/3.0\; testsuite; ts2; ts3" "Release\nhttp://an.example.web\\?&param=one\nselect\\\[type==BAR && osrel==FOO\\\] myapp" ".*" 0
56 }
57 }
58 } elseif {$verbose} {
59 send_user "\tSkipping shell alias definition tests\n"
60 }
61
62 foreach shell $othlang_list {
63 testall_cmd_re "$shell" "ml:--version" {} "Modules Release \\S+ (\\S+)" 0
64 testall_cmd_re "$shell" "ml:foo" {} "$bad_cmd_re.*" 1
65 testall_cmd "$shell" "ml:use,$share_modpath:purge:null:list,-t" "" "$cur_loaded\nnull" 0
66 testall_cmd "$shell" "ml:use,$share_modpath:purge:null:-null:list,-t" "" "$no_loaded" 0
67 switch -- $shell {
68 cmake - r {
69 testall_cmd_re "$shell" "ml:is-loaded,unk" "" ".*" 1
70 }
71 default {
72 testall_cmd_re "$shell" "ml:is-loaded,unk" "" "" 1
73 }
74 }
75 testall_cmd "$shell" "ml:use,$share_modpath:load,null:is-loaded,null" "" "" 0
76 switch -- $shell {
77 r {
78 testall_cmd "$shell" "ml:info-loaded,unk" "\[1\] \"\"" {} 0
79 }
80 python - ruby {
81 testall_cmd "$shell" "ml:info-loaded,unk" "\n" "" 0
82 }
83 default {
84 testall_cmd "$shell" "ml:info-loaded,unk" "" "" 0
85 }
86 }
87
88 switch -- $shell {
89 {cmake} {
90 set anstxt "-- null"
91 }
92 {r} {
93 set anstxt "\[1\] \"null\""
94 }
95 default {
96 set anstxt "null"
97 }
98 }
99 testall_cmd "$shell" "ml:use,$share_modpath:load,null:info-loaded,null" $anstxt "" 0
100 }
101
102
103 # test unload of previously loaded modulefile
104 if {$verbose} {
105 send_user "\tSetup LOADEDMODULES = 'null'\n"
106 send_user "\tSetup _LMFILES_ = '$share_modpath/null'\n"
107 }
108 set env(LOADEDMODULES) "null"
109 set env(_LMFILES_) "$share_modpath/null"
110
111 foreach shell $shell_list {
112 testall_cmd "$shell" "ml use $share_modpath\; ml -null\; ml" "" "$no_loaded" 0
113 }
114
115 foreach shell $othlang_list {
116 testall_cmd "$shell" "ml:use,$share_modpath:unload,null:list" "" "$no_loaded" 0
117 }
118
119 # ensure advanced_version_spec is efficient on all shells
120 set loadunloadout "Loading advvers6/1.3\n Loading requirement: advvers7/1.0\nUnloading advvers7/1.0 <aL>\n Unloading dependent: advvers6/1.3"
121 if {![is_config_locked implicit_default]} {
122 foreach shell $shell_list {
123 testall_cmd $shell "ml use $testsuite_modpath.2\; ml config implicit_default 1\; ml config verbosity normal\; ml config advanced_version_spec 1\; ml --auto [email protected]\; ml --auto [email protected]" {} $loadunloadout 0
124 }
125 foreach shell $othlang_list {
126 testall_cmd $shell "ml:use,$testsuite_modpath.2:config,implicit_default,1:config,verbosity,normal:config,advanced_version_spec,1:--auto,[email protected]:--auto,[email protected]" {} $loadunloadout 0
127 }
128 } elseif {$verbose} {
129 send_user "\tSkipping advanced_version_spec tests as implicit_default config is locked\n"
130 }
131
132
133 #
134 # Clean up variables used in this test case
135 #
136
137 reset_test_env
138 }
139
140 # vim:set tabstop=3 shiftwidth=3 expandtab autoindent: