1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192
|
##############################################################################
# Modules Revision 3.0
# Providing a flexible user environment
#
# File: modules.00-init/%M%
# Revision: %I%
# First Edition: 2017/05/07
# Last Mod.: %U%, %G%
#
# Authors: Xavier Delaruelle, xavier.delaruelle@cea.fr
#
# Description: Testuite testsequence
# Command:
# Sub-Command:
#
# Comment: %C{
# Check module command propagation in sub shells
# }C%
#
##############################################################################
set bad_cmd "$error_msgs: Invalid command 'foo'"
set zsh_nf "command not found: module"
set zsh_nf_ml "command not found: ml"
set tcsh_nf "module: Command not found."
set tcsh_nf_ml "ml: Command not found."
if {$os_name eq "sunos"} {
set csh_nf "module: Command not found"
set csh_nf_ml "ml: Command not found"
} else {
set csh_nf $tcsh_nf
set csh_nf_ml $tcsh_nf_ml
}
set fish_nf "fish: Unknown command:? '?module"
set fish_nf_ml "fish: Unknown command:? '?ml"
if {$os_name eq "sunos"} {
set sh_nf "module: not found \\\[No such file or directory\\\]"
set sh_nf_ml "ml: not found \\\[No such file or directory\\\]"
} elseif {$os_name eq "freebsd"} {
set sh_nf "eval: module: not found"
set sh_nf_ml "eval: ml: not found"
} else {
set sh_nf "(.*: )?module: not found"
set sh_nf_ml "ml: not found"
}
#
# The tests
#
if {$verbose} {
send_user "\tChecking module command propagation in sub shell\n"
}
set shell_level "sub"
foreach shell $shell_list {
# No module command propagation available for some shells
switch -- $shell {
zsh {
testall_cmd_re "$shell" "module --version" {} ".*$zsh_nf" 127
testall_cmd_re "$shell" "module foo" {} ".*$zsh_nf" 127
testall_cmd_re "$shell" "module use $share_modpath\; module purge\; module load null\; module list -t" {} ".*$zsh_nf\n.*$zsh_nf\n.*$zsh_nf\n.*$zsh_nf" 252
testall_cmd_re "$shell" "module use $share_modpath\; module purge\; module load null\; module unload null\; module list -t" {} ".*$zsh_nf\n.*$zsh_nf\n.*$zsh_nf\n.*$zsh_nf\n.*$zsh_nf" 123
if {$install_ml eq {y}} {
testall_cmd_re "$shell" "ml use $share_modpath\; ml purge\; ml null\; ml -null\; ml" {} ".*$zsh_nf_ml\n.*$zsh_nf_ml\n.*$zsh_nf_ml\n.*$zsh_nf_ml\n.*$zsh_nf_ml" 123
}
}
csh {
testall_cmd_re "$shell" "module --version" {} "$csh_nf" 1
testall_cmd_re "$shell" "module foo" {} "$csh_nf" 1
testall_cmd_re "$shell" "module use $share_modpath\; module purge\; module load null\; module list -t" {} ".*$csh_nf\n.*$csh_nf\n.*$csh_nf\n.*$csh_nf" 4
testall_cmd_re "$shell" "module use $share_modpath\; module purge\; module load null\; module unload null\; module list -t" {} ".*$csh_nf\n.*$csh_nf\n.*$csh_nf\n.*$csh_nf\n.*$csh_nf" 5
if {$install_ml eq {y}} {
testall_cmd_re "$shell" "ml use $share_modpath\; ml purge\; ml null\; ml -null\; ml" {} ".*$csh_nf_ml\n.*$csh_nf_ml\n.*$csh_nf_ml\n.*$csh_nf_ml\n.*$csh_nf_ml" 5
}
}
tcsh {
testall_cmd_re "$shell" "module --version" {} "$tcsh_nf" 1
testall_cmd_re "$shell" "module foo" {} "$tcsh_nf" 1
testall_cmd_re "$shell" "module use $share_modpath\; module purge\; module load null\; module list -t" {} ".*$tcsh_nf\n.*$tcsh_nf\n.*$tcsh_nf\n.*$tcsh_nf" 4
testall_cmd_re "$shell" "module use $share_modpath\; module purge\; module load null\; module unload null\; module list -t" {} ".*$tcsh_nf\n.*$tcsh_nf\n.*$tcsh_nf\n.*$tcsh_nf\n.*$tcsh_nf" 5
if {$install_ml eq {y}} {
testall_cmd_re "$shell" "ml use $share_modpath\; ml purge\; ml null\; ml -null\; ml" {} ".*$tcsh_nf_ml\n.*$tcsh_nf_ml\n.*$tcsh_nf_ml\n.*$tcsh_nf_ml\n.*$tcsh_nf_ml" 5
}
}
fish {
testall_cmd_re "$shell" "module --version" {} "$fish_nf.*" [expr {$fish_version_is31 ? {1} : {127}}]
testall_cmd_re "$shell" "module foo" {} "$fish_nf.*" [expr {$fish_version_is31 ? {1} : {127}}]
testall_cmd_re "$shell" "module use $share_modpath\; module purge\; module load null\; module list -t" {} ".*$fish_nf.*$fish_nf.*$fish_nf.*$fish_nf.*" [expr {$fish_version_is31 ? {4} : [expr {$fish_version_ge32 ? {255} : {252}}]}]
testall_cmd_re "$shell" "module use $share_modpath\; module purge\; module load null\; module unload null\; module list -t" {} ".*$fish_nf.*$fish_nf.*$fish_nf.*$fish_nf.*$fish_nf.*" [expr {$fish_version_is31 ? {5} : [expr {$fish_version_ge32 ? {255} : {123}}]}]
if {$install_ml eq {y}} {
testall_cmd_re "$shell" "ml use $share_modpath\; ml purge\; ml null\; ml -null\; ml" {} ".*$fish_nf_ml.*$fish_nf_ml.*$fish_nf_ml.*$fish_nf_ml.*$fish_nf_ml.*" [expr {$fish_version_is31 ? {5} : [expr {$fish_version_ge32 ? {255} : {123}}]}]
}
}
default {
if {$shell eq "sh" && $sh_strict} {
testall_cmd_re "$shell" "module --version" {} "$sh_nf" 127
testall_cmd_re "$shell" "module foo" {} "$sh_nf" 127
testall_cmd_re "$shell" "module use $share_modpath\; module purge\; module load null\; module list -t" {} ".*$sh_nf\n.*$sh_nf\n.*$sh_nf\n.*$sh_nf" 252
testall_cmd_re "$shell" "module use $share_modpath\; module purge\; module load null\; module unload null\; module list -t" {} ".*$sh_nf\n.*$sh_nf\n.*$sh_nf\n.*$sh_nf\n.*$sh_nf" 123
if {$install_ml eq {y}} {
testall_cmd_re "$shell" "ml use $share_modpath\; ml purge\; ml null\; ml -null\; ml" {} ".*$sh_nf_ml\n.*$sh_nf_ml\n.*$sh_nf_ml\n.*$sh_nf_ml\n.*$sh_nf_ml" 123
}
} else {
testall_cmd_re "$shell" "module --version" {} "Modules Release \\S+ (\\S+)" 0
testall_cmd "$shell" "module foo" "" "$bad_cmd\n$type_help" 1
testall_cmd "$shell" "module use $share_modpath\; module purge\; module load null\; module list -t" "" "$cur_loaded\nnull" 0
testall_cmd "$shell" "module use $share_modpath\; module purge\; module load null\; module unload null\; module list -t" "" "$no_loaded" 0
if {$install_ml eq {y}} {
testall_cmd "$shell" "ml use $share_modpath\; ml purge\; ml null\; ml -null\; ml" "" "$no_loaded" 0
}
}
}
}
}
if {$verbose} {
send_user "\tChecking module command propagation in sub sub shell\n"
}
set shell_level "subsub"
foreach shell $shell_list {
# No module command propagation available for some shells
switch -- $shell {
zsh {
testall_cmd_re "$shell" "module --version" {} ".*$zsh_nf" 127
testall_cmd_re "$shell" "module foo" {} ".*$zsh_nf" 127
testall_cmd_re "$shell" "module use $share_modpath\; module purge\; module load null\; module list -t" {} ".*$zsh_nf\n.*$zsh_nf\n.*$zsh_nf\n.*$zsh_nf" 252
testall_cmd_re "$shell" "module use $share_modpath\; module purge\; module load null\; module unload null\; module list -t" {} ".*$zsh_nf\n.*$zsh_nf\n.*$zsh_nf\n.*$zsh_nf\n.*$zsh_nf" 123
if {$install_ml eq {y}} {
testall_cmd_re "$shell" "ml use $share_modpath\; ml purge\; ml null\; ml -null\; ml" {} ".*$zsh_nf_ml\n.*$zsh_nf_ml\n.*$zsh_nf_ml\n.*$zsh_nf_ml\n.*$zsh_nf_ml" 123
}
}
csh {
testall_cmd_re "$shell" "module --version" {} "$csh_nf" 1
testall_cmd_re "$shell" "module foo" {} "$csh_nf" 1
testall_cmd_re "$shell" "module use $share_modpath\; module purge\; module load null\; module list -t" {} ".*$csh_nf\n.*$csh_nf\n.*$csh_nf\n.*$csh_nf" 4
testall_cmd_re "$shell" "module use $share_modpath\; module purge\; module load null\; module unload null\; module list -t" {} ".*$csh_nf\n.*$csh_nf\n.*$csh_nf\n.*$csh_nf\n.*$csh_nf" 5
if {$install_ml eq {y}} {
testall_cmd_re "$shell" "ml use $share_modpath\; ml purge\; ml null\; ml -null\; ml" {} ".*$csh_nf_ml\n.*$csh_nf_ml\n.*$csh_nf_ml\n.*$csh_nf_ml\n.*$csh_nf_ml" 5
}
}
tcsh {
testall_cmd_re "$shell" "module --version" {} "$tcsh_nf" 1
testall_cmd_re "$shell" "module foo" {} "$tcsh_nf" 1
testall_cmd_re "$shell" "module use $share_modpath\; module purge\; module load null\; module list -t" {} ".*$tcsh_nf\n.*$tcsh_nf\n.*$tcsh_nf\n.*$tcsh_nf" 4
testall_cmd_re "$shell" "module use $share_modpath\; module purge\; module load null\; module unload null\; module list -t" {} ".*$tcsh_nf\n.*$tcsh_nf\n.*$tcsh_nf\n.*$tcsh_nf\n.*$tcsh_nf" 5
if {$install_ml eq {y}} {
testall_cmd_re "$shell" "ml use $share_modpath\; ml purge\; ml null\; ml -null\; ml" {} ".*$tcsh_nf_ml\n.*$tcsh_nf_ml\n.*$tcsh_nf_ml\n.*$tcsh_nf_ml\n.*$tcsh_nf_ml" 5
}
}
fish {
testall_cmd_re "$shell" "module --version" {} "$fish_nf.*" [expr {$fish_version_is31 ? {1} : {127}}]
testall_cmd_re "$shell" "module foo" {} "$fish_nf.*" [expr {$fish_version_is31 ? {1} : {127}}]
testall_cmd_re "$shell" "module use $share_modpath\; module purge\; module load null\; module list -t" {} ".*$fish_nf.*$fish_nf.*$fish_nf.*$fish_nf.*" [expr {$fish_version_is31 ? {4} : [expr {$fish_version_ge32 ? {255} : {252}}]}]
testall_cmd_re "$shell" "module use $share_modpath\; module purge\; module load null\; module unload null\; module list -t" {} ".*$fish_nf.*$fish_nf.*$fish_nf.*$fish_nf.*$fish_nf.*" [expr {$fish_version_is31 ? {5} : [expr {$fish_version_ge32 ? {255} : {123}}]}]
if {$install_ml eq {y}} {
testall_cmd_re "$shell" "ml use $share_modpath\; ml purge\; ml null\; ml -null\; ml" {} ".*$fish_nf_ml.*$fish_nf_ml.*$fish_nf_ml.*$fish_nf_ml.*$fish_nf_ml.*" [expr {$fish_version_is31 ? {5} : [expr {$fish_version_ge32 ? {255} : {123}}]}]
}
}
default {
if {$shell eq "sh" && $sh_strict} {
testall_cmd_re "$shell" "module --version" {} "$sh_nf" 127
testall_cmd_re "$shell" "module foo" {} "$sh_nf" 127
testall_cmd_re "$shell" "module use $share_modpath\; module purge\; module load null\; module list -t" {} ".*$sh_nf\n.*$sh_nf\n.*$sh_nf\n.*$sh_nf" 252
testall_cmd_re "$shell" "module use $share_modpath\; module purge\; module load null\; module unload null\; module list -t" {} ".*$sh_nf\n.*$sh_nf\n.*$sh_nf\n.*$sh_nf\n.*$sh_nf" 123
if {$install_ml eq {y}} {
testall_cmd_re "$shell" "ml use $share_modpath\; ml purge\; ml null\; ml -null\; ml" {} ".*$sh_nf_ml\n.*$sh_nf_ml\n.*$sh_nf_ml\n.*$sh_nf_ml\n.*$sh_nf_ml" 123
}
} else {
testall_cmd_re "$shell" "module --version" {} "Modules Release \\S+ (\\S+)" 0
testall_cmd "$shell" "module foo" "" "$bad_cmd\n$type_help" 1
testall_cmd "$shell" "module use $share_modpath\; module purge\; module load null\; module list -t" "" "$cur_loaded\nnull" 0
testall_cmd "$shell" "module use $share_modpath\; module purge\; module load null\; module unload null\; module list -t" "" "$no_loaded" 0
if {$install_ml eq {y}} {
testall_cmd "$shell" "ml use $share_modpath\; ml purge\; ml null\; ml -null\; ml" "" "$no_loaded" 0
}
}
}
}
}
#
# Clean up variables used in this test case
#
reset_test_env
# vim:set tabstop=3 shiftwidth=3 expandtab autoindent:
|