| 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: 2006/06/01 |
| 8 |
# Last Mod.: %U%, %G% |
| 9 |
# |
| 10 |
# Authors: R.K. Owen, <[email protected]> |
| 11 |
# |
| 12 |
# Description: Testuite testsequence |
| 13 |
# Command: load |
| 14 |
# Modulefiles: append/1.0 |
| 15 |
# Sub-Command: |
| 16 |
# |
| 17 |
# Comment: %C{ |
| 18 |
# Tests the 'append-path' module subcommand with |
| 19 |
# an arbitrary delimiter |
| 20 |
# }C% |
| 21 |
# |
| 22 |
############################################################################## |
| 23 |
|
| 24 |
skip_if_quick_mode |
| 25 |
|
| 26 |
# |
| 27 |
# Variables. This test forces a module load command. It will result in the |
| 28 |
# environment variables "_LMFILES_", "LOADEDMODULES" and "testsuite" to |
| 29 |
# be set up |
| 30 |
# |
| 31 |
|
| 32 |
set ts_1 "http://foobar.org" |
| 33 |
set ts_2 "http://foobar.net" |
| 34 |
set ts_3 "http://foobar.com" |
| 35 |
set ts_new "$ts_1 $ts_2 $ts_3" |
| 36 |
# test colon char is correctly escaped in __MODULES_SHARE_ var |
| 37 |
set tsmod_new "http\\://foobar.com:1:http\\://foobar.net:1:http\\://foobar.org:1" |
| 38 |
set env(testsuite) "$ts_1 $ts_2" |
| 39 |
set module "append/1.0" |
| 40 |
set modulefile "$modpath/$module" |
| 41 |
|
| 42 |
# |
| 43 |
# For the different shells ... |
| 44 |
# |
| 45 |
|
| 46 |
lappend ans [list set _LMFILES_ $modulefile] |
| 47 |
lappend ans [list set LOADEDMODULES $module] |
| 48 |
lappend ans [list set testsuite $ts_new] |
| 49 |
|
| 50 |
# |
| 51 |
# The tests |
| 52 |
# |
| 53 |
|
| 54 |
test_cmd_re "ALL" "load $module" $ans |
| 55 |
|
| 56 |
# |
| 57 |
# Try bad argument list: missing variable name |
| 58 |
# |
| 59 |
|
| 60 |
set module "append/1.3" |
| 61 |
set modulefile "$modpath/$module" |
| 62 |
set ts_err [msg_moderr "append-path $msg_needenvvarname" {append-path -d : } $modulefile 24] |
| 63 |
testouterr_cmd "sh" "load $module" "ERR" [msg_load $module $ts_err] |
| 64 |
|
| 65 |
# |
| 66 |
# Try bad argument list: missing variable value |
| 67 |
# |
| 68 |
|
| 69 |
set module "append/1.4" |
| 70 |
set modulefile "$modpath/$module" |
| 71 |
set ts_err [msg_moderr "append-path $msg_needenvvarval PATH" {append-path -d : PATH} $modulefile 24] |
| 72 |
testouterr_cmd "sh" "load $module" "ERR" [msg_load $module $ts_err] |
| 73 |
|
| 74 |
# |
| 75 |
# Try bad argument list: empty variable name |
| 76 |
# |
| 77 |
|
| 78 |
set module "append/1.5" |
| 79 |
set modulefile "$modpath/$module" |
| 80 |
set ts_err [msg_moderr "append-path $msg_validenvvarname" {append-path -d : {} /path/to} $modulefile 24] |
| 81 |
testouterr_cmd "sh" "load $module" "ERR" [msg_load $module $ts_err] |
| 82 |
|
| 83 |
# |
| 84 |
# Append multiple paths passed as one string |
| 85 |
# |
| 86 |
|
| 87 |
set module "append/1.6" |
| 88 |
set modulefile "$modpath/$module" |
| 89 |
set ts_new "$ts_1 $ts_2 $ts_3 http://foobar.io " |
| 90 |
set tsmod_new ":1:http\\://foobar.com:1:http\\://foobar.net:1:http\\://foobar.io:1:http\\://foobar.org:1" |
| 91 |
|
| 92 |
set ans [list] |
| 93 |
lappend ans [list set _LMFILES_ $modulefile] |
| 94 |
lappend ans [list set LOADEDMODULES $module] |
| 95 |
lappend ans [list set __MODULES_SHARE_testsuite :1] |
| 96 |
lappend ans [list set testsuite $ts_new] |
| 97 |
|
| 98 |
testouterr_cmd_re "sh" "load $module" $ans "" |
| 99 |
|
| 100 |
# |
| 101 |
# Append multiple paths passed as multiple strings |
| 102 |
# |
| 103 |
|
| 104 |
set module "append/1.7" |
| 105 |
set modulefile "$modpath/$module" |
| 106 |
|
| 107 |
set ans [list] |
| 108 |
lappend ans [list set _LMFILES_ $modulefile] |
| 109 |
lappend ans [list set LOADEDMODULES $module] |
| 110 |
lappend ans [list set __MODULES_SHARE_testsuite :1] |
| 111 |
lappend ans [list set testsuite $ts_new] |
| 112 |
|
| 113 |
testouterr_cmd_re "sh" "load $module" $ans "" |
| 114 |
|
| 115 |
# |
| 116 |
# Try pass invalid option to append-path |
| 117 |
# |
| 118 |
|
| 119 |
set module append/8.0 |
| 120 |
set modulefile $modpath/$module |
| 121 |
set ts_err [msg_moderr {invalid option '-delim=,' for append-path} {append-path -delim=, FOO bar} $modulefile 2] |
| 122 |
testouterr_cmd sh "load $module" ERR [msg_load $module $ts_err] |
| 123 |
|
| 124 |
|
| 125 |
# |
| 126 |
# __MODULES_SHARE_ ref counter variable tests |
| 127 |
# test colon char is correctly escaped in __MODULES_SHARE_ var |
| 128 |
# |
| 129 |
|
| 130 |
set module append/1.6 |
| 131 |
set modulefile $modpath/$module |
| 132 |
setenv_var testsuite "$ts_1 $ts_2 $ts_3 http://foobar.io " |
| 133 |
|
| 134 |
# erroneous __MODULES_SHARE_ ref counter variable is fixed |
| 135 |
setenv_var __MODULES_SHARE_testsuite "http\\://foobar.com:1" |
| 136 |
set ans [list] |
| 137 |
lappend ans [list set _LMFILES_ $modulefile] |
| 138 |
lappend ans [list set LOADEDMODULES $module] |
| 139 |
lappend ans [list set __MODULES_SHARE_testsuite ":2:http\\://foobar.com:2:http\\://foobar.io:2"] |
| 140 |
lappend ans [list set testsuite "$ts_1 $ts_2 $ts_3 http://foobar.io "] |
| 141 |
testouterr_cmd_re sh "load $module" $ans {} |
| 142 |
|
| 143 |
# erroneous __MODULES_SHARE_ ref counter variable is fixed |
| 144 |
setenv_var __MODULES_SHARE_testsuite ":1:http\\://foobar.com:0" |
| 145 |
set ans [list] |
| 146 |
lappend ans [list set _LMFILES_ $modulefile] |
| 147 |
lappend ans [list set LOADEDMODULES $module] |
| 148 |
lappend ans [list set __MODULES_SHARE_testsuite ":2:http\\://foobar.com:2:http\\://foobar.io:2"] |
| 149 |
lappend ans [list set testsuite "$ts_1 $ts_2 $ts_3 http://foobar.io "] |
| 150 |
testouterr_cmd_re sh "load $module" $ans {} |
| 151 |
|
| 152 |
# __MODULES_SHARE_ ref counter variable is updated |
| 153 |
setenv_var __MODULES_SHARE_testsuite ":1:http\\://foobar.com:2" |
| 154 |
set ans [list] |
| 155 |
lappend ans [list set _LMFILES_ $modulefile] |
| 156 |
lappend ans [list set LOADEDMODULES $module] |
| 157 |
lappend ans [list set __MODULES_SHARE_testsuite ":2:http\\://foobar.com:3:http\\://foobar.io:2"] |
| 158 |
lappend ans [list set testsuite "$ts_1 $ts_2 $ts_3 http://foobar.io "] |
| 159 |
testouterr_cmd_re sh "load $module" $ans {} |
| 160 |
|
| 161 |
# __MODULES_SHARE_ ref counter variable is updated |
| 162 |
setenv_var __MODULES_SHARE_testsuite ":1:http\\://foobar.com:3" |
| 163 |
set ans [list] |
| 164 |
lappend ans [list set _LMFILES_ $modulefile] |
| 165 |
lappend ans [list set LOADEDMODULES $module] |
| 166 |
lappend ans [list set __MODULES_SHARE_testsuite ":2:http\\://foobar.com:4:http\\://foobar.io:2"] |
| 167 |
lappend ans [list set testsuite "$ts_1 $ts_2 $ts_3 http://foobar.io "] |
| 168 |
testouterr_cmd_re sh "load $module" $ans {} |
| 169 |
|
| 170 |
|
| 171 |
# |
| 172 |
# Cleanup |
| 173 |
# |
| 174 |
|
| 175 |
reset_test_env |