ts: tests module path/name/version finishing by a space char

This commit is contained in:
Xavier Delaruelle
2020-03-16 22:01:43 +01:00
parent 964dd5baf8
commit 650ca9881d
14 changed files with 450 additions and 15 deletions

View File

@@ -1,4 +1,5 @@
module use --append {testsuite/modulefiles wspace}
module load {space yc/4}
module load foo/1
module load {space y /1 }

View File

@@ -1,3 +1,4 @@
module use --append {testsuite/modulefiles wspace}
module load {space yc/4} {space yc/5} foo/1
module load {bar/2}
module load {space y /1 }

View File

@@ -0,0 +1,2 @@
#%Module
prereq {space y @1 } baz @:1

View File

@@ -0,0 +1,2 @@
#%Module
prereq {space y @a } baz @:1

View File

@@ -0,0 +1,2 @@
#%Module
conflict {space y @1 } baz @:1

View File

@@ -0,0 +1,2 @@
#%Module
conflict {space y @n } baz @:1

View File

@@ -549,6 +549,39 @@ if {[info exists tclsh_version]} {
send_user "\tFail to detect tclsh version. Fallback to $tclsh_version version\n$errMsg"
}
# create test modulefiles on the fly as those files finishing by a space character cannot
# be recorded in git repository (checkout will fail on Windows platform)
proc create_endspace_test_modulefiles {} {
set mp $::modpath.2
set module {space y }
file mkdir $mp/$module
set fid [open $mp/$module/.modulerc w]
puts $fid {#%Module
module-version {space y /1 } {n }
module-version {space y /2.2} default
module-alias {space y /a } {space y /1 }
module-virtual {space y /v } {./1 }}
close $fid
foreach f [list {1 } 2.2 2.5 2.7 2.10] {
set fid [open $mp/$module/$f w]
puts $fid {#%Module
module-whatis [module-info name]}
close $fid
}
}
proc delete_endspace_test_modulefiles {} {
set mp $::modpath.2
set module {space y }
foreach f [list .modulerc {1 } 2.2 2.5 2.7 2.10] {
file delete $mp/$module/$f
}
file delete $mp/$module
}
#
# Set up the config-file variable if possible
#

View File

