diff --git a/.cvsignore b/.gitignore similarity index 96% rename from .cvsignore rename to .gitignore index 2710d577..71b94826 100644 --- a/.cvsignore +++ b/.gitignore @@ -1,5 +1,7 @@ +*.o .deps .spec +po ABOUT-NLS Makefile Makefile.in diff --git a/NEWS b/NEWS index 515a2449..e47ec5e5 100644 --- a/NEWS +++ b/NEWS @@ -37,6 +37,9 @@ modules 3.3.0 * Fixed unload & load of same module problem. **************************** Release 3.2 ****************************** +Modules 3.2.10 + * Fix the module swap with the --delim option (Tyson Whitehead) + Modules 3.2.9 Nov 11, 2011 R.K. Owen (rk@owen.sj.ca.us) * Fix the coexistence of load/remove flags (Martin Siegert) @@ -46,7 +49,7 @@ Nov 11, 2011 R.K. Owen (rk@owen.sj.ca.us) * Crucial bug fix of same by (Orion Poplawski). * Fixed the "module purge" memory corruption (Poor Yorick) * Added support for Ruby (Tammo Tjarks) - + * Fix the flags with regards to recursive load/unload Modules 3.2.8 Oct 1, 2010 R.K. Owen (rk@owen.sj.ca.us) @@ -89,14 +92,21 @@ Jul 30, 2009 R.K. Owen (rk@owen.sj.ca.us) - simplify (t)csh initialisation - Add bash auto-completion for the 'module' command - Adds new 'chdir' modulefile command (sets cwd on module load) +<<<<<<< HEAD +======= + * versions a & b fixed some bugs +>>>>>>> 8c6e4e6626f06f4b369de95e37046ed0579adbf7 Modules 3.2.6 Oct 29, 2007 R.K. Owen (rk@owen.sj.ca.us) * Fixed the locate_module.c:realloc() calls which didn't properly take the element size into account (Fix thanks to Ron Isaacson). +<<<<<<< HEAD * Fixed some valgrind errors found and resolved by Alan Morris. * Skip .git version control dirs in modulefile dirs. +======= +>>>>>>> 8c6e4e6626f06f4b369de95e37046ed0579adbf7 Modules 3.2.5 Feb 14, 2007 R.K. Owen (rk@owen.sj.ca.us) * Wrapped all malloc() calls to make sure the size is never 0. diff --git a/TODO b/TODO index 39ab5ba0..47d75240 100644 --- a/TODO +++ b/TODO @@ -15,3 +15,6 @@ THINGS TODO * Add RPM distribution creation to Makefile. +* fix order that and scope of .modulerc files are read in. + +* fix the module-alias command. diff --git a/cmdPath.c b/cmdPath.c index ea13a0ac..f0ad31d0 100644 --- a/cmdPath.c +++ b/cmdPath.c @@ -415,12 +415,6 @@ int cmdRemovePath( if (!strncmp(Tcl_GetString(objv[0]), "pre", 3)) sw_marker = PRE_SW_MARKER; - /** - ** For switch state3, we're looking to remove the markers. - **/ - if (g_flags & M_SWSTATE3) - Tcl_SetStringObj(objv[arg1 + 1], sw_marker, -1); - /** ** Check for the delimiter option **/ @@ -438,6 +432,12 @@ int cmdRemovePath( } } + /** + ** For switch state3, we're looking to remove the markers. + **/ + if (g_flags & M_SWSTATE3) + Tcl_SetStringObj(objv[arg1 + 1], sw_marker, -1); + /** ** Split the path into its components so each item can be removed ** individually from the variable. diff --git a/config/.cvsignore b/config/.gitignore similarity index 100% rename from config/.cvsignore rename to config/.gitignore diff --git a/doc/.cvsignore b/doc/.gitignore similarity index 88% rename from doc/.cvsignore rename to doc/.gitignore index 87cc77da..fda4737f 100644 --- a/doc/.cvsignore +++ b/doc/.gitignore @@ -3,3 +3,4 @@ Makefile.in site.exp module.1 modulefile.4 +*.html diff --git a/etc/.cvsignore b/etc/.gitignore similarity index 100% rename from etc/.cvsignore rename to etc/.gitignore diff --git a/etc/global/.cvsignore b/etc/global/.gitignore similarity index 100% rename from etc/global/.cvsignore rename to etc/global/.gitignore diff --git a/etc/skel/.cvsignore b/etc/skel/.gitignore similarity index 100% rename from etc/skel/.cvsignore rename to etc/skel/.gitignore diff --git a/ext/.cvsignore b/ext/.gitignore similarity index 100% rename from ext/.cvsignore rename to ext/.gitignore diff --git a/ext/common/.cvsignore b/ext/common/.gitignore similarity index 100% rename from ext/common/.cvsignore rename to ext/common/.gitignore diff --git a/init/.cvsignore b/init/.gitignore similarity index 100% rename from init/.cvsignore rename to init/.gitignore diff --git a/modulefiles/.cvsignore b/modulefiles/.gitignore similarity index 100% rename from modulefiles/.cvsignore rename to modulefiles/.gitignore diff --git a/modulefiles/lang/.cvsignore b/modulefiles/lang/.gitignore similarity index 100% rename from modulefiles/lang/.cvsignore rename to modulefiles/lang/.gitignore diff --git a/tcl/init/.cvsignore b/tcl/init/.gitignore similarity index 100% rename from tcl/init/.cvsignore rename to tcl/init/.gitignore diff --git a/testsuite/.cvsignore b/testsuite/.gitignore similarity index 100% rename from testsuite/.cvsignore rename to testsuite/.gitignore diff --git a/testsuite/etc/.cvsignore b/testsuite/etc/.gitignore similarity index 100% rename from testsuite/etc/.cvsignore rename to testsuite/etc/.gitignore diff --git a/testsuite/home/.cvsignore b/testsuite/home/.gitignore similarity index 100% rename from testsuite/home/.cvsignore rename to testsuite/home/.gitignore diff --git a/testsuite/modulefiles/append/1.1 b/testsuite/modulefiles/append/1.1 new file mode 100644 index 00000000..d075de65 --- /dev/null +++ b/testsuite/modulefiles/append/1.1 @@ -0,0 +1,25 @@ +#%Module1.0 + +############################################################################## +# Modules Revision 3.0 +# Providing a flexible user environment +# +# File: prepend/%M% +# Revision: %I% +# First Edition: 2006/06/01 +# Last Mod.: %U%, %G% +# +# Authors: R.K. Owen, +# +# Description: Testuite modulefile +# Command: +# Sub-Command: append-path --d { } +# +# Invocation: load @M@/@V@ +# Comment: %C{ +# Check prepending using a different delimiter +# }C% +# +############################################################################## + +append-path -d { } testsuite {http://foobar.us} diff --git a/testsuite/modulefiles/prepend/1.1 b/testsuite/modulefiles/prepend/1.1 new file mode 100644 index 00000000..1d1c922b --- /dev/null +++ b/testsuite/modulefiles/prepend/1.1 @@ -0,0 +1,25 @@ +#%Module1.0 + +############################################################################## +# Modules Revision 3.0 +# Providing a flexible user environment +# +# File: prepend/%M% +# Revision: %I% +# First Edition: 2006/06/01 +# Last Mod.: %U%, %G% +# +# Authors: R.K. Owen, +# +# Description: Testuite modulefile +# Command: +# Sub-Command: prepend-path --delim { } +# +# Invocation: load @M@/@V@ +# Comment: %C{ +# Check prepending using a different delimiter +# }C% +# +############################################################################## + +prepend-path --delim { } testsuite {http://foobar.us} diff --git a/testsuite/modulefiles/recurs/modA b/testsuite/modulefiles/recurs/modA new file mode 100644 index 00000000..b451b01e --- /dev/null +++ b/testsuite/modulefiles/recurs/modA @@ -0,0 +1,30 @@ +#%Module1.0 + +############################################################################## +# Modules Revision 3.0 +# Providing a flexible user environment +# +# File: recurs/%M% +# Revision: %I% +# First Edition: 2012/05/17 +# Last Mod.: %U%, %G% +# +# Authors: R.K.Owen +# +# Description: Testuite modulefile +# Command: +# +# Invocation: +# Result: %R{ +# }R% +# Comment: %C{ +# tests recursive loading/unloading +# }C% +# +############################################################################## + +conflict modA +puts stderr [ concat "modA " [module-info mode]] +setenv MODA_LOADED 1 +module load recurs/modB + diff --git a/testsuite/modulefiles/recurs/modB b/testsuite/modulefiles/recurs/modB new file mode 100644 index 00000000..267cca69 --- /dev/null +++ b/testsuite/modulefiles/recurs/modB @@ -0,0 +1,28 @@ +#%Module1.0 + +############################################################################## +# Modules Revision 3.0 +# Providing a flexible user environment +# +# File: recurs/%M% +# Revision: %I% +# First Edition: 2012/05/17 +# Last Mod.: %U%, %G% +# +# Authors: R.K.Owen +# +# Description: Testuite modulefile +# Command: +# +# Invocation: +# Result: %R{ +# }R% +# Comment: %C{ +# tests recursive loading/unloading +# }C% +# +############################################################################## + +puts stderr [ concat "modB " [module-info mode]] +setenv MODB_LOADED 1 + diff --git a/testsuite/modules.50-cmds/085-info-flags.exp b/testsuite/modules.50-cmds/085-info-flags.exp index 2b127a78..fabb8c27 100644 --- a/testsuite/modules.50-cmds/085-info-flags.exp +++ b/testsuite/modules.50-cmds/085-info-flags.exp @@ -56,7 +56,7 @@ set lin_help "\n----------- Module Specific Help for '$module' ----------------- # # test loading -test_cmd "sh" "load $module" "32\n$lm_sh_ld$lmf_sh_ld" +test_cmd "sh" "load $module" "32800\n$lm_sh_ld$lmf_sh_ld" # test displaying testouterr_cmd "sh" "display $module" "2" "$modlin$modulefile:\n\n$modlin" @@ -66,7 +66,7 @@ set env(_LMFILES_) "$modulefile" set env(LOADEDMODULES) "$module" # test unloading -test_cmd "sh" "unload $module" "1\n$lm_sh_rm$lmf_sh_rm" +test_cmd "sh" "unload $module" "32769\n$lm_sh_rm$lmf_sh_rm" # test switching test_cmd "sh" "switch $module $module2" "$switches$lm_sh_sw$lmf_sh_sw" diff --git a/testsuite/modules.50-cmds/172-swap-app-delim.exp b/testsuite/modules.50-cmds/172-swap-app-delim.exp new file mode 100644 index 00000000..dc5e8eda --- /dev/null +++ b/testsuite/modules.50-cmds/172-swap-app-delim.exp @@ -0,0 +1,110 @@ +############################################################################## +# Modules Revision 3.0 +# Providing a flexible user environment +# +# File: modules.50-cmds/%M% +# Revision: %I% +# First Edition: 2012/10/29 +# Last Mod.: %U%, %G% +# +# Authors: R.K. Owen, +# +# Description: Testuite testsequence +# Command: load +# Modulefiles: append/1.0 append/1.1 +# Sub-Command: +# +# Comment: %C{ +# Tests the 'append-path' module subcommand with +# an arbitrary delimiter and a module swap +# }C% +# +############################################################################## + +# +# Variables. This test forces a module load command. It will result in the +# environment variables "_LMFILES_", "LOADEDMODULES" and "testsuite" to +# be set up +# + +set ts_1 "http://foobar.org" +set ts_2 "http://foobar.net" +set ts_3 "http://foobar.com" +set ts_4 "http://foobar.us" +set ts_new "$ts_1\\ $ts_2\\ $ts_4" +set ts_perl "$ts_1 $ts_2 $ts_4" +set env(testsuite) "$ts_1 $ts_2 $ts_3" +set module "append/1.0" +set module_new "append/1.1" +set modulefile "$env(MODULEPATH)/$module" +set modulefile_new "$env(MODULEPATH)/$module_new" + +set env(_LMFILES_) "$modulefile" +set env(LOADEDMODULES) "$module" + +# +# For the different shells ... +# + +set lmf_sh "_LMFILES_=$modulefile_new ;export _LMFILES_;" +set lm_sh "LOADEDMODULES=$module_new ;export LOADEDMODULES;" +set ts_sh "testsuite=$ts_new ;export testsuite;" + +set lmf_csh "setenv _LMFILES_ $modulefile_new ;" +set lm_csh "setenv LOADEDMODULES $module_new ;" +set ts_csh "setenv testsuite $ts_new ;" + +set lmf_perl "\$ENV{'_LMFILES_'} = '$modulefile_new';" +set lm_perl "\$ENV{'LOADEDMODULES'} = '$module_new';" +set ts_perl "\$ENV{'testsuite'} = '$ts_perl';" + +set lmf_cmake "set(ENV{_LMFILES_} \"$modulefile_new\")" +set lm_cmake "set(ENV{LOADEDMODULES} \"$module_new\")" +set ts_cmake "set(ENV{testsuite} \"$ts_1 $ts_2 $ts_4\")" + +# +# The tests +# + +test_cmd "sh" "swap $module_new" "$lm_sh$lmf_sh$ts_sh" +test_cmd "ksh" "swap $module_new" "$lm_sh$lmf_sh$ts_sh" +test_cmd "zsh" "swap $module_new" "$lm_sh$lmf_sh$ts_sh" +test_cmd "csh" "swap $module_new" "$lm_csh$lmf_csh$ts_csh" +test_cmd "tcsh" "swap $module_new" "$lm_csh$lmf_csh$ts_csh" +test_cmd "perl" "swap $module_new" "$lm_perl$lmf_perl$ts_perl" +test_cmd "cmake" "swap $module_new" "$lm_cmake\n$lmf_cmake\n$ts_cmake" + +# +# Cleanup +# + +unset env(testsuite) +unset env(_LMFILES_) +unset env(LOADEDMODULES) + +unset ts_new +unset ts_4 +unset ts_3 +unset ts_2 +unset ts_1 + +unset ts_sh +unset lm_sh +unset lmf_sh + +unset ts_csh +unset lm_csh +unset lmf_csh + +unset ts_perl +unset lm_perl +unset lmf_perl + +unset ts_cmake +unset lm_cmake +unset lmf_cmake + +unset modulefile +unset module +unset modulefile_new +unset module_new diff --git a/testsuite/modules.50-cmds/173-swap-app-delim.exp b/testsuite/modules.50-cmds/173-swap-app-delim.exp new file mode 100644 index 00000000..7aed52a1 --- /dev/null +++ b/testsuite/modules.50-cmds/173-swap-app-delim.exp @@ -0,0 +1,111 @@ +############################################################################## +# Modules Revision 3.0 +# Providing a flexible user environment +# +# File: modules.50-cmds/%M% +# Revision: %I% +# First Edition: 2012/10/29 +# Last Mod.: %U%, %G% +# +# Authors: R.K. Owen, +# +# Description: Testuite testsequence +# Command: load +# Modulefiles: append/1.0 append/1.1 +# Sub-Command: +# +# Comment: %C{ +# Tests the 'append-path' module subcommand with +# an arbitrary delimiter and a module swap +# with a mid-path result +# }C% +# +############################################################################## + +# +# Variables. This test forces a module load command. It will result in the +# environment variables "_LMFILES_", "LOADEDMODULES" and "testsuite" to +# be set up +# + +set ts_1 "http://foobar.org" +set ts_2 "http://foobar.net" +set ts_3 "http://foobar.com" +set ts_4 "http://foobar.us" +set ts_new "$ts_1\\ $ts_4\\ $ts_2" +set ts_perl "$ts_1 $ts_4 $ts_2" +set env(testsuite) "$ts_1 $ts_3 $ts_2" +set module "append/1.0" +set module_new "append/1.1" +set modulefile "$env(MODULEPATH)/$module" +set modulefile_new "$env(MODULEPATH)/$module_new" + +set env(_LMFILES_) "$modulefile" +set env(LOADEDMODULES) "$module" + +# +# For the different shells ... +# + +set lmf_sh "_LMFILES_=$modulefile_new ;export _LMFILES_;" +set lm_sh "LOADEDMODULES=$module_new ;export LOADEDMODULES;" +set ts_sh "testsuite=$ts_new ;export testsuite;" + +set lmf_csh "setenv _LMFILES_ $modulefile_new ;" +set lm_csh "setenv LOADEDMODULES $module_new ;" +set ts_csh "setenv testsuite $ts_new ;" + +set lmf_perl "\$ENV{'_LMFILES_'} = '$modulefile_new';" +set lm_perl "\$ENV{'LOADEDMODULES'} = '$module_new';" +set ts_perl "\$ENV{'testsuite'} = '$ts_perl';" + +set lmf_cmake "set(ENV{_LMFILES_} \"$modulefile_new\")" +set lm_cmake "set(ENV{LOADEDMODULES} \"$module_new\")" +set ts_cmake "set(ENV{testsuite} \"$ts_1 $ts_4 $ts_2\")" + +# +# The tests +# + +test_cmd "sh" "swap $module_new" "$lm_sh$lmf_sh$ts_sh" +test_cmd "ksh" "swap $module_new" "$lm_sh$lmf_sh$ts_sh" +test_cmd "zsh" "swap $module_new" "$lm_sh$lmf_sh$ts_sh" +test_cmd "csh" "swap $module_new" "$lm_csh$lmf_csh$ts_csh" +test_cmd "tcsh" "swap $module_new" "$lm_csh$lmf_csh$ts_csh" +test_cmd "perl" "swap $module_new" "$lm_perl$lmf_perl$ts_perl" +test_cmd "cmake" "swap $module_new" "$lm_cmake\n$lmf_cmake\n$ts_cmake" + +# +# Cleanup +# + +unset env(testsuite) +unset env(_LMFILES_) +unset env(LOADEDMODULES) + +unset ts_new +unset ts_4 +unset ts_3 +unset ts_2 +unset ts_1 + +unset ts_sh +unset lm_sh +unset lmf_sh + +unset ts_csh +unset lm_csh +unset lmf_csh + +unset ts_perl +unset lm_perl +unset lmf_perl + +unset ts_cmake +unset lm_cmake +unset lmf_cmake + +unset modulefile +unset module +unset modulefile_new +unset module_new diff --git a/testsuite/modules.50-cmds/177-swap-prep-delim.exp b/testsuite/modules.50-cmds/177-swap-prep-delim.exp new file mode 100644 index 00000000..56ad63bd --- /dev/null +++ b/testsuite/modules.50-cmds/177-swap-prep-delim.exp @@ -0,0 +1,110 @@ +############################################################################## +# Modules Revision 3.0 +# Providing a flexible user environment +# +# File: modules.50-cmds/%M% +# Revision: %I% +# First Edition: 2012/10/29 +# Last Mod.: %U%, %G% +# +# Authors: R.K. Owen, +# +# Description: Testuite testsequence +# Command: load +# Modulefiles: prepend/1.0 prepend/1.1 +# Sub-Command: +# +# Comment: %C{ +# Tests the 'prepend-path' module subcommand with +# an arbitrary delimiter and a module swap +# }C% +# +############################################################################## + +# +# Variables. This test forces a module load command. It will result in the +# environment variables "_LMFILES_", "LOADEDMODULES" and "testsuite" to +# be set up +# + +set ts_1 "http://foobar.org" +set ts_2 "http://foobar.net" +set ts_3 "http://foobar.com" +set ts_4 "http://foobar.us" +set ts_new "$ts_4\\ $ts_1\\ $ts_2" +set ts_perl "$ts_4 $ts_1 $ts_2" +set env(testsuite) "$ts_3 $ts_1 $ts_2" +set module "prepend/1.0" +set module_new "prepend/1.1" +set modulefile "$env(MODULEPATH)/$module" +set modulefile_new "$env(MODULEPATH)/$module_new" + +set env(_LMFILES_) "$modulefile" +set env(LOADEDMODULES) "$module" + +# +# For the different shells ... +# + +set lmf_sh "_LMFILES_=$modulefile_new ;export _LMFILES_;" +set lm_sh "LOADEDMODULES=$module_new ;export LOADEDMODULES;" +set ts_sh "testsuite=$ts_new ;export testsuite;" + +set lmf_csh "setenv _LMFILES_ $modulefile_new ;" +set lm_csh "setenv LOADEDMODULES $module_new ;" +set ts_csh "setenv testsuite $ts_new ;" + +set lmf_perl "\$ENV{'_LMFILES_'} = '$modulefile_new';" +set lm_perl "\$ENV{'LOADEDMODULES'} = '$module_new';" +set ts_perl "\$ENV{'testsuite'} = '$ts_perl';" + +set lmf_cmake "set(ENV{_LMFILES_} \"$modulefile_new\")" +set lm_cmake "set(ENV{LOADEDMODULES} \"$module_new\")" +set ts_cmake "set(ENV{testsuite} \"$ts_4 $ts_1 $ts_2\")" + +# +# The tests +# + +test_cmd "sh" "swap $module_new" "$lm_sh$lmf_sh$ts_sh" +test_cmd "ksh" "swap $module_new" "$lm_sh$lmf_sh$ts_sh" +test_cmd "zsh" "swap $module_new" "$lm_sh$lmf_sh$ts_sh" +test_cmd "csh" "swap $module_new" "$lm_csh$lmf_csh$ts_csh" +test_cmd "tcsh" "swap $module_new" "$lm_csh$lmf_csh$ts_csh" +test_cmd "perl" "swap $module_new" "$lm_perl$lmf_perl$ts_perl" +test_cmd "cmake" "swap $module_new" "$lm_cmake\n$lmf_cmake\n$ts_cmake" + +# +# Cleanup +# + +unset env(testsuite) +unset env(_LMFILES_) +unset env(LOADEDMODULES) + +unset ts_new +unset ts_4 +unset ts_3 +unset ts_2 +unset ts_1 + +unset ts_sh +unset lm_sh +unset lmf_sh + +unset ts_csh +unset lm_csh +unset lmf_csh + +unset ts_perl +unset lm_perl +unset lmf_perl + +unset ts_cmake +unset lm_cmake +unset lmf_cmake + +unset modulefile +unset module +unset modulefile_new +unset module_new diff --git a/testsuite/modules.50-cmds/178-swap-prep-delim.exp b/testsuite/modules.50-cmds/178-swap-prep-delim.exp new file mode 100644 index 00000000..787f3515 --- /dev/null +++ b/testsuite/modules.50-cmds/178-swap-prep-delim.exp @@ -0,0 +1,111 @@ +############################################################################## +# Modules Revision 3.0 +# Providing a flexible user environment +# +# File: modules.50-cmds/%M% +# Revision: %I% +# First Edition: 2012/10/29 +# Last Mod.: %U%, %G% +# +# Authors: R.K. Owen, +# +# Description: Testuite testsequence +# Command: load +# Modulefiles: prepend/1.0 prepend/1.1 +# Sub-Command: +# +# Comment: %C{ +# Tests the 'prepend-path' module subcommand with +# an arbitrary delimiter and a module swap +# with a mid-path result +# }C% +# +############################################################################## + +# +# Variables. This test forces a module load command. It will result in the +# environment variables "_LMFILES_", "LOADEDMODULES" and "testsuite" to +# be set up +# + +set ts_1 "http://foobar.org" +set ts_2 "http://foobar.net" +set ts_3 "http://foobar.com" +set ts_4 "http://foobar.us" +set ts_new "$ts_1\\ $ts_4\\ $ts_2" +set ts_perl "$ts_1 $ts_4 $ts_2" +set env(testsuite) "$ts_1 $ts_3 $ts_2" +set module "prepend/1.0" +set module_new "prepend/1.1" +set modulefile "$env(MODULEPATH)/$module" +set modulefile_new "$env(MODULEPATH)/$module_new" + +set env(_LMFILES_) "$modulefile" +set env(LOADEDMODULES) "$module" + +# +# For the different shells ... +# + +set lmf_sh "_LMFILES_=$modulefile_new ;export _LMFILES_;" +set lm_sh "LOADEDMODULES=$module_new ;export LOADEDMODULES;" +set ts_sh "testsuite=$ts_new ;export testsuite;" + +set lmf_csh "setenv _LMFILES_ $modulefile_new ;" +set lm_csh "setenv LOADEDMODULES $module_new ;" +set ts_csh "setenv testsuite $ts_new ;" + +set lmf_perl "\$ENV{'_LMFILES_'} = '$modulefile_new';" +set lm_perl "\$ENV{'LOADEDMODULES'} = '$module_new';" +set ts_perl "\$ENV{'testsuite'} = '$ts_perl';" + +set lmf_cmake "set(ENV{_LMFILES_} \"$modulefile_new\")" +set lm_cmake "set(ENV{LOADEDMODULES} \"$module_new\")" +set ts_cmake "set(ENV{testsuite} \"$ts_1 $ts_4 $ts_2\")" + +# +# The tests +# + +test_cmd "sh" "swap $module_new" "$lm_sh$lmf_sh$ts_sh" +test_cmd "ksh" "swap $module_new" "$lm_sh$lmf_sh$ts_sh" +test_cmd "zsh" "swap $module_new" "$lm_sh$lmf_sh$ts_sh" +test_cmd "csh" "swap $module_new" "$lm_csh$lmf_csh$ts_csh" +test_cmd "tcsh" "swap $module_new" "$lm_csh$lmf_csh$ts_csh" +test_cmd "perl" "swap $module_new" "$lm_perl$lmf_perl$ts_perl" +test_cmd "cmake" "swap $module_new" "$lm_cmake\n$lmf_cmake\n$ts_cmake" + +# +# Cleanup +# + +unset env(testsuite) +unset env(_LMFILES_) +unset env(LOADEDMODULES) + +unset ts_new +unset ts_4 +unset ts_3 +unset ts_2 +unset ts_1 + +unset ts_sh +unset lm_sh +unset lmf_sh + +unset ts_csh +unset lm_csh +unset lmf_csh + +unset ts_perl +unset lm_perl +unset lmf_perl + +unset ts_cmake +unset lm_cmake +unset lmf_cmake + +unset modulefile +unset module +unset modulefile_new +unset module_new diff --git a/testsuite/modules.50-cmds/195-load-recurs.exp b/testsuite/modules.50-cmds/195-load-recurs.exp new file mode 100644 index 00000000..440318a0 --- /dev/null +++ b/testsuite/modules.50-cmds/195-load-recurs.exp @@ -0,0 +1,152 @@ +############################################################################## +# Modules Revision 3.0 +# Providing a flexible user environment +# +# File: modules.50-cmds/%M% +# Revision: %I% +# First Edition: 2012/05/17 +# Last Mod.: %U%, %G% +# +# Authors: R.K. Owen, +# +# Description: recursive load/unload test +# Command: load +# Modulefiles: recurs/modA +# recurs/modA +# Sub-Command: +# +# Comment: %C{ +# Recursive load a modulefile +# }C% +# +############################################################################## + +set modA "recurs/modA" +set modB "recurs/modB" + +set modAp "$env(MODULEPATH)/$modA" +set modBp "$env(MODULEPATH)/$modB" + +# +# set up an empty environment +# +set module "" +set modulefile "" +set env(_LMFILES_) "$modulefile" +set env(LOADEDMODULES) "$module" + +# +# load +# For the different shells ... +# +set module "$modB:$modA" +set modulefile "$modBp:$modAp" +set moderr "modA load\nmodB load"; + +set lmf_sh "_LMFILES_=$modulefile ;export _LMFILES_;" +set lm_sh "LOADEDMODULES=$module ;export LOADEDMODULES;" +set tsA_sh "MODA_LOADED=1 ;export MODA_LOADED;" +set tsB_sh "MODB_LOADED=1 ;export MODB_LOADED;" + +set lmf_csh "setenv _LMFILES_ $modulefile ;" +set lm_csh "setenv LOADEDMODULES $module ;" +set tsA_csh "setenv MODA_LOADED 1 ;" +set tsB_csh "setenv MODB_LOADED 1 ;" + +set lmf_perl "\$ENV{'_LMFILES_'} = '$modulefile';" +set lm_perl "\$ENV{'LOADEDMODULES'} = '$module';" +set tsA_perl "\$ENV{'MODA_LOADED'} = '1';" +set tsB_perl "\$ENV{'MODB_LOADED'} = '1';" + +set lmf_cmake "set(ENV{_LMFILES_} \"$modulefile\")" +set lm_cmake "set(ENV{LOADEDMODULES} \"$module\")" +set tsA_cmake "set(ENV{MODA_LOADED} \"1\")" +set tsB_cmake "set(ENV{MODB_LOADED} \"1\")" + +# +# The load tests +# +testouterr_cmd "sh" "load $modA" "$lm_sh$tsA_sh$tsB_sh$lmf_sh" "$moderr" +testouterr_cmd "ksh" "load $modA" "$lm_sh$tsA_sh$tsB_sh$lmf_sh" "$moderr" +testouterr_cmd "zsh" "load $modA" "$lm_sh$tsA_sh$tsB_sh$lmf_sh" "$moderr" +testouterr_cmd "csh" "load $modA" "$lm_csh$tsA_csh$tsB_csh$lmf_csh" "$moderr" +testouterr_cmd "tcsh" "load $modA" "$lm_csh$tsA_csh$tsB_csh$lmf_csh" "$moderr" +testouterr_cmd "perl" "load $modA" "$lm_perl$tsA_perl$tsB_perl$lmf_perl" "$moderr" +testouterr_cmd "cmake" "load $modA" "$lm_cmake\n$tsA_cmake\n$tsB_cmake\n$lmf_cmake" "$moderr" + +# +# set-up a loaded environment +# +set env(_LMFILES_) "/some/path/foobar/1.0:$modulefile" +set env(LOADEDMODULES) "foobar/1.0:$module" +set module "foobar/1.0" +set modulefile "/some/path/foobar/1.0" +set moderr "modA remove\nmodB remove"; + +set lmf_sh "_LMFILES_=$modulefile ;export _LMFILES_;" +set lm_sh "LOADEDMODULES=$module ;export LOADEDMODULES;" +set tsA_sh "unset MODA_LOADED;" +set tsB_sh "unset MODB_LOADED;" + +set lmf_csh "setenv _LMFILES_ $modulefile ;" +set lm_csh "setenv LOADEDMODULES $module ;" +set tsA_csh "unsetenv MODA_LOADED;" +set tsB_csh "unsetenv MODB_LOADED;" + +set lmf_perl "\$ENV{'_LMFILES_'} = '$modulefile';" +set lm_perl "\$ENV{'LOADEDMODULES'} = '$module';" +set tsA_perl "delete \$ENV{'MODA_LOADED'};" +set tsB_perl "delete \$ENV{'MODB_LOADED'};" + +set lmf_cmake "set(ENV{_LMFILES_} \"$modulefile\")" +set lm_cmake "set(ENV{LOADEDMODULES} \"$module\")" +set tsA_cmake "unset(ENV{MODA_LOADED})" +set tsB_cmake "unset(ENV{MODB_LOADED})" + +# +# The unload tests +# +testouterr_cmd "sh" "unload $modA" "$lm_sh$lmf_sh$tsA_sh$tsB_sh" "$moderr" +testouterr_cmd "ksh" "unload $modA" "$lm_sh$lmf_sh$tsA_sh$tsB_sh" "$moderr" +testouterr_cmd "zsh" "unload $modA" "$lm_sh$lmf_sh$tsA_sh$tsB_sh" "$moderr" +testouterr_cmd "csh" "unload $modA" "$lm_csh$lmf_csh$tsA_csh$tsB_csh" "$moderr" +testouterr_cmd "tcsh" "unload $modA" "$lm_csh$lmf_csh$tsA_csh$tsB_csh" "$moderr" +testouterr_cmd "perl" "unload $modA" "$lm_perl$lmf_perl$tsA_perl$tsB_perl" "$moderr" +testouterr_cmd "cmake" "unload $modA" "$lm_cmake\n$lmf_cmake\n$tsA_cmake\n$tsB_cmake" "$moderr" + +# +# Cleanup +# + +unset env(_LMFILES_) +unset env(LOADEDMODULES) +unset moderr + +unset lm_sh +unset lmf_sh +unset tsA_sh +unset tsB_sh + +unset lm_csh +unset lmf_csh +unset tsA_csh +unset tsB_csh + +unset lm_perl +unset lmf_perl +unset tsA_perl +unset tsB_perl + +unset lm_cmake +unset lmf_cmake +unset tsA_cmake +unset tsB_cmake + +unset modulefile +unset module + +unset modA +unset modB +unset modAp +unset modBp +