ts/travis: adapt tests to set_shell_startup cfg

This commit is contained in:
Xavier Delaruelle
2019-07-04 06:52:29 +02:00
parent 07181a3468
commit 61e02ff8cf
7 changed files with 97 additions and 39 deletions

View File

@@ -86,7 +86,7 @@ matrix:
- cmake3
- r-base-core
- env: CONFIGURE_OPTS='--with-tclsh=tclsh8.4 --prefix=/tmp/modules --enable-compat-version --with-tcl=/usr/lib/tcl8.4 --enable-versioning --disable-silent-shell-debug-support --disable-quarantine-support --with-loadedmodules=null:dot --without-pager --disable-avail-indepth --with-terminal-background=light --with-unload-match-order=returnfirst --disable-implicit-default --with-search-match=contains --with-locked-configs=extra_siteconfig' COVERAGE='y'
- env: CONFIGURE_OPTS='--with-tclsh=tclsh8.4 --prefix=/tmp/modules --enable-compat-version --with-tcl=/usr/lib/tcl8.4 --enable-versioning --disable-silent-shell-debug-support --disable-set-shell-startup --disable-quarantine-support --with-loadedmodules=null:dot --without-pager --disable-avail-indepth --with-terminal-background=light --with-unload-match-order=returnfirst --disable-implicit-default --with-search-match=contains --with-locked-configs=extra_siteconfig' COVERAGE='y'
EXTRA_SCRIPT_PRETEST='make install-testmodulerc install-testsiteconfig install-testmodspath-empty' EXTRA_SCRIPT_POSTTEST='make uninstall-testconfig'
addons:
apt:

View File

@@ -61,6 +61,12 @@ catch {unset env(MODULES_UNLOAD_MATCH_ORDER)}
# clean any implicit default config
catch {unset env(MODULES_IMPLICIT_DEFAULT)}
# clean any search match config
catch {unset env(MODULES_SEARCH_MATCH)}
# clean any set shell startup config
catch {unset env(MODULES_SET_SHELL_STARTUP)}
# clean any pager configuration
catch {unset env(LESS)}
catch {unset env(PAGER)}

View File