@@ -607,6 +607,152 @@ unsetenv_path_var MODULES_LMALTNAME
}
#
# tests of modules finishing with whitespace in modulepath finishing by a whitespace
#
set mp "$modpath wspac "
set mpre "$modpathre wspac "
if {!$is_symlink_supported} {
send_user "\tskipping tests over '$mp' modulepath as symbolic links are not supported on filesystem\n"
} else {
# generate modulefiles that cannot be recorded in git repository
create_endspace_test_modulefiles
# create modulepath finishing by space on the file (it crashes git checkout on Windows if saved in repo)
file link -symbolic $mp modulefiles.2
setenv_path_var MODULEPATH $mp
# unknown module
testouterr_cmd sh {avail -t un\ k} OK {}
testouterr_cmd sh {whatis un\ k} ERR "$err_path'un k'"
testouterr_cmd sh {load un\ k} ERR "$err_path'un k'"
testouterr_cmd sh {path un\ k} OK "$err_path'un k'"
testouterr_cmd sh {display un\ k} ERR "$err_path'un k'"
# add another modulepath
set ans [list]
lappend ans [list setpath MODULEPATH "$modpath:$mp"]
testouterr_cmd_re sh "use $modpath" $ans {}
set ans [list]
lappend ans [list unsetpath MODULEPATH]
testouterr_cmd sh "unuse $modpath\\ wspac\\ " $ans {}
# module whose name and target finish with space character
testouterr_cmd sh {avail -t space\ y\ /1\ } OK "$mp:\nspace y /1 (n )"
testouterr_cmd_re sh {whatis space\ y\ /1\ } OK "$modlin $mpre $modlin\n\\s+space y /1 : space y /1 "
set ans [list]
lappend ans [list setpath LOADEDMODULES "space y /1 "]
lappend ans [list setpath _LMFILES_ "$mp/space y /1 "]
lappend ans [list setpath MODULES_LMALTNAME "space y /1 &space y /n &space y /a "]
testouterr_cmd sh {load space\ y\ /1\ } $ans {}
testouterr_cmd sh {path space\ y\ /1\ } [list [list text "$mp/space y /1 "]] {}
testouterr_cmd_re sh {display space\ y\ /1\ } OK "$modlin\n$mpre/space y /1 :\n\nmodule-whatis\t{space y /1 }\n$modlin"
setenv_loaded_module [list "space\ y\ /1 "] [list "$mp/space y /1 "]
setenv_path_var MODULES_LMALTNAME "space y /1 &space y /n &space y /a "
testouterr_cmd sh {list} OK "$cur_loaded\n 1) space y /1 (n ) "
set ans [list]
lappend ans [list unsetpath LOADEDMODULES]
lappend ans [list unsetpath _LMFILES_]
lappend ans [list unsetpath MODULES_LMALTNAME]
testouterr_cmd sh {unload space\ y\ /1\ } $ans {}
# add another module
set ans [list]
lappend ans [list setpath LOADEDMODULES "space y /1 :space y /2.2"]
lappend ans [list setpath _LMFILES_ "$mp/space y /1 :$mp/space y /2.2"]
lappend ans [list setpath MODULES_LMALTNAME "space y /1 &space y /n &space y /a :space y /2.2&space y /default&space y "]
testouterr_cmd_re sh {load space\ y\ /2.2} $ans {}
unsetenv_loaded_module
unsetenv_path_var MODULES_LMALTNAME
# alias whose name and target finish with space character
testouterr_cmd sh {avail -t space\ y\ /a\ } OK "$mp:\nspace y /a (@)"
testouterr_cmd_re sh {whatis space\ y\ /a\ } OK "$modlin $mpre $modlin\n\\s+space y /1 : space y /1 "
set ans [list]
lappend ans [list setpath LOADEDMODULES "space y /1 "]
lappend ans [list setpath _LMFILES_ "$mp/space y /1 "]
lappend ans [list setpath MODULES_LMALTNAME "space y /1 &space y /n &space y /a "]
testouterr_cmd sh {load space\ y\ /a\ } $ans {}
testouterr_cmd sh {path space\ y\ /a\ } [list [list text "$mp/space y /1 "]] {}
testouterr_cmd_re sh {display space\ y\ /a\ } OK "$modlin\n$mpre/space y /1 :\n\nmodule-whatis\t{space y /1 }\n$modlin"
setenv_loaded_module [list "space y /1 "] [list "$mp/space y /1 "]
setenv_path_var MODULES_LMALTNAME "space y /1 &space y /n &space y /a "
testouterr_cmd sh {list} OK "$cur_loaded\n 1) space y /1 (n ) "
set ans [list]
lappend ans [list unsetpath LOADEDMODULES]
lappend ans [list unsetpath _LMFILES_]
lappend ans [list unsetpath MODULES_LMALTNAME]
testouterr_cmd sh {unload space\ y\ /a\ } $ans {}
unsetenv_loaded_module
unsetenv_path_var MODULES_LMALTNAME
# symbolic version whose name and target finish with space character
testouterr_cmd sh {avail -t space\ y\ /n\ } OK "$mp:\nspace y /1 (n )"
testouterr_cmd_re sh {whatis space\ y\ /n\ } OK "$modlin $mpre $modlin\n\\s+space y /1 : space y /1 "
set ans [list]
lappend ans [list setpath LOADEDMODULES "space y /1 "]
lappend ans [list setpath _LMFILES_ "$mp/space y /1 "]
lappend ans [list setpath MODULES_LMALTNAME "space y /1 &space y /n &space y /a "]
testouterr_cmd sh {load space\ y\ /n\ } $ans {}
testouterr_cmd sh {path space\ y\ /n\ } [list [list text "$mp/space y /1 "]] {}
testouterr_cmd_re sh {display space\ y\ /n\ } OK "$modlin\n$mpre/space y /1 :\n\nmodule-whatis\t{space y /1 }\n$modlin"
setenv_loaded_module [list "space y /1 "] [list "$mp/space y /1 "]
setenv_path_var MODULES_LMALTNAME "space y /1 &space y /n &space y /a "
testouterr_cmd sh {list} OK "$cur_loaded\n 1) space y /1 (n ) "
set ans [list]
lappend ans [list unsetpath LOADEDMODULES]
lappend ans [list unsetpath _LMFILES_]
lappend ans [list unsetpath MODULES_LMALTNAME]
testouterr_cmd sh {unload space\ y\ /n\ } $ans {}
unsetenv_loaded_module
unsetenv_path_var MODULES_LMALTNAME
# default version
testouterr_cmd sh {avail -t space\ y\ /default} OK "$mp:\nspace y /2.2(default)"
testouterr_cmd_re sh {whatis space\ y\ /default} OK "$modlin $mpre $modlin\n\\s+space y /2.2: space y /2.2"
set ans [list]
lappend ans [list setpath LOADEDMODULES "space y /2.2"]
lappend ans [list setpath _LMFILES_ "$mp/space y /2.2"]
lappend ans [list setpath MODULES_LMALTNAME "space y /2.2&space y /default&space y "]
testouterr_cmd sh {load space\ y\ } $ans {}
testouterr_cmd sh {path space\ y\ } [list [list text "$mp/space y /2.2"]] {}
testouterr_cmd_re sh {display space\ y\ } OK "$modlin\n$mpre/space y /2.2:\n\nmodule-whatis\t{space y /2.2}\n$modlin"
setenv_loaded_module [list "space y /2.2"] [list "$mp/space y /2.2"]
setenv_path_var MODULES_LMALTNAME "space y /2.2&space y /default&space y "
testouterr_cmd sh {list} OK "$cur_loaded\n 1) space y /2.2(default) "
set ans [list]
lappend ans [list unsetpath LOADEDMODULES]
lappend ans [list unsetpath _LMFILES_]
lappend ans [list unsetpath MODULES_LMALTNAME]
testouterr_cmd sh {unload space\ y\ } $ans {}
unsetenv_loaded_module
unsetenv_path_var MODULES_LMALTNAME
# virtual module whose name and target finish with space character
testouterr_cmd sh {avail -t space\ y\ /v\ } OK "$mp:\nspace y /v "
testouterr_cmd_re sh {whatis space\ y\ /v\ } OK "$modlin $mpre $modlin\n\\s+space y /v : space y /v "
set ans [list]
lappend ans [list setpath LOADEDMODULES "space y /v "]
lappend ans [list setpath _LMFILES_ "$mp/space y /1 "]
testouterr_cmd sh {load space\ y\ /v\ } $ans {}
testouterr_cmd sh {path space\ y\ /v\ } [list [list text "$mp/space y /1 "]] {}
testouterr_cmd_re sh {display space\ y\ /v\ } OK "$modlin\n$mpre/space y /1 :\n\nmodule-whatis\t{space y /v }\n$modlin"
setenv_loaded_module [list "space y /v "] [list "$mp/space y /1 "]
testouterr_cmd sh {list} OK "$cur_loaded\n 1) space y /v "
set ans [list]
lappend ans [list unsetpath LOADEDMODULES]
lappend ans [list unsetpath _LMFILES_]
testouterr_cmd sh {unload space\ y\ /v\ } $ans {}
unsetenv_loaded_module
# delete modulepath link created for the test
file delete $mp
# delete generated modulefiles
delete_endspace_test_modulefiles
}
#
# Cleanup

View File

@@ -154,12 +154,14 @@ set c15modpath1 "$modpath wspace"
set c15modpath1re "$modpathre wspace"
set c15mod1 {space yc/4}
set c15mod2 foo/1
set c15mod3 {space y /1 }
set c16modpath1 "$modpath wspace"
set c16modpath1re "$modpathre wspace"
set c16mod1 {space yc/4}
set c16mod2 {space yc/5}
set c16mod3 foo/1
set c16mod4 bar/2
set c16mod5 {space y /1 }
set cdlmf "$cdmodpath1/$cdmod1:$cdmodpath1/$cdmod2:$cdmodpath1/$cdmod3:$cdmodpath1/$cdmod4:$cdmodpath1/$cdmod5"
set cdlm "$cdmod1:$cdmod2:$cdmod3:$cdmod4:$cdmod5"
@@ -208,11 +210,13 @@ set c13lmf $cdlmf
set c13lmalt $cdlmalt
set c13modpath $cdmodpath
set c15modpath $c15modpath1
set c15lmf $c15modpath1/$c15mod1:$c15modpath1/$c15mod2
set c15lm $c15mod1:$c15mod2
set c15lmf $c15modpath1/$c15mod1:$c15modpath1/$c15mod2:$c15modpath1/$c15mod3
set c15lm $c15mod1:$c15mod2:$c15mod3
set c15lmalt {space y /1 &space y /n &space y /a }
set c16modpath $c16modpath1
set c16lmf $c15modpath1/$c16mod1:$c16modpath1/$c16mod2:$c16modpath1/$c16mod3:$c16modpath1/$c16mod4
set c16lm $c16mod1:$c16mod2:$c16mod3:$c16mod4
set c16lmf $c15modpath1/$c16mod1:$c16modpath1/$c16mod2:$c16modpath1/$c16mod3:$c16modpath1/$c16mod4:$c16modpath1/$c16mod5
set c16lm $c16mod1:$c16mod2:$c16mod3:$c16mod4:$c16mod5
set c16lmalt {space y /1 &space y /n &space y /a }
set mlu "module use --append"
set mll "module load"
@@ -232,7 +236,10 @@ set c7contre "$mll $c7mod1rel\n$mll $c7mod2rel\n$mll $c7mod3rel\n"
set c8cont "$mlu $c8modpath1\n$mll $c8mod1\n$mll $c8mod2\n$mll $c8mod3\n"
set c9cont "$mlu $c9modpath1\n$mll $c9mod1\n$mll --notuasked $c9mod2\n$mll $c9mod3\n"
set c11cont "$mlu $c11modpath1\n$mll --notuasked $c11mod1\n$mll $c11mod2\n"
set c15cont "$mlu {$c15modpath1}\n$mll {$c15mod1}\n$mll $c15mod2\n"
set c15contre "$mlu {$c15modpath1re}\n$mll {$c15mod1}\n$mll $c15mod2\n"
set c16cont "$mlu {$c16modpath1}\n$mll {$c16mod1}\n$mll {$c16mod2}\n$mll $c16mod3\n$mll $c16mod4\n"
set c16contre "$mlu {$c16modpath1re}\n$mll {$c16mod1}\n$mll {$c16mod2}\n$mll $c16mod3\n$mll $c16mod4\n"
set c15cont "$mlu {$c15modpath1}\n$mll {$c15mod1}\n$mll $c15mod2\n$mll {$c15mod3}\n"
set c15contre "$mlu {$c15modpath1re}\n$mll {$c15mod1}\n$mll $c15mod2\n$mll {$c15mod3}\n"
set c16cont "$mlu {$c16modpath1}\n$mll {$c16mod1}\n$mll {$c16mod2}\n$mll $c16mod3\n$mll $c16mod4\n$mll {$c16mod4}\n"
set c16contre "$mlu {$c16modpath1re}\n$mll {$c16mod1}\n$mll {$c16mod2}\n$mll $c16mod3\n$mll $c16mod4\n$mll {$c16mod5}\n"
# generate modulefiles that cannot be recorded in git repository
create_endspace_test_modulefiles

View File

@@ -239,10 +239,13 @@ testoutfile_cmd sh "save $coll11" OK $hometestdotmod/$coll11f $c11cont
unsetenv_path_var MODULES_LMPREREQ
eval setenv_path_var MODULEPATH [split $c15modpath :]
eval setenv_path_var MODULES_LMALTNAME [split $c15lmalt :]
setenv_loaded_module [split $c15lm :] [split $c15lmf :]
testoutfile_cmd sh "save $coll15" OK $hometestdotmod/$coll15f $c15cont
unsetenv_path_var MODULES_LMALTNAME
#
# test unsetting HOME

View File

@@ -41,8 +41,8 @@ set c11errmsg "load $c11mod1\nLoading $c11mod1\nload $c11mod2\nLoading $c11mod2"
set c12errmsg "unload $c9mod3\nUnloading $c9mod3\nunload $c9mod2\nUnloading $c9mod2\nunload $c9mod1\nUnloading $c9mod1\nload f4\nLoading f4\nload f5\nLoading f5\n\n[msg_load f6 [err_conlo f5]]\n\n[msg_load f7 [err_reqmis f6]]"
set c13errmsg $cderrmsg
set c14errmsg "unload m2\nUnloading m2\nload m3\nLoading m3"
set c15errmsg "Loading $c15mod1\nLoading $c15mod2"
set c16errmsg "Loading $c16mod1\nLoading $c16mod2\nLoading $c16mod3\nLoading $c16mod4"
set c15errmsg "Loading $c15mod1\nLoading $c15mod2\nLoading $c15mod3"
set c16errmsg "Loading $c16mod1\nLoading $c16mod2\nLoading $c16mod3\nLoading $c16mod4\nLoading $c16mod5"
# set HOME to location containing collections
set ORIG_HOME $env(HOME)
@@ -537,12 +537,14 @@ set ans [list]
lappend ans [list setpath MODULEPATH $c15modpath]
lappend ans [list setpath LOADEDMODULES $c15lm]
lappend ans [list setpath _LMFILES_ $c15lmf]
lappend ans [list setpath MODULES_LMALTNAME $c15lmalt]
testouterr_cmd_re sh "restore $coll15fp" $ans $c15errmsg
set ans [list]
lappend ans [list setpath MODULEPATH $c16modpath]
lappend ans [list setpath LOADEDMODULES $c16lm]
lappend ans [list setpath _LMFILES_ $c16lmf]
lappend ans [list setpath MODULES_LMALTNAME $c16lmalt]
testouterr_cmd_re sh "restore $coll16fp" $ans $c16errmsg
}

