ts: adapt full path tests when + sign is found in modpath

Plus sign in full path modulefile designation is understood as a variant
specification when advanced_version_spec config option is enabled. So
disable the option for the full path tests.
This commit is contained in:
Xavier Delaruelle
2021-07-20 08:42:28 +02:00
parent 008b495697
commit d158921e9d
14 changed files with 111 additions and 0 deletions

View File

@@ -202,6 +202,7 @@ set autoinit_script "$install_libexecdir/modulecmd.tcl"
# where to find modulefiles for test
set contrib_modpath "$env(TESTSUITEDIR)/../contrib/modulefiles"
set testsuite_modpath "$env(TESTSUITEDIR)/modulefiles"
set plus_in_modpath [expr {[string first + $testsuite_modpath] != -1}]
# basic messages
set type_help " Try 'module --help' for more information."

View File

@@ -43,6 +43,9 @@ foreach shell $shell_list {
# ensure tools used in complex shell alias definition are available
if {[find_bin grep] ne "" && [find_bin tr] ne "" && [find_bin awk] ne ""} {
if {$plus_in_modpath && $install_advversspec eq {y}} {
setenv_var MODULES_ADVANCED_VERSION_SPEC 0
}
foreach shell $shell_list {
if {$shell eq {csh} || $shell eq {tcsh}} {
# alias evaluation leads to a syntax error if wa_277 is enabled
@@ -51,6 +54,9 @@ if {[find_bin grep] ne "" && [find_bin tr] ne "" && [find_bin awk] ne ""} {
testall_cmd_re "$shell" "module load $testsuite_modpath/alias/3.0\; testsuite; ts2" "Release\nhttp://an.example.web\\?&param=one" ".*" 0
}
}
if {$plus_in_modpath && $install_advversspec eq {y}} {
unsetenv_var MODULES_ADVANCED_VERSION_SPEC
}
} elseif {$verbose > 0} {
send_user "\tSkipping shell alias definition tests\n"
}

View File

@@ -46,6 +46,9 @@ foreach shell $shell_list {
# ensure tools used in complex shell alias definition are available
if {[find_bin grep] ne "" && [find_bin tr] ne "" && [find_bin awk] ne ""} {
if {$plus_in_modpath && $install_advversspec eq {y}} {
setenv_var MODULES_ADVANCED_VERSION_SPEC 0
}
foreach shell $shell_list {
if {$shell eq {csh} || $shell eq {tcsh}} {
# alias evaluation leads to a syntax error if wa_277 is enabled
@@ -54,6 +57,9 @@ if {[find_bin grep] ne "" && [find_bin tr] ne "" && [find_bin awk] ne ""} {
testall_cmd_re "$shell" "ml $testsuite_modpath/alias/3.0\; testsuite; ts2" "Release\nhttp://an.example.web\\?&param=one" ".*" 0
}
}
if {$plus_in_modpath && $install_advversspec eq {y}} {
unsetenv_var MODULES_ADVANCED_VERSION_SPEC
}
} elseif {$verbose > 0} {
send_user "\tSkipping shell alias definition tests\n"
}

View File

@@ -22,6 +22,7 @@
if [info exists env(TESTSUITEDIR)] {
set modpath "$env(TESTSUITEDIR)/modulefiles"
set modpathre [regsub -all "\(\[.+?\]\)" $modpath {\\\1}]
set plus_in_modpath [expr {[string first + $modpath] != -1}]
setenv_path_var MODULEPATH $modpath
set reldmodpath "./[file tail $env(TESTSUITEDIR)]/modulefiles"

View File

@@ -151,6 +151,10 @@ unsetenv_loaded_module
# test appending variable after defining it with setenv
#
if {$plus_in_modpath && $install_advversspec eq {y}} {
setenv_var MODULES_ADVANCED_VERSION_SPEC 0
}
set module $env(TESTSUITEDIR)/modulefiles.2/setenv/0.1
set ans [list]
lappend ans [list set TS1 ok]
@@ -162,6 +166,10 @@ lappend ans [list setpath LOADEDMODULES $module]
lappend ans [list setpath _LMFILES_ $module]
testouterr_cmd sh "load $module" $ans {}
if {$plus_in_modpath && $install_advversspec eq {y}} {
unsetenv_var MODULES_ADVANCED_VERSION_SPEC
}
#
# Cleanup

View File

@@ -184,12 +184,18 @@ lappend ans [list unset testsuite]
lappend ans [list setpath LOADEDMODULES $module_2]
lappend ans [list setpath _LMFILES_ $modulefile_2]
if {$plus_in_modpath && $install_advversspec eq {y}} {
setenv_var MODULES_ADVANCED_VERSION_SPEC 0
}
# unload modulefile loaded as full pathname
testouterr_cmd "sh" "unload $module_3" $ans ""
# try with other full path name forms (./ and ../)
testouterr_cmd "sh" "unload $module_3_reld" $ans ""
testouterr_cmd "sh" "unload $module_3_reldd" $ans ""
if {$plus_in_modpath && $install_advversspec eq {y}} {
unsetenv_var MODULES_ADVANCED_VERSION_SPEC
}
# set up the environment

View File

@@ -184,11 +184,17 @@ lappend ans [list setpath _LMFILES_ $modulefile]
#
# The tests
#
if {$plus_in_modpath && $install_advversspec eq {y}} {
setenv_var MODULES_ADVANCED_VERSION_SPEC 0
}
test_cmd_re "ALL" "load $oth11p" $ans
# try with other full path name forms (./ and ../)
test_cmd_re "sh" "load $oth11pd" $ans
test_cmd_re "sh" "load $oth11pdd" $ans
if {$plus_in_modpath && $install_advversspec eq {y}} {
unsetenv_var MODULES_ADVANCED_VERSION_SPEC
}
#
# error when loading non existent module
@@ -227,11 +233,17 @@ unsetenv_var MODULES_IMPLICIT_DEFAULT
}
# try with other full path name forms (./ and ../)
if {$plus_in_modpath && $install_advversspec eq {y}} {
setenv_var MODULES_ADVANCED_VERSION_SPEC 0
}
set badmod "$reldmodpath/bad/before"
set out_interr [msg_load $modpath/bad/before [msg_moderr "$msg_invcmdname \"bad-command\"" {bad-command} $modpath/bad/before 26]]
testouterr_cmd "sh" "load $badmod" "ERR" $out_interr
set badmod "$relddmodpath/bad/before"
testouterr_cmd "sh" "load $badmod" "ERR" $out_interr
if {$plus_in_modpath && $install_advversspec eq {y}} {
unsetenv_var MODULES_ADVANCED_VERSION_SPEC
}
#
# test with file given as full path which is not a modulefile
@@ -252,9 +264,15 @@ testouterr_cmd "sh" "load $badmod" "ERR" $out_interr
#
setenv_loaded_module $module $modulefile
if {$plus_in_modpath && $install_advversspec eq {y}} {
setenv_var MODULES_ADVANCED_VERSION_SPEC 0
}
test_cmd_re "ALL" "load $oth11p" "OK"
test_cmd_re "sh" "load $oth11pd" "OK"
test_cmd_re "sh" "load $oth11pdd" "OK"
if {$plus_in_modpath && $install_advversspec eq {y}} {
unsetenv_var MODULES_ADVANCED_VERSION_SPEC
}
#
@@ -274,6 +292,9 @@ unsetenv_var MODULES_IMPLICIT_DEFAULT
#
# test to load full path a modulefile already loaded with short name
#
if {$plus_in_modpath && $install_advversspec eq {y}} {
setenv_var MODULES_ADVANCED_VERSION_SPEC 0
}
setenv_loaded_module $mod11 $mod11p
test_cmd_re "sh" "load $mod11p" "OK"
@@ -287,6 +308,10 @@ test_cmd_re "sh" "load $mod11p" "OK"
test_cmd_re "sh" "load $mod11pd" "OK"
test_cmd_re "sh" "load $mod11pdd" "OK"
if {$plus_in_modpath && $install_advversspec eq {y}} {
unsetenv_var MODULES_ADVANCED_VERSION_SPEC
}
#
# test module already loaded as full path, try to load again with short name

View File

@@ -54,7 +54,13 @@ lappend ans [list unsetpath MODULEPATH]
lappend ans [list setpath LOADEDMODULES $modulefile]
lappend ans [list setpath _LMFILES_ $modulefile]
if {$plus_in_modpath && $install_advversspec eq {y}} {
setenv_var MODULES_ADVANCED_VERSION_SPEC 0
}
testouterr_cmd "sh" "load $modulefile" $ans ""
if {$plus_in_modpath && $install_advversspec eq {y}} {
unsetenv_var MODULES_ADVANCED_VERSION_SPEC
}
#
# Cleanup

View File

@@ -30,6 +30,10 @@ set mpre "$modpathre.deps"
# setup specific environment
setenv_path_var MODULEPATH $mp
if {$plus_in_modpath && $install_advversspec eq {y}} {
setenv_var MODULES_ADVANCED_VERSION_SPEC 0
}
# reflexive conflict
set ans [list]

View File

@@ -30,7 +30,13 @@ setenv_path_var MODULEPATH $mp
testouterr_cmd "sh" "load mt" "ERR" [msg_load ms [err_conloi mt]]\n\n[msg_load mt [err_reqlo ms]]
# is-loading conflict check with fully qualified modulefile
if {$plus_in_modpath && $install_advversspec eq {y}} {
setenv_var MODULES_ADVANCED_VERSION_SPEC 0
}
testouterr_cmd "sh" "load mtf" "ERR" [msg_load $mp/msf [err_conloi $mp/mtf]]\n\n[msg_load mtf [err_reqlo $mp/msf]]
if {$plus_in_modpath && $install_advversspec eq {y}} {
unsetenv_var MODULES_ADVANCED_VERSION_SPEC
}
# conflict consistency check
set ans [list]

View File

@@ -470,7 +470,13 @@ lappend ans [list setpath MODULEPATH $modpath:$modpath.2]
lappend ans [list setpath LOADEDMODULES $c2lm:$modpath.2/restore]
lappend ans [list setpath _LMFILES_ $c2lmf:$modpath.2/restore]
if {$plus_in_modpath && $install_advversspec eq {y}} {
setenv_var MODULES_ADVANCED_VERSION_SPEC 0
}
testouterr_cmd_re sh "load $modpath.2/restore" $ans "Unloading loc_dv2/1.0\nunload coll/a\nUnloading coll/a\nload coll/c\nLoading coll/c\nload coll/a\nLoading coll/a\nload coll/b\nLoading coll/b"
if {$plus_in_modpath && $install_advversspec eq {y}} {
unsetenv_var MODULES_ADVANCED_VERSION_SPEC
}
#

View File

@@ -185,9 +185,15 @@ testouterr_cmd_re "csh" "di $module_1" "OK" "$out_pat"
# test with module passed as full path
if {$plus_in_modpath && $install_advversspec eq {y}} {
setenv_var MODULES_ADVANCED_VERSION_SPEC 0
}
testouterr_cmd_re "csh" "display $modulefile_1" "OK" "$out_pat"
testouterr_cmd_re "csh" "display $modulefile_1_reld" "OK" "$out_pat"
testouterr_cmd_re "csh" "display $modulefile_1_reldd" "OK" "$out_pat"
if {$plus_in_modpath && $install_advversspec eq {y}} {
unsetenv_var MODULES_ADVANCED_VERSION_SPEC
}
# setup MODULEPATH with a trailing slash and an empty dir element
setenv_path_var MODULEPATH {} "$modpath/"
@@ -228,9 +234,15 @@ testouterr_cmd_re "csh" "display $module_4" "OK" "$out_pat_4"
testouterr_cmd_re "csh" "display $module_5" "ERR" "$out_interr_5"
# test with module passed as full path
if {$plus_in_modpath && $install_advversspec eq {y}} {
setenv_var MODULES_ADVANCED_VERSION_SPEC 0
}
testouterr_cmd_re "csh" "display $modulefile_5" "ERR" "$out_interr_5"
testouterr_cmd_re "csh" "display $modulefile_5_reld" "ERR" "$out_interr_5"
testouterr_cmd_re "csh" "display $modulefile_5_reldd" "ERR" "$out_interr_5"
if {$plus_in_modpath && $install_advversspec eq {y}} {
unsetenv_var MODULES_ADVANCED_VERSION_SPEC
}
# test small width terminal
set test_cols 60

View File

@@ -107,9 +107,15 @@ set out_err_4 "$err_path'$module_4'"
# test stderr output
testouterr_cmd_re "sh" "help $module" "OK" "$err_help"
# test with module passed as full path
if {$plus_in_modpath && $install_advversspec eq {y}} {
setenv_var MODULES_ADVANCED_VERSION_SPEC 0
}
testouterr_cmd_re "sh" "help $modulefile" "OK" "$err_help"
testouterr_cmd_re "sh" "help $modulefile_reld" "OK" "$err_help"
testouterr_cmd_re "sh" "help $modulefile_reldd" "OK" "$err_help"
if {$plus_in_modpath && $install_advversspec eq {y}} {
unsetenv_var MODULES_ADVANCED_VERSION_SPEC
}
# test debug mode
testouterr_cmd_re "sh" "-D help $module" "OK" "$err_debug_help"
@@ -125,9 +131,15 @@ testouterr_cmd_re "sh" "help $module_2" "ERR" "$out_interr"
# test with erroneous ModulesHelp proc in modulefile
testouterr_cmd_re "sh" "help $module_3" "ERR" "$out_interr_3"
# test with module passed as full path
if {$plus_in_modpath && $install_advversspec eq {y}} {
setenv_var MODULES_ADVANCED_VERSION_SPEC 0
}
testouterr_cmd_re "sh" "help $modulefile_3" "ERR" "$out_interr_3"
testouterr_cmd_re "sh" "help $modulefile_3_reld" "ERR" "$out_interr_3"
testouterr_cmd_re "sh" "help $modulefile_3_reldd" "ERR" "$out_interr_3"
if {$plus_in_modpath && $install_advversspec eq {y}} {
unsetenv_var MODULES_ADVANCED_VERSION_SPEC
}
# test on unexistant modulefile
testouterr_cmd "sh" "help $module_4" "ERR" "$out_err_4"

View File

@@ -76,9 +76,15 @@ set mod6_err "$err_path'$module6'"
# missing procedure
testouterr_cmd_re "sh" "test $module" "OK" "$modlin\n$lin_test$modulefile:\n\n$missing_test$modulefile.\n$modlin"
# test with module passed as full path
if {$plus_in_modpath && $install_advversspec eq {y}} {
setenv_var MODULES_ADVANCED_VERSION_SPEC 0
}
testouterr_cmd_re "sh" "test $modulefile_full" "OK" "$modlin\n$lin_test$modulefile:\n\n$missing_test$modulefile.\n$modlin"
testouterr_cmd_re "sh" "test $modulefile_reld" "OK" "$modlin\n$lin_test$modulefile:\n\n$missing_test$modulefile.\n$modlin"
testouterr_cmd_re "sh" "test $modulefile_reldd" "OK" "$modlin\n$lin_test$modulefile:\n\n$missing_test$modulefile.\n$modlin"
if {$plus_in_modpath && $install_advversspec eq {y}} {
unsetenv_var MODULES_ADVANCED_VERSION_SPEC
}
# missing return value
testouterr_cmd_re "sh" "test $module2" "ERR" "$modlin\n$lin_test$modulefile2:\n\nTest_err\n$fail_test\n$modlin"
@@ -101,9 +107,15 @@ testouterr_cmd_re "sh" "test $module4" "ERR" "$mod4_interr"
# test with erroneous ModulesTest proc in modulefile
testouterr_cmd_re "sh" "test $module5" "ERR" "$modlin\n$lin_test$modulefile5/proc:\n\n$mod5_interr\n$modlin"
# test with module passed as full path
if {$plus_in_modpath && $install_advversspec eq {y}} {
setenv_var MODULES_ADVANCED_VERSION_SPEC 0
}
testouterr_cmd_re "sh" "test $modulefile5_full" "ERR" "$modlin\n$lin_test$modulefile5/proc:\n\n$mod5_interr\n$modlin"
testouterr_cmd_re "sh" "test $modulefile5_reld" "ERR" "$modlin\n$lin_test$modulefile5/proc:\n\n$mod5_interr\n$modlin"
testouterr_cmd_re "sh" "test $modulefile5_reldd" "ERR" "$modlin\n$lin_test$modulefile5/proc:\n\n$mod5_interr\n$modlin"
if {$plus_in_modpath && $install_advversspec eq {y}} {
unsetenv_var MODULES_ADVANCED_VERSION_SPEC
}
# test on unexistant modulefile
testouterr_cmd "sh" "test $module6" "ERR" "$mod6_err"