From d158921e9d8600b68abc2fbfc76e2c021cec7b30 Mon Sep 17 00:00:00 2001 From: Xavier Delaruelle Date: Tue, 20 Jul 2021 08:42:28 +0200 Subject: [PATCH] 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. --- testsuite/install.00-init/005-init_ts.exp | 1 + testsuite/install.00-init/020-module.exp | 6 +++++ testsuite/install.00-init/024-ml.exp | 6 +++++ testsuite/modules.00-init/050-modpath.exp | 1 + testsuite/modules.50-cmds/029-setenv-env.exp | 8 ++++++ testsuite/modules.50-cmds/180-unload.exp | 6 +++++ testsuite/modules.50-cmds/190-load.exp | 25 +++++++++++++++++++ testsuite/modules.50-cmds/321-is-used.exp | 6 +++++ .../modules.50-cmds/370-deps-fullpath.exp | 4 +++ testsuite/modules.50-cmds/372-deps3.exp | 6 +++++ testsuite/modules.61-coll/040-restore.exp | 6 +++++ testsuite/modules.70-maint/070-display.exp | 12 +++++++++ testsuite/modules.70-maint/080-help.exp | 12 +++++++++ testsuite/modules.70-maint/085-test.exp | 12 +++++++++ 14 files changed, 111 insertions(+) diff --git a/testsuite/install.00-init/005-init_ts.exp b/testsuite/install.00-init/005-init_ts.exp index a314d03d..8ad07362 100644 --- a/testsuite/install.00-init/005-init_ts.exp +++ b/testsuite/install.00-init/005-init_ts.exp @@ -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." diff --git a/testsuite/install.00-init/020-module.exp b/testsuite/install.00-init/020-module.exp index 1a684f0a..5d4abe41 100644 --- a/testsuite/install.00-init/020-module.exp +++ b/testsuite/install.00-init/020-module.exp @@ -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\\?¶m=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" } diff --git a/testsuite/install.00-init/024-ml.exp b/testsuite/install.00-init/024-ml.exp index 4ac67032..ab398a11 100644 --- a/testsuite/install.00-init/024-ml.exp +++ b/testsuite/install.00-init/024-ml.exp @@ -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\\?¶m=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" } diff --git a/testsuite/modules.00-init/050-modpath.exp b/testsuite/modules.00-init/050-modpath.exp index dc8894bc..871ef78a 100644 --- a/testsuite/modules.00-init/050-modpath.exp +++ b/testsuite/modules.00-init/050-modpath.exp @@ -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" diff --git a/testsuite/modules.50-cmds/029-setenv-env.exp b/testsuite/modules.50-cmds/029-setenv-env.exp index 367b8534..d33feb74 100644 --- a/testsuite/modules.50-cmds/029-setenv-env.exp +++ b/testsuite/modules.50-cmds/029-setenv-env.exp @@ -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 diff --git a/testsuite/modules.50-cmds/180-unload.exp b/testsuite/modules.50-cmds/180-unload.exp index 58906525..09a3d314 100644 --- a/testsuite/modules.50-cmds/180-unload.exp +++ b/testsuite/modules.50-cmds/180-unload.exp @@ -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 diff --git a/testsuite/modules.50-cmds/190-load.exp b/testsuite/modules.50-cmds/190-load.exp index b8f08517..51238616 100644 --- a/testsuite/modules.50-cmds/190-load.exp +++ b/testsuite/modules.50-cmds/190-load.exp @@ -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 diff --git a/testsuite/modules.50-cmds/321-is-used.exp b/testsuite/modules.50-cmds/321-is-used.exp index e76c2a27..3a332fef 100644 --- a/testsuite/modules.50-cmds/321-is-used.exp +++ b/testsuite/modules.50-cmds/321-is-used.exp @@ -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 diff --git a/testsuite/modules.50-cmds/370-deps-fullpath.exp b/testsuite/modules.50-cmds/370-deps-fullpath.exp index adca2b98..fc7b19bb 100644 --- a/testsuite/modules.50-cmds/370-deps-fullpath.exp +++ b/testsuite/modules.50-cmds/370-deps-fullpath.exp @@ -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] diff --git a/testsuite/modules.50-cmds/372-deps3.exp b/testsuite/modules.50-cmds/372-deps3.exp index 141b483a..a5d5c824 100644 --- a/testsuite/modules.50-cmds/372-deps3.exp +++ b/testsuite/modules.50-cmds/372-deps3.exp @@ -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] diff --git a/testsuite/modules.61-coll/040-restore.exp b/testsuite/modules.61-coll/040-restore.exp index d6a3b25b..a6be1ac4 100644 --- a/testsuite/modules.61-coll/040-restore.exp +++ b/testsuite/modules.61-coll/040-restore.exp @@ -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 +} # diff --git a/testsuite/modules.70-maint/070-display.exp b/testsuite/modules.70-maint/070-display.exp index 45e5100f..c8658cd4 100644 --- a/testsuite/modules.70-maint/070-display.exp +++ b/testsuite/modules.70-maint/070-display.exp @@ -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 diff --git a/testsuite/modules.70-maint/080-help.exp b/testsuite/modules.70-maint/080-help.exp index 64fc2584..0cfd5d2e 100644 --- a/testsuite/modules.70-maint/080-help.exp +++ b/testsuite/modules.70-maint/080-help.exp @@ -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" diff --git a/testsuite/modules.70-maint/085-test.exp b/testsuite/modules.70-maint/085-test.exp index d5ed9bb4..cb7f0445 100644 --- a/testsuite/modules.70-maint/085-test.exp +++ b/testsuite/modules.70-maint/085-test.exp @@ -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"