@@ -22,6 +22,7 @@
set bad_cmd "$error_msgs: Invalid command 'foo'"
set bash_nf "module: command not found"
if {$tcl_platform(os) eq "SunOS"} {
set cmd_nf "module: not found \\\[No such file or directory\\\]"
} elseif {$tcl_platform(os) eq "FreeBSD"} {
@@ -29,7 +30,7 @@ if {$tcl_platform(os) eq "SunOS"} {
} elseif {$sh_kind eq "dash"} {
set cmd_nf "module: not found"
} else {
set cmd_nf "module: command not found"
set cmd_nf $bash_nf
}
if {$tcl_platform(os) eq "Darwin" || [string match "CYGWIN*" $tcl_platform(os)] || [string match "MSYS_NT*" $tcl_platform(os)]} {
set ksh_nf "module: not found"
@@ -88,9 +89,13 @@ foreach subshell $shell_list {
}
}
}
# propagate in any cases as BASH_ENV is set everywhere
# propagate in any cases as BASH_ENV is set everywhere when set_shell_startup is enabled
bash {
testall_cmd_re "$shell" "module --version" "^\$" "^Modules Release \\S+ (\\S+)\$" 0
if {$install_setshellstartup eq {y} || $shell eq {basheu}} {
testall_cmd_re "$shell" "module --version" "^\$" "^Modules Release \\S+ (\\S+)\$" 0
} else {
testall_cmd_re "$shell" "module --version" "^\$" "$bash_nf\$" 127
}
}
ksh {
testall_cmd_re "$shell" "module --version" "^\$" "$ksh_nf\$" 127
@@ -138,9 +143,13 @@ foreach subshell $shell_list {
}
}
}
# propagate in any cases as BASH_ENV is set everywhere
# propagate in any cases as BASH_ENV is set everywhere when set_shell_startup is enabled
bash {
testall_cmd_re "$shell" "module --version" "^\$" "^Modules Release \\S+ (\\S+)\$" 0
if {$install_setshellstartup eq {y} || $shell eq {basheu}} {
testall_cmd_re "$shell" "module --version" "^\$" "^Modules Release \\S+ (\\S+)\$" 0
} else {
testall_cmd_re "$shell" "module --version" "^\$" "$bash_nf\$" 127
}
}
ksh {
testall_cmd_re "$shell" "module --version" "^\$" "$ksh_nf\$" 127
@@ -166,6 +175,7 @@ foreach subshell $shell_list {
#
unset bad_cmd
unset bash_nf
unset cmd_nf
unset ksh_nf
unset zsh_nf

View File

@@ -201,6 +201,10 @@ proc is_config_locked {option} {
return [expr {[lsearch -exact $::install_lockedconfigs $option] != -1}]
}
proc is_real_shell {shell} {
return [expr {[lsearch -exact $::real_shells $shell] != -1}]
}
# helper procedures to format block message output
proc msg_block_content {args} {
set msg {}

View File

@@ -58,6 +58,12 @@ catch {unset env(MODULES_UNLOAD_MATCH_ORDER)}
# clean any implicit default config
catch {unset env(MODULES_IMPLICIT_DEFAULT)}
# clean any search match config
catch {unset env(MODULES_SEARCH_MATCH)}
# clean any set shell startup config
catch {unset env(MODULES_SET_SHELL_STARTUP)}
# clean any pager configuration
catch {unset env(LESS)}
catch {unset env(PAGER)}

View File

@@ -465,56 +465,67 @@ set func_r "module <- function\\\(...\\\){
# setup environment state
setenv_loaded_module "foo" [list]
foreach shell $supported_shells {
switch -- $shell {
{lisp} {
testouterr_cmd "lisp" "autoinit" "ERR" "$err_lisp"
}
{cmd} {
testouterr_cmd "cmd" "autoinit" "ERR" "$err_cmd"
}
default {
set ans [list]
lappend ans [list [set "func_$shell"]]
if {$install_versioning eq "y"} {
lappend ans [list set MODULE_VERSION_STACK "(.*)"]
lappend ans [list set MODULES_CMD $modulecmd_path]
lappend ans [list set MODULESHOME $moduleshome]
lappend ans [list set MODULE_VERSION "(.*)"]
} else {
lappend ans [list set MODULES_CMD $modulecmd_path]
lappend ans [list set MODULESHOME $moduleshome]
}
# check various set_shell_startup configs
foreach set_shell_startup [list {} 0 1] {
setenv_var MODULES_SET_SHELL_STARTUP $set_shell_startup
test_cmd_re $shell "autoinit" $ans
foreach shell $supported_shells {
switch -- $shell {
{lisp} {
testouterr_cmd "lisp" "autoinit" "ERR" "$err_lisp"
}
{cmd} {
testouterr_cmd "cmd" "autoinit" "ERR" "$err_cmd"
}
default {
set ans [list]
lappend ans [list [set "func_$shell"]]
if {$install_versioning eq "y"} {
lappend ans [list set MODULE_VERSION_STACK "(.*)"]
lappend ans [list set MODULES_CMD $modulecmd_path]
if {[is_real_shell $shell] && ($env(MODULES_SET_SHELL_STARTUP) eq {1} || ($env(MODULES_SET_SHELL_STARTUP) ne {0} && $install_setshellstartup eq {y}))} {
lappend ans [list set ENV $install_initdir/profile.sh]
lappend ans [list set BASH_ENV $install_initdir/bash]
}
lappend ans [list set MODULESHOME $moduleshome]
lappend ans [list set MODULE_VERSION "(.*)"]
} else {
lappend ans [list set MODULES_CMD $modulecmd_path]
if {[is_real_shell $shell] && ($env(MODULES_SET_SHELL_STARTUP) eq {1} || ($env(MODULES_SET_SHELL_STARTUP) ne {0} && $install_setshellstartup eq {y}))} {
lappend ans [list set ENV $install_initdir/profile.sh]
lappend ans [list set BASH_ENV $install_initdir/bash]
}
lappend ans [list set MODULESHOME $moduleshome]
}
test_cmd_re $shell "autoinit" $ans
}
}
}
unsetenv_var MODULES_SET_SHELL_STARTUP
}
# test versioning autoinit when MODULE_VERSION is already defined
if {$install_versioning eq "y"} {
# setup environment state
if { $verbose > 0 } {
send_user "\tSetup MODULE_VERSION = 'vers'\n"
send_user "\tSetup MODULE_VERSION_STACK = 'vers'\n"
}
set env(MODULE_VERSION) "vers"
set env(MODULE_VERSION_STACK) "vers"
setenv_var MODULE_VERSION "vers"
setenv_var MODULE_VERSION_STACK "vers"
set ans [list]
lappend ans [list [set "func_sh"]]
lappend ans [list set MODULES_CMD $modulecmd_path]
if {$install_setshellstartup eq {y}} {
lappend ans [list set ENV $install_initdir/profile.sh]
lappend ans [list set BASH_ENV $install_initdir/bash]
}
lappend ans [list set MODULESHOME $moduleshome]
test_cmd_re "sh" "autoinit" $ans
# setup environment state
if { $verbose > 0 } {
send_user "\tUnset MODULE_VERSION\n"
send_user "\tUnset MODULE_VERSION_STACK\n"
}
unset env(MODULE_VERSION)
unset env(MODULE_VERSION_STACK)
unsetenv_var MODULE_VERSION
unsetenv_var MODULE_VERSION_STACK
}
# setup environment state
@@ -538,6 +549,10 @@ if {(!$insmodspath || $modspath_exinstalled) && (!$insmodrc || $modrc_exinstalle
lappend ans [list set MODULE_VERSION_STACK "(.*)"]
}
lappend ans [list set MODULES_CMD $modulecmd_path]
if {[is_real_shell $shell] && $install_setshellstartup eq {y}} {
lappend ans [list set ENV $install_initdir/profile.sh]
lappend ans [list set BASH_ENV $install_initdir/bash]
}
lappend ans [list set LOADEDMODULES ""]
lappend ans [list set MODULESHOME $moduleshome]
lappend ans [list set MODULEPATH ""]
@@ -549,7 +564,13 @@ if {(!$insmodspath || $modspath_exinstalled) && (!$insmodrc || $modrc_exinstalle
lappend ans [list set MODULE_VERSION_STACK "(.*)"]
}
lappend ans [list set MODULES_CMD $modulecmd_path]
if {[is_real_shell $shell] && $install_setshellstartup eq {y}} {
lappend ans [list set ENV $install_initdir/profile.sh]
}
lappend ans [list set MODULEPATH_modshare "(.*)"]
if {[is_real_shell $shell] && $install_setshellstartup eq {y}} {
lappend ans [list set BASH_ENV $install_initdir/bash]
}
lappend ans [list set LOADEDMODULES ""]
lappend ans [list set MODULESHOME $moduleshome]
lappend ans [list set MODULEPATH "$install_modulepath:$install_prefix/test/modulefiles:$install_prefix/test/etc"]
@@ -563,7 +584,13 @@ if {(!$insmodspath || $modspath_exinstalled) && (!$insmodrc || $modrc_exinstalle
lappend ans [list set MODULE_VERSION_STACK "(.*)"]
}
lappend ans [list set MODULES_CMD $modulecmd_path]
if {[is_real_shell $shell] && $install_setshellstartup eq {y}} {
lappend ans [list set ENV $install_initdir/profile.sh]
}
lappend ans [list set MODULEPATH_modshare "$install_modulepath:1"]
if {[is_real_shell $shell] && $install_setshellstartup eq {y}} {
lappend ans [list set BASH_ENV $install_initdir/bash]
}
lappend ans [list set _LMFILES_ "$install_modulefilesdir/null"]
lappend ans [list set LOADEDMODULES "null"]
lappend ans [list set MODULESHOME $moduleshome]
@@ -650,3 +677,5 @@ unset func_python
unset func_ruby
unset func_cmake
unset func_r
unset set_shell_startup

View File

@@ -47,6 +47,7 @@ array set configdfl [list\
rcfile <undef>\
run_quarantine <undef>\
search_match $install_searchmatch\
set_shell_startup [expr {$install_setshellstartup eq {y}}]\
silent_shell_debug <undef>\
siteconfig $siteconfig_filere\
tcl_ext_lib lib/libtclenvmodules$install_shlib_suffix\
@@ -68,6 +69,7 @@ array set configvar [list\
rcfile MODULERCFILE\
run_quarantine MODULES_RUN_QUARANTINE\
search_match MODULES_SEARCH_MATCH\
set_shell_startup MODULES_SET_SHELL_STARTUP\
silent_shell_debug MODULES_SILENT_SHELL_DEBUG\
term_background MODULES_TERM_BACKGROUND\
unload_match_order MODULES_UNLOAD_MATCH_ORDER\
@@ -80,6 +82,7 @@ array set configvalid [list\
color {never auto always}\
implicit_default {0 1}\
search_match {starts_with contains}\
set_shell_startup {0 1}\
silent_shell_debug {0 1}\
term_background {dark light}\
unload_match_order {returnlast returnfirst}\