diff --git a/testsuite/modulefiles.spider1/.modulerc b/testsuite/modulefiles.spider1/.modulerc new file mode 100644 index 00000000..ecf3afc5 --- /dev/null +++ b/testsuite/modulefiles.spider1/.modulerc @@ -0,0 +1,8 @@ +#%Module +if {[info exists env(TESTSUITE_VIA)]} { + switch -- $env(TESTSUITE_VIA) { + modulepath_label1 { + modulepath-label . {My label spider1} + } + } +} diff --git a/testsuite/modulefiles.spider2/.modulerc b/testsuite/modulefiles.spider2/.modulerc new file mode 100644 index 00000000..95e3ae16 --- /dev/null +++ b/testsuite/modulefiles.spider2/.modulerc @@ -0,0 +1,8 @@ +#%Module +if {[info exists env(TESTSUITE_VIA)]} { + switch -- $env(TESTSUITE_VIA) { + modulepath_label1 { + modulepath-label . {My label spider2} + } + } +} diff --git a/testsuite/modules.00-init/140-color.exp b/testsuite/modules.00-init/140-color.exp index 6d7d2e80..c18250f7 100644 --- a/testsuite/modules.00-init/140-color.exp +++ b/testsuite/modules.00-init/140-color.exp @@ -410,6 +410,13 @@ colorset_test_case {avail loc_tr} [list mp $modpathre] ".*- $modpathre -.*" colorset_test_case {avail -t --no-indepth loc_tr} [list mp $modpathre] ".*$modpathre:.*" colorset_test_case {avail -l --no-indepth loc_tr} [list mp $modpathre] ".*$modpathre:.*" +# modulepath (mp) and via +setenv_var __MODULES_LMUSE loc_tr/1.0&$modpath +setenv_loaded_module [list loc_tr/1.0] [list $modpath/loc_tr/1.0] +colorset_test_case {avail -o +via loc_tr} [list mp $modpathre] ".*- $modpathre \\(via loc_tr/1.0\\) -.*" +unsetenv_var __MODULES_LMUSE +unsetenv_loaded_module + # tag separator (se) / module symbolic version (sy) colorset_test_case {avail loc_tr} [list se \\( se \\) se : sy reg sy cur sy stable] ".*loc_tr.*/\\(reg\\).*loc_tr.*/1.0\\(cur:stable\\).*" colorset_test_case {avail -t loc_tr} [list se \\( se \\) se : sy reg sy cur sy stable] ".*loc_tr.*/\\(reg\\).*loc_tr.*/1.0\\(cur:stable\\).*" diff --git a/testsuite/modules.70-maint/360-avail_output.exp b/testsuite/modules.70-maint/360-avail_output.exp index c452a238..7fcf09ef 100644 --- a/testsuite/modules.70-maint/360-avail_output.exp +++ b/testsuite/modules.70-maint/360-avail_output.exp @@ -379,6 +379,120 @@ foo/0.load foo/0.prereq" +# +# via test +# + +setenv_var TESTSUITE_SPIDER_MODPATH1 use_modpath2 +setenv_var TESTSUITE_SPIDER_MODPATH2 use_modpath3 +setenv_path_var MODULEPATH $modpath.spider1 +setenv_var MODULES_AVAIL_OUTPUT sym:tag:modulepath:via +testouterr_cmd_re sh {avail mod} OK "$modlin $modpathre.spider1 $modlin +moda/1 moda/2 " + +# no modulepath label set, no using module loaded +setenv_path_var MODULEPATH $modpath.spider2:$modpath.spider1 +testouterr_cmd_re sh {avail mod} OK "$modlin $modpathre.spider2 $modlin +modb/1 modb/2 + +$modlin $modpathre.spider1 $modlin +moda/1 moda/2 " + +# modulepath label set, no using module loaded +setenv_var TESTSUITE_VIA modulepath_label1 +testouterr_cmd_re sh {avail mod} OK "$modlin My label spider2 $modlin +modb/1 modb/2 + +$modlin My label spider1 $modlin +moda/1 moda/2 " + +# no modulepath label set, using module loaded +unsetenv_var TESTSUITE_VIA +setenv_loaded_module [list moda/1] [list $modpath.spider1/moda/1] +setenv_var __MODULES_LMUSE moda/1&$modpath.spider2 +testouterr_cmd_re sh {avail mod} OK "$modlin $modpathre.spider2 \\(via moda/1\\) $modlin +modb/1 modb/2 + +$modlin $modpathre.spider1 $modlin +moda/1 moda/2 " + +# modulepath label set, using module loaded +setenv_var TESTSUITE_VIA modulepath_label1 +testouterr_cmd_re sh {avail mod} OK "$modlin My label spider2 \\(via moda/1\\) $modlin +modb/1 modb/2 + +$modlin My label spider1 $modlin +moda/1 moda/2 " + +# no modulepath label set, using module loaded, but added modulepath unused +unsetenv_var TESTSUITE_VIA +setenv_path_var MODULEPATH $modpath.spider1 +testouterr_cmd_re sh {avail mod} OK "$modlin $modpathre.spider1 $modlin +moda/1 moda/2 " + +# modulepath label set, using module loaded, but added modulepath unused +setenv_var TESTSUITE_VIA modulepath_label1 +testouterr_cmd_re sh {avail mod} OK "$modlin My label spider1 $modlin +moda/1 moda/2 " + +# no modulepath label set, using module loaded, but primary modulepath unused +unsetenv_var TESTSUITE_VIA +setenv_path_var MODULEPATH $modpath.spider2 +testouterr_cmd_re sh {avail mod} OK "$modlin $modpathre.spider2 \\(via moda/1\\) $modlin +modb/1 modb/2 " + +# modulepath label set, using module loaded, but primary modulepath unused +setenv_var TESTSUITE_VIA modulepath_label1 +testouterr_cmd_re sh {avail mod} OK "$modlin My label spider2 \\(via moda/1\\) $modlin +modb/1 modb/2 " + +# several loaded modules using same modulepath +unsetenv_var TESTSUITE_VIA +setenv_path_var MODULEPATH $modpath.spider2:$modpath.spider1 +setenv_loaded_module [list moda/1 moda/2] [list $modpath.spider1/moda/1 $modpath.spider2/moda/2] +setenv_var __MODULES_LMUSE moda/1&$modpath.spider2:moda/2&$modpath.spider2 +testouterr_cmd_re sh {avail mod} OK "$modlin $modpathre.spider2 \\(via moda/1\\) $modlin +modb/1 modb/2 + +$modlin $modpathre.spider1 $modlin +moda/1 moda/2 " + +# no modulepath reported but via set +setenv_loaded_module [list moda/1] [list $modpath.spider1/moda/1] +setenv_var __MODULES_LMUSE moda/1&$modpath.spider2 +setenv_var MODULES_AVAIL_OUTPUT sym:tag:via +testouterr_cmd sh {avail mod} OK "moda/1 moda/2 modb/1 modb/2 " + +# via not supported on terse output mode +setenv_var MODULES_AVAIL_TERSE_OUTPUT sym:tag:modulepath:via +set tserr "$modpath.spider2: +modb/1 +modb/2 + +$modpath.spider1: +moda/1 +moda/2" +testouterr_cmd sh {avail -t mod} OK $tserr +testouterr_cmd sh {avail -t -o +via mod} ERR "$error_msgs: Invalid element in value list for '-o' option on avail sub-command\n Allowed elements are: modulepath alias dirwsym indesym sym tag key hidden variant variantifspec (separated by ':')" + +# same module in different modulepath, one of them loaded +setenv_var MODULES_AVAIL_OUTPUT sym:tag:modulepath:via +setenv_loaded_module [list foo/0.2] [list $modpath.2/foo/0.2] +setenv_var __MODULES_LMUSE foo/0.2&$modpath.3 +setenv_path_var MODULEPATH $modpath.3:$modpath.2 +# FIXME: only foo/0.2 from modpath.2 should appear with L tag +testouterr_cmd_re sh {avail foo/0} OK "$modlin $modpathre.3 \\(via foo/0.2\\) $modlin +foo/0.2\\(sym\\) foo/0.err foo/0.load foo/0.prereq + +$modlin $modpathre.2 $modlin +foo/0.1 foo/0.2\\(sym\\) " + +unsetenv_loaded_module +unsetenv_var __MODULES_LMUSE +unsetenv_var TESTSUITE_SPIDER_MODPATH1 +unsetenv_var TESTSUITE_SPIDER_MODPATH2 + + # # hidden test # diff --git a/testsuite/modules.70-maint/362-spider_output.exp b/testsuite/modules.70-maint/362-spider_output.exp index 93f57cd9..9fe20a84 100644 --- a/testsuite/modules.70-maint/362-spider_output.exp +++ b/testsuite/modules.70-maint/362-spider_output.exp @@ -299,6 +299,177 @@ foo/0.load foo/0.prereq" +# +# via test +# + +setenv_var TESTSUITE_SPIDER_MODPATH1 use_modpath2 +setenv_var TESTSUITE_SPIDER_MODPATH2 use_modpath3 +setenv_path_var MODULEPATH $modpath.spider1 +setenv_var MODULES_SPIDER_OUTPUT sym:tag:modulepath:via +testouterr_cmd_re sh {spider mod} OK "$modlin $modpathre.spider1 $modlin +moda/1 moda/2 + +$modlin $modpathre.spider2 \\(via moda/1\\) $modlin +modb/1 modb/2 + +$modlin $modpathre.spider3 \\(via modb/1\\) $modlin +modc/1 modc/2 " + +# no modulepath label set, no using module loaded +setenv_path_var MODULEPATH $modpath.spider2:$modpath.spider1 +testouterr_cmd_re sh {spider mod} OK "$modlin $modpathre.spider2 $modlin +modb/1 modb/2 + +$modlin $modpathre.spider1 $modlin +moda/1 moda/2 + +$modlin $modpathre.spider3 \\(via modb/1\\) $modlin +modc/1 modc/2 " + +# modulepath label set, no using module loaded +setenv_var TESTSUITE_VIA modulepath_label1 +testouterr_cmd_re sh {spider mod} OK "$modlin My label spider2 $modlin +modb/1 modb/2 + +$modlin My label spider1 $modlin +moda/1 moda/2 + +$modlin $modpathre.spider3 \\(via modb/1\\) $modlin +modc/1 modc/2 " + +# no modulepath label set, using module loaded +unsetenv_var TESTSUITE_VIA +setenv_loaded_module [list moda/1] [list $modpath.spider1/moda/1] +setenv_var __MODULES_LMUSE moda/1&$modpath.spider2 +testouterr_cmd_re sh {spider mod} OK "$modlin $modpathre.spider2 \\(via moda/1\\) $modlin +modb/1 modb/2 + +$modlin $modpathre.spider1 $modlin +moda/1 moda/2 + +$modlin $modpathre.spider3 \\(via modb/1\\) $modlin +modc/1 modc/2 " + +# modulepath label set, using module loaded +setenv_var TESTSUITE_VIA modulepath_label1 +testouterr_cmd_re sh {spider mod} OK "$modlin My label spider2 \\(via moda/1\\) $modlin +modb/1 modb/2 + +$modlin My label spider1 $modlin +moda/1 moda/2 + +$modlin $modpathre.spider3 \\(via modb/1\\) $modlin +modc/1 modc/2 " + +# no modulepath label set, using module loaded, but added modulepath unused +unsetenv_var TESTSUITE_VIA +setenv_path_var MODULEPATH $modpath.spider1 +testouterr_cmd_re sh {spider mod} OK "$modlin $modpathre.spider1 $modlin +moda/1 moda/2 + +$modlin $modpathre.spider2 \\(via moda/1\\) $modlin +modb/1 modb/2 + +$modlin $modpathre.spider3 \\(via modb/1\\) $modlin +modc/1 modc/2 " + +# modulepath label set, using module loaded, but added modulepath unused +setenv_var TESTSUITE_VIA modulepath_label1 +testouterr_cmd_re sh {spider mod} OK "$modlin My label spider1 $modlin +moda/1 moda/2 + +$modlin My label spider2 \\(via moda/1\\) $modlin +modb/1 modb/2 + +$modlin $modpathre.spider3 \\(via modb/1\\) $modlin +modc/1 modc/2 " + +# no modulepath label set, using module loaded, but primary modulepath unused +unsetenv_var TESTSUITE_VIA +setenv_path_var MODULEPATH $modpath.spider2 +testouterr_cmd_re sh {spider mod} OK "$modlin $modpathre.spider2 \\(via moda/1\\) $modlin +modb/1 modb/2 + +$modlin $modpathre.spider3 \\(via modb/1\\) $modlin +modc/1 modc/2 " + +# modulepath label set, using module loaded, but primary modulepath unused +setenv_var TESTSUITE_VIA modulepath_label1 +testouterr_cmd_re sh {spider mod} OK "$modlin My label spider2 \\(via moda/1\\) $modlin +modb/1 modb/2 + +$modlin $modpathre.spider3 \\(via modb/1\\) $modlin +modc/1 modc/2 " + +# several loaded modules using same modulepath +unsetenv_var TESTSUITE_VIA +setenv_path_var MODULEPATH $modpath.spider2:$modpath.spider1 +setenv_loaded_module [list moda/1 moda/2] [list $modpath.spider1/moda/1 $modpath.spider2/moda/2] +setenv_var __MODULES_LMUSE moda/1&$modpath.spider2:moda/2&$modpath.spider2 +testouterr_cmd_re sh {spider mod} OK "$modlin $modpathre.spider2 \\(via moda/1\\) $modlin +modb/1 modb/2 + +$modlin $modpathre.spider1 $modlin +moda/1 moda/2 + +$modlin $modpathre.spider3 \\(via modb/1\\) $modlin +modc/1 modc/2 " + +# one loaded module, from a different path, using same modulepath than available module +unsetenv_var TESTSUITE_VIA +setenv_path_var MODULEPATH $modpath.spider2:$modpath.spider1 +setenv_loaded_module [list foo/1] [list $modpath.other/foo/1] +setenv_var __MODULES_LMUSE foo/1&$modpath.spider2 +testouterr_cmd_re sh {spider mod} OK "$modlin $modpathre.spider2 \\(via foo/1\\) $modlin +modb/1 modb/2 + +$modlin $modpathre.spider1 $modlin +moda/1 moda/2 + +$modlin $modpathre.spider3 \\(via modb/1\\) $modlin +modc/1 modc/2 " + +# no modulepath reported but via set +setenv_loaded_module [list moda/1] [list $modpath.spider1/moda/1] +setenv_var __MODULES_LMUSE moda/1&$modpath.spider2 +setenv_var MODULES_SPIDER_OUTPUT sym:tag:via +testouterr_cmd sh {spider mod} OK "moda/1 moda/2 modb/1 modb/2 modc/1 modc/2 " + +# via not supported on terse output mode +setenv_var MODULES_SPIDER_TERSE_OUTPUT sym:tag:modulepath:via +set tserr "$modpath.spider2: +modb/1 +modb/2 + +$modpath.spider1: +moda/1 +moda/2 + +$modpath.spider3: +modc/1 +modc/2" +testouterr_cmd sh {spider -t mod} OK $tserr +testouterr_cmd sh {spider -t -o +via mod} ERR "$error_msgs: Invalid element in value list for '-o' option on spider sub-command\n Allowed elements are: modulepath alias dirwsym indesym sym tag key hidden variant variantifspec (separated by ':')" + +# same module in different modulepath, one of them loaded +setenv_var MODULES_SPIDER_OUTPUT sym:tag:modulepath:via +setenv_loaded_module [list foo/0.2] [list $modpath.2/foo/0.2] +setenv_var __MODULES_LMUSE foo/0.2&$modpath.3 +setenv_path_var MODULEPATH $modpath.3:$modpath.2 +# FIXME: only foo/0.2 from modpath.2 should appear with L tag +testouterr_cmd_re sh {spider foo/0} OK "$modlin $modpathre.3 \\(via foo/0.2\\) $modlin +foo/0.2\\(sym\\) foo/0.err foo/0.load foo/0.prereq + +$modlin $modpathre.2 $modlin +foo/0.1 foo/0.2\\(sym\\) " + +unsetenv_loaded_module +unsetenv_var __MODULES_LMUSE +unsetenv_var TESTSUITE_SPIDER_MODPATH1 +unsetenv_var TESTSUITE_SPIDER_MODPATH2 + + # # hidden test #