View File

@@ -24,6 +24,9 @@ if { $verbose > 1 } {
send_user "\tCleaning up after collection tests ...\n"
}
# delete generated modulefiles
delete_endspace_test_modulefiles
# delete collections and associated dirs saved during this test
set testcoll_list [glob -nocomplain -- "$hometestdotmod/*"]
foreach testcoll $testcoll_list {

View File

@@ -42,6 +42,9 @@ if {!$is_symlink_supported} {
send_user "\tskipping tests over '$mp' modulepath as symbolic links are not supported on filesystem\n"
} else {
# generate modulefiles that cannot be recorded in git repository
create_endspace_test_modulefiles
# enable advanced version spec for next tests
setenv_var MODULES_ADVANCED_VERSION_SPEC 1
@@ -90,6 +93,13 @@ lappend ans [list setpath _LMFILES_ "$mp/sp.ce y+/0 2"]
testouterr_cmd sh {load sp.ce\ y+ @0\ 2} $ans {}
testouterr_cmd sh {load sp.ce\ y+@0\ 2} $ans {}
set ans [list]
lappend ans [list setpath LOADEDMODULES "space y /1 "]
lappend ans [list setpath _LMFILES_ "$mp/space y /1 "]
lappend ans [list setpath MODULES_LMALTNAME "space y /1 &space y /n &space y /a "]
testouterr_cmd sh {load space\ y\ @1\ } $ans {}
testouterr_cmd sh {load space\ y\ @1\ } $ans {}
# various syntaxes on prereq modulefile command
@@ -116,7 +126,12 @@ lappend ans [list setpath MODULES_LMPREREQ "space ye/1.2&{sp.ce y+} @2.5<2.7|baz
lappend ans [list setpath MODULES_LMNOTUASKED "sp.ce y+/2.7"]
testouterr_cmd_re sh {load --auto space\ ye@1.2} $ans [msg_top_load "{space ye/1.2}" {} {sp.ce y\\+/2.7} {}]
testouterr_cmd sh {load --auto space\ ye@1.3} ERR [msg_load {space ye/1.3} [msg_moderr {extra characters after close-brace} {prereq {sp.ce y+}@} "$mp/space ye/1.3" 2]]
if {[cmpversion $tclsh_version 8.6] == -1} {
set errcmd "prereq {sp.ce y+}@2.5:2.7 baz @:1\n"
} else {
set errcmd {prereq {sp.ce y+}@}
}
testouterr_cmd sh {load --auto space\ ye@1.3} ERR [msg_load {space ye/1.3} [msg_moderr {extra characters after close-brace} $errcmd "$mp/space ye/1.3" 2]]
set ans [list]
lappend ans [list setpath LOADEDMODULES "sp.ce y+/2.7:space ye/1.4"]
@@ -146,6 +161,22 @@ lappend ans [list setpath MODULES_LMPREREQ "space ye/1.7&{sp.ce y+@0 2}|baz @<1"
lappend ans [list setpath MODULES_LMNOTUASKED "sp.ce y+/0 2"]
testouterr_cmd_re sh {load --auto space\ ye@1.7} $ans [msg_top_load "{space ye/1.7}" {} {sp.ce y\\+/0 2} {}]
set ans [list]
lappend ans [list setpath LOADEDMODULES "space y /1 :space ye/1.8"]
lappend ans [list setpath _LMFILES_ "$mp/space y /1 :$mp/space ye/1.8"]
lappend ans [list setpath MODULES_LMPREREQ "space ye/1.8&{space y @1 }|baz @<1"]
lappend ans [list setpath MODULES_LMNOTUASKED "space y /1 "]
lappend ans [list setpath MODULES_LMALTNAME "space y /1 &space y /n &space y /a "]
testouterr_cmd_re sh {load --auto space\ ye@1.8} $ans [msg_top_load "{space ye/1.8}" {} "{space y /1 }" {}]
set ans [list]
lappend ans [list setpath LOADEDMODULES "space y /1 :space ye/1.9"]
lappend ans [list setpath _LMFILES_ "$mp/space y /1 :$mp/space ye/1.9"]
lappend ans [list setpath MODULES_LMPREREQ "space ye/1.9&{space y @a }|baz @<1"]
lappend ans [list setpath MODULES_LMNOTUASKED "space y /1 "]
lappend ans [list setpath MODULES_LMALTNAME "space y /1 &space y /n &space y /a "]
testouterr_cmd_re sh {load --auto space\ ye@1.9} $ans [msg_top_load "{space ye/1.9}" {} "{space y /1 }" {}]
setenv_loaded_module [list {sp.ce y+/2.7}] [list "$mp/sp.ce y+/2.7"]
set ans [list]
@@ -196,6 +227,21 @@ lappend ans [list setpath _LMFILES_ "$mp/sp.ce y+/0 2:$mp/space ye/1.7"]
lappend ans [list setpath MODULES_LMPREREQ "space ye/1.7&{sp.ce y+@0 2}|baz @<1"]
testouterr_cmd_re sh {load --auto space\ ye@1.7} $ans {}
setenv_loaded_module [list {space y /1 }] [list "$mp/space y /1 "]
setenv_path_var MODULES_LMALTNAME "space y /1 &space y /n &space y /a "
set ans [list]
lappend ans [list setpath LOADEDMODULES "space y /1 :space ye/1.8"]
lappend ans [list setpath _LMFILES_ "$mp/space y /1 :$mp/space ye/1.8"]
lappend ans [list setpath MODULES_LMPREREQ "space ye/1.8&{space y @1 }|baz @<1"]
testouterr_cmd_re sh {load --auto space\ ye@1.8} $ans {}
set ans [list]
lappend ans [list setpath LOADEDMODULES "space y /1 :space ye/1.9"]
lappend ans [list setpath _LMFILES_ "$mp/space y /1 :$mp/space ye/1.9"]
lappend ans [list setpath MODULES_LMPREREQ "space ye/1.9&{space y @a }|baz @<1"]
testouterr_cmd_re sh {load --auto space\ ye@1.9} $ans {}
setenv_loaded_module [list {baz/1}] [list "$mp/baz/1"]
set ans [list]
@@ -290,6 +336,28 @@ lappend ans [list unsetpath _LMFILES_]
lappend ans [list unsetpath MODULES_LMPREREQ]
testouterr_cmd sh {unload --auto sp.ce\ y+/0\ 2} $ans [msg_top_unload "{sp.ce y+/0 2}" {space ye/1.7} {} {}]
setenv_loaded_module [list {space y /1 } {space ye/1.8}] [list "$mp/space y /1 " "$mp/space ye/1.8"]
setenv_path_var MODULES_LMPREREQ "space ye/1.8&{space y @1 }|baz @<1"
setenv_path_var MODULES_LMALTNAME "space y /1 &space y /n &space y /a "
set ans [list]
lappend ans [list unsetpath LOADEDMODULES]
lappend ans [list unsetpath _LMFILES_]
lappend ans [list unsetpath MODULES_LMPREREQ]
lappend ans [list unsetpath MODULES_LMALTNAME]
testouterr_cmd sh {unload --auto space\ y\ /1\ } $ans [msg_top_unload "{space y /1 }" {space ye/1.8} {} {}]
testouterr_cmd sh {unload --auto space\ y\ /a\ } $ans [msg_top_unload "{space y /1 }" {space ye/1.8} {} {}]
setenv_loaded_module [list {space y /1 } {space ye/1.9}] [list "$mp/space y /1 " "$mp/space ye/1.9"]
setenv_path_var MODULES_LMPREREQ "space ye/1.9&{space y @a }|baz @<1"
setenv_path_var MODULES_LMALTNAME "space y /1 &space y /n &space y /a "
set ans [list]
lappend ans [list unsetpath LOADEDMODULES]
lappend ans [list unsetpath _LMFILES_]
lappend ans [list unsetpath MODULES_LMPREREQ]
lappend ans [list unsetpath MODULES_LMALTNAME]
testouterr_cmd sh {unload --auto space\ y\ /1\ } $ans [msg_top_unload "{space y /1 }" {space ye/1.9} {} {}]
testouterr_cmd sh {unload --auto space\ y\ /a\ } $ans [msg_top_unload "{space y /1 }" {space ye/1.9} {} {}]
unsetenv_path_var MODULES_LMALTNAME
# unload dependent module baz/1
@@ -349,6 +417,22 @@ lappend ans [list unsetpath _LMFILES_]
lappend ans [list unsetpath MODULES_LMPREREQ]
testouterr_cmd sh {unload --auto baz/1} $ans [msg_top_unload baz/1 {space ye/1.7} {} {}]
setenv_loaded_module [list {baz/1} {space ye/1.8}] [list "$mp/baz/1" "$mp/space ye/1.8"]
setenv_path_var MODULES_LMPREREQ "space ye/1.8&{space y @1 }|baz @<1"
set ans [list]
lappend ans [list unsetpath LOADEDMODULES]
lappend ans [list unsetpath _LMFILES_]
lappend ans [list unsetpath MODULES_LMPREREQ]
testouterr_cmd sh {unload --auto baz/1} $ans [msg_top_unload baz/1 {space ye/1.8} {} {}]
setenv_loaded_module [list {baz/1} {space ye/1.9}] [list "$mp/baz/1" "$mp/space ye/1.9"]
setenv_path_var MODULES_LMPREREQ "space ye/1.9&{space y @a }|baz @<1"
set ans [list]
lappend ans [list unsetpath LOADEDMODULES]
lappend ans [list unsetpath _LMFILES_]
lappend ans [list unsetpath MODULES_LMPREREQ]
testouterr_cmd sh {unload --auto baz/1} $ans [msg_top_unload baz/1 {space ye/1.9} {} {}]
# load depedent module {sp.ce y+/2.7}
setenv_loaded_module [list {baz/1} {space ye/1.0}] [list "$mp/baz/1" "$mp/space ye/1.0"]
@@ -405,6 +489,26 @@ lappend ans [list setpath _LMFILES_ "$mp/baz/1:$mp/sp.ce y+/0 2:$mp/space ye/1.7
lappend ans [list setpath MODULES_LMPREREQ "space ye/1.7&{sp.ce y+@0 2}|baz @<1"]
testouterr_cmd_re sh {load --auto sp.ce\ y+/0\ 2} $ans [msg_top_load "{sp.ce y\\+/0 2}" {} {} "{space ye/1.7}"]
setenv_loaded_module [list {baz/1} {space ye/1.8}] [list "$mp/baz/1" "$mp/space ye/1.8"]
setenv_path_var MODULES_LMPREREQ "space ye/1.8&{space y @1 }|baz @<1"
set ans [list]
lappend ans [list setpath LOADEDMODULES "baz/1:space y /1 :space ye/1.8"]
lappend ans [list setpath _LMFILES_ "$mp/baz/1:$mp/space y /1 :$mp/space ye/1.8"]
lappend ans [list setpath MODULES_LMPREREQ "space ye/1.8&{space y @1 }|baz @<1"]
lappend ans [list setpath MODULES_LMALTNAME "space y /1 &space y /n &space y /a "]
testouterr_cmd_re sh {load --auto space\ y\ /1\ } $ans [msg_top_load "{space y /1 }" {} {} "{space ye/1.8}"]
testouterr_cmd_re sh {load --auto space\ y\ /a\ } $ans [msg_top_load "{space y /1 }" {} {} "{space ye/1.8}"]
setenv_loaded_module [list {baz/1} {space ye/1.9}] [list "$mp/baz/1" "$mp/space ye/1.9"]
setenv_path_var MODULES_LMPREREQ "space ye/1.9&{space y @a }|baz @<1"
set ans [list]
lappend ans [list setpath LOADEDMODULES "baz/1:space y /1 :space ye/1.9"]
lappend ans [list setpath _LMFILES_ "$mp/baz/1:$mp/space y /1 :$mp/space ye/1.9"]
lappend ans [list setpath MODULES_LMPREREQ "space ye/1.9&{space y @a }|baz @<1"]
lappend ans [list setpath MODULES_LMALTNAME "space y /1 &space y /n &space y /a "]
testouterr_cmd_re sh {load --auto space\ y\ /1\ } $ans [msg_top_load "{space y /1 }" {} {} "{space ye/1.9}"]
testouterr_cmd_re sh {load --auto space\ y\ /a\ } $ans [msg_top_load "{space y /1 }" {} {} "{space ye/1.9}"]
# various syntaxes on conflict modulefile command
unsetenv_loaded_module
@@ -428,7 +532,12 @@ lappend ans [list setpath _LMFILES_ "$mp/space ye/2.2"]
lappend ans [list setpath MODULES_LMCONFLICT "space ye/2.2&{sp.ce y+} @2.5<2.7&baz @<1"]
testouterr_cmd sh {load --auto space\ ye@2.2} $ans {}
testouterr_cmd sh {load --auto space\ ye@2.3} ERR [msg_load {space ye/2.3} [msg_moderr {extra characters after close-brace} {conflict {sp.ce y+}@} "$mp/space ye/2.3" 2]]
if {[cmpversion $tclsh_version 8.6] == -1} {
set errcmd "conflict {sp.ce y+}@2.5:2.7 baz @:1\n"
} else {
set errcmd {conflict {sp.ce y+}@}
}
testouterr_cmd sh {load --auto space\ ye@2.3} ERR [msg_load {space ye/2.3} [msg_moderr {extra characters after close-brace} $errcmd "$mp/space ye/2.3" 2]]
set ans [list]
lappend ans [list setpath LOADEDMODULES "space ye/2.4"]
@@ -454,6 +563,18 @@ lappend ans [list setpath _LMFILES_ "$mp/space ye/2.7"]
lappend ans [list setpath MODULES_LMCONFLICT "space ye/2.7&{sp.ce y+@0 2}&baz @<1"]
testouterr_cmd sh {load --auto space\ ye@2.7} $ans {}
set ans [list]
lappend ans [list setpath LOADEDMODULES "space ye/2.8"]
lappend ans [list setpath _LMFILES_ "$mp/space ye/2.8"]
lappend ans [list setpath MODULES_LMCONFLICT "space ye/2.8&{space y @1 }&baz @<1"]
testouterr_cmd sh {load --auto space\ ye@2.8} $ans {}
set ans [list]
lappend ans [list setpath LOADEDMODULES "space ye/2.9"]
lappend ans [list setpath _LMFILES_ "$mp/space ye/2.9"]
lappend ans [list setpath MODULES_LMCONFLICT "space ye/2.9&{space y @n }&baz @<1"]
testouterr_cmd sh {load --auto space\ ye@2.9} $ans {}
# load conflicting module {sp.ce y+/2.7}
setenv_loaded_module [list {space ye/2.0}] [list "$mp/space ye/2.0"]
@@ -490,6 +611,16 @@ setenv_loaded_module [list {space ye/2.7}] [list "$mp/space ye/2.7"]
setenv_path_var MODULES_LMCONFLICT "space ye/2.7&{sp.ce y+@0 2}&baz @<1"
testouterr_cmd sh {load --auto sp.ce\ y+@0\ 2} ERR [msg_load {sp.ce y+/0 2} [err_conflict sp.ce\ y+/0\ 2 space\ ye/2.7]]
setenv_loaded_module [list {space ye/2.8}] [list "$mp/space ye/2.8"]
setenv_path_var MODULES_LMCONFLICT "space ye/2.8&{space y @1 }&baz @<1"
testouterr_cmd sh {load --auto space\ y\ @1\ } ERR [msg_load {space y /1 } [err_conflict space\ y\ /1\ space\ ye/2.8]]
testouterr_cmd sh {load --auto space\ y\ @n\ } ERR [msg_load {space y /1 } [err_conflict space\ y\ /1\ space\ ye/2.8]]
setenv_loaded_module [list {space ye/2.9}] [list "$mp/space ye/2.9"]
setenv_path_var MODULES_LMCONFLICT "space ye/2.9&{space y @n }&baz @<1"
testouterr_cmd sh {load --auto space\ y\ @1\ } ERR [msg_load {space y /1 } [err_conflict space\ y\ /1\ space\ ye/2.9]]
testouterr_cmd sh {load --auto space\ y\ @n\ } ERR [msg_load {space y /1 } [err_conflict space\ y\ /1\ space\ ye/2.9]]
# load conflicting module baz/1
setenv_loaded_module [list {space ye/2.0}] [list "$mp/space ye/2.0"]
@@ -520,6 +651,14 @@ setenv_loaded_module [list {space ye/2.7}] [list "$mp/space ye/2.7"]
setenv_path_var MODULES_LMCONFLICT "space ye/2.7&{sp.ce y+@0 2}&baz @<1"
testouterr_cmd sh {load --auto baz/1} ERR [msg_load {baz/1} [err_conflict baz/1 space\ ye/2.7]]
setenv_loaded_module [list {space ye/2.8}] [list "$mp/space ye/2.8"]
setenv_path_var MODULES_LMCONFLICT "space ye/2.8&{space y @1 }&baz @<1"
testouterr_cmd sh {load --auto baz/1} ERR [msg_load {baz/1} [err_conflict baz/1 space\ ye/2.8]]
setenv_loaded_module [list {space ye/2.9}] [list "$mp/space ye/2.9"]
setenv_path_var MODULES_LMCONFLICT "space ye/2.9&{space y @n }&baz @<1"
testouterr_cmd sh {load --auto baz/1} ERR [msg_load {baz/1} [err_conflict baz/1 space\ ye/2.9]]
# conflicting module {sp.ce y+/2.7} loaded prior conflict definition
unsetenv_path_var MODULES_LMCONFLICT
setenv_loaded_module [list {sp.ce y+/2.7}] [list "$mp/sp.ce y+/2.7"]
@@ -545,8 +684,15 @@ setenv_loaded_module [list {sp.ce y+/0 2}] [list "$mp/sp.ce y+/0 2"]
testouterr_cmd sh {load --auto space\ ye@2.6} ERR [msg_load {space ye/2.6} [err_conflict {space ye/2.6} {sp.ce y+ @0 2}]]
testouterr_cmd sh {load --auto space\ ye@2.7} ERR [msg_load {space ye/2.7} [err_conflict {space ye/2.7} {sp.ce y+@0 2}]]
setenv_loaded_module [list {space y /1 }] [list "$mp/space y /1 "]
setenv_path_var MODULES_LMALTNAME "space y /1 &space y /n &space y /a "
testouterr_cmd sh {load --auto space\ ye@2.8} ERR [msg_load {space ye/2.8} [err_conflict {space ye/2.8} {space y @1 }]]
testouterr_cmd sh {load --auto space\ ye@2.9} ERR [msg_load {space ye/2.9} [err_conflict {space ye/2.9} {space y @n }]]
# conflicting module baz/1 loaded prior conflict definition
unsetenv_path_var MODULES_LMCONFLICT
unsetenv_path_var MODULES_LMALTNAME
setenv_loaded_module [list baz/1] [list "$mp/baz/1"]
testouterr_cmd sh {load --auto space\ ye@2.0} ERR [msg_load {space ye/2.0} [err_conflict {space ye/2.0} {baz @:1}]]
@@ -556,6 +702,8 @@ testouterr_cmd sh {load --auto space\ ye@2.4} ERR [msg_load {space ye/2.4} [err_
testouterr_cmd sh {load --auto space\ ye@2.5} ERR [msg_load {space ye/2.5} [err_conflict {space ye/2.5} {baz @:1}]]
testouterr_cmd sh {load --auto space\ ye@2.6} ERR [msg_load {space ye/2.6} [err_conflict {space ye/2.6} {baz @:1}]]
testouterr_cmd sh {load --auto space\ ye@2.7} ERR [msg_load {space ye/2.7} [err_conflict {space ye/2.7} {baz @:1}]]
testouterr_cmd sh {load --auto space\ ye@2.8} ERR [msg_load {space ye/2.8} [err_conflict {space ye/2.8} {baz @:1}]]
testouterr_cmd sh {load --auto space\ ye@2.9} ERR [msg_load {space ye/2.9} [err_conflict {space ye/2.9} {baz @:1}]]
# redo the above mixed test with adv_vers_spec disabled
@@ -578,6 +726,14 @@ testouterr_cmd sh {load sp.ce\ y+ @1.2 @2.5:2.7} $ans "$err_path'@1.2'\n$err_pat
testouterr_cmd sh {load sp.ce\ y+ @0\ 2} $ans "$err_path'@0 2'"
testouterr_cmd sh {load sp.ce\ y+@0\ 2} ERR "$err_path'sp.ce y+@0 2'"
set ans [list]
lappend ans [list setpath LOADEDMODULES "space y /2.2"]
lappend ans [list setpath _LMFILES_ "$mp/space y /2.2"]
lappend ans [list setpath MODULES_LMALTNAME "space y /2.2&space y /default&space y "]
lappend ans [list ERR]
testouterr_cmd sh {load space\ y\ @1\ } $ans "$err_path'@1 '"
testouterr_cmd sh {load space\ y\ @1\ } ERR "$err_path'space y @1 '"
# various syntaxes on prereq modulefile command
set ans [list]
@@ -604,7 +760,12 @@ lappend ans [list setpath MODULES_LMPREREQ "space ye/1.2&sp.ce y+|@2.5<2.7|baz|@
lappend ans [list setpath MODULES_LMNOTUASKED "sp.ce y+/2.10"]
testouterr_cmd_re sh {load --auto space\ ye/1.2} $ans [msg_top_load "{space ye/1.2}" {} {sp.ce y\\+/2.10} {}]
testouterr_cmd sh {load --auto space\ ye/1.3} ERR [msg_load {space ye/1.3} [msg_moderr {extra characters after close-brace} {prereq {sp.ce y+}@} "$mp/space ye/1.3" 2]]
if {[cmpversion $tclsh_version 8.6] == -1} {
set errcmd "prereq {sp.ce y+}@2.5:2.7 baz @:1\n"
} else {
set errcmd {prereq {sp.ce y+}@}
}
testouterr_cmd sh {load --auto space\ ye/1.3} ERR [msg_load {space ye/1.3} [msg_moderr {extra characters after close-brace} $errcmd "$mp/space ye/1.3" 2]]
set ans [list]
lappend ans [list setpath LOADEDMODULES "baz/2:space ye/1.4"]
@@ -640,6 +801,24 @@ lappend ans [list setpath MODULES_LMNOTUASKED "baz/2"]
lappend ans [list ERR]
testouterr_cmd_re sh {load --auto space\ ye/1.7} $ans [msg_top_load "{space ye/1.7}" {} {baz/2} {} "$err_path'sp.ce y\\+@0 2'"]
set ans [list]
lappend ans [list setpath LOADEDMODULES "baz/2:space ye/1.8"]
lappend ans [list setpath _LMFILES_ "$mp/baz/2:$mp/space ye/1.8"]
#lappend ans [list setpath MODULES_LMPREREQ "space ye/1.8&{space y @1 }|baz|@<1"]
lappend ans [list setpath MODULES_LMPREREQ "space ye/1.8&space y @1 |baz|@<1"]
lappend ans [list setpath MODULES_LMNOTUASKED "baz/2"]
lappend ans [list ERR]
testouterr_cmd_re sh {load --auto space\ ye/1.8} $ans [msg_top_load "{space ye/1.8}" {} {baz/2} {} "$err_path'space y @1 '"]
set ans [list]
lappend ans [list setpath LOADEDMODULES "baz/2:space ye/1.9"]
lappend ans [list setpath _LMFILES_ "$mp/baz/2:$mp/space ye/1.9"]
#lappend ans [list setpath MODULES_LMPREREQ "space ye/1.9&{space y @a }|baz|@<1"]
lappend ans [list setpath MODULES_LMPREREQ "space ye/1.9&space y @a |baz|@<1"]
lappend ans [list setpath MODULES_LMNOTUASKED "baz/2"]
lappend ans [list ERR]
testouterr_cmd_re sh {load --auto space\ ye/1.9} $ans [msg_top_load "{space ye/1.9}" {} {baz/2} {} "$err_path'space y @a '"]
setenv_loaded_module [list {sp.ce y+/2.7}] [list "$mp/sp.ce y+/2.7"]
set ans [list]
@@ -761,7 +940,12 @@ lappend ans [list setpath _LMFILES_ "$mp/space ye/2.2"]
lappend ans [list setpath MODULES_LMCONFLICT "space ye/2.2&sp.ce y+&@2.5<2.7&baz&@<1"]
testouterr_cmd sh {load --auto space\ ye/2.2} $ans {}
testouterr_cmd sh {load --auto space\ ye/2.3} ERR [msg_load {space ye/2.3} [msg_moderr {extra characters after close-brace} {conflict {sp.ce y+}@} "$mp/space ye/2.3" 2]]
if {[cmpversion $tclsh_version 8.6] == -1} {
set errcmd "conflict {sp.ce y+}@2.5:2.7 baz @:1\n"
} else {
set errcmd {conflict {sp.ce y+}@}
}
testouterr_cmd sh {load --auto space\ ye/2.3} ERR [msg_load {space ye/2.3} [msg_moderr {extra characters after close-brace} $errcmd "$mp/space ye/2.3" 2]]
set ans [list]
lappend ans [list setpath LOADEDMODULES "space ye/2.4"]
@@ -791,6 +975,20 @@ lappend ans [list setpath _LMFILES_ "$mp/space ye/2.7"]
lappend ans [list setpath MODULES_LMCONFLICT "space ye/2.7&sp.ce y+@0 2&baz&@<1"]
testouterr_cmd sh {load --auto space\ ye/2.7} $ans {}
set ans [list]
lappend ans [list setpath LOADEDMODULES "space ye/2.8"]
lappend ans [list setpath _LMFILES_ "$mp/space ye/2.8"]
#lappend ans [list setpath MODULES_LMCONFLICT "space ye/2.8&{space y @1 }&baz&@<1"]
lappend ans [list setpath MODULES_LMCONFLICT "space ye/2.8&space y @1 &baz&@<1"]
testouterr_cmd sh {load --auto space\ ye/2.8} $ans {}
set ans [list]
lappend ans [list setpath LOADEDMODULES "space ye/2.9"]
lappend ans [list setpath _LMFILES_ "$mp/space ye/2.9"]
#lappend ans [list setpath MODULES_LMCONFLICT "space ye/2.9&{space y @n }&baz&@<1"]
lappend ans [list setpath MODULES_LMCONFLICT "space ye/2.9&space y @n &baz&@<1"]
testouterr_cmd sh {load --auto space\ ye/2.9} $ans {}
# load conflicting module {sp.ce y+/2.7}
setenv_loaded_module [list {space ye/2.1}] [list "$mp/space ye/2.1"]
@@ -847,6 +1045,12 @@ setenv_loaded_module [list baz/1] [list "$mp/baz/1"]
testouterr_cmd sh {load --auto space\ ye/2.1} ERR [msg_load {space ye/2.1} [err_conflict {space ye/2.1} {baz}]]
testouterr_cmd sh {load --auto space\ ye/2.5} ERR [msg_load {space ye/2.5} [err_conflict {space ye/2.5} {baz}]]
# delete generated modulefiles
delete_endspace_test_modulefiles
unset ans
unset errcmd
}
#
@@ -864,4 +1068,3 @@ unsetenv_var MODULES_UNLOAD_MATCH_ORDER
setenv_path_var MODULEPATH $modpath
unset mp
unset ans

View File

@@ -246,10 +246,38 @@ if {$install_availindepth eq {y}} {
# test modulepath and module names containing space character
setenv_var MODULES_AVAIL_INDEPTH 0
set mp "$modpath wspace"
if {!$is_symlink_supported} {
send_user "\tskipping tests over '$mp' modulepath as symbolic links are not supported on filesystem\n"
} else {
setenv_path_var MODULEPATH $mp
testouterr_cmd sh {avail -t spacen} OK "$mp:\nspacen/\nspacenb/(dw s)\nspacenc/"
testouterr_cmd sh {avail -t space\ ya} OK "$mp:\nspace ya/"
}
set mp "$modpath wspac "
if {!$is_symlink_supported} {
send_user "\tskipping tests over '$mp' modulepath as symbolic links are not supported on filesystem\n"
} else {
# generate modulefiles that cannot be recorded in git repository
create_endspace_test_modulefiles
# create modulepath finishing by space on the file (it crashes git checkout on Windows if saved in repo)
file link -symbolic $mp modulefiles.2
setenv_path_var MODULEPATH $mp
testouterr_cmd sh {avail -t space\ y\ } OK "$mp:\nspace y /"
# delete modulepath link created for the test
file delete $mp
# delete generated modulefiles
delete_endspace_test_modulefiles
}
#
# Cleanup
#