Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test failures in recent versions of Lmod #543

Closed
amadio opened this issue Nov 25, 2021 · 20 comments
Closed

Test failures in recent versions of Lmod #543

amadio opened this issue Nov 25, 2021 · 20 comments

Comments

@amadio
Copy link

amadio commented Nov 25, 2021

Between Lmod 8.5.18 (last version to pass all tests) and 8.5.23 I see the following test failures when trying to update the version of Lmod in Gentoo Linux:

*******  ****************
Results  Output Directory
*******  ****************
diff     /tmp/portage/sys-cluster/lmod-8.5.23/work/Lmod-8.5.23/rt/configDir/t1/2021_11_25_14_15_05-Linux-x86_64-configDir
diff     /tmp/portage/sys-cluster/lmod-8.5.23/work/Lmod-8.5.23/rt/sh_to_modulefile/t1/2021_11_25_14_15_05-Linux-x86_64-sh_to_modulefile

The diffs are:

--- /tmp/portage/sys-cluster/lmod-8.5.23/work/Lmod-8.5.23/rt/configDir/t1/2021_11_25_14_15_05-Linux-x86_64-configDir/_err.left	2021-11-25 14:15:41.985281074 +0100
+++ /tmp/portage/sys-cluster/lmod-8.5.23/work/Lmod-8.5.23/rt/configDir/t1/2021_11_25_14_15_05-Linux-x86_64-configDir/_err.right	2021-11-25 14:15:41.985281074 +0100
@@ -64,6 +64,7 @@
 Tracing                            no
 uname -a
 LMOD_CONFIG_DIR  /etc/lmod  ProjectDIR/rt/configDir/lmod_cfg_dir
+LMOD_LD_PRELOAD  false      libsandbox.so
 LMOD_SITE_NAME   false      XYZZY
 Active RC file(s):
 ProjectDIR/src/../init/lmodrc.lua

Sandbox added by portage here, so not a real failure in Lmod. We can probably ignore this test, but would be nice if tests passed in the sandboxed environment.

# diff -u /tmp/portage/sys-cluster/lmod-8.5.23/work/Lmod-8.5.23/rt/sh_to_modulefile/t1/2021_11_25_14_15_05-Linux-x86_64-sh_to_modulefile/_err.{left,right}
--- /tmp/portage/sys-cluster/lmod-8.5.23/work/Lmod-8.5.23/rt/sh_to_modulefile/t1/2021_11_25_14_15_05-Linux-x86_64-sh_to_modulefile/_err.left	2021-11-25 14:15:47.185258555 +0100
+++ /tmp/portage/sys-cluster/lmod-8.5.23/work/Lmod-8.5.23/rt/sh_to_modulefile/t1/2021_11_25_14_15_05-Linux-x86_64-sh_to_modulefile/_err.right	2021-11-25 14:15:47.185258555 +0100
@@ -8,22 +8,62 @@
 step 2
 lua ProjectDIR/src/sh_to_modulefile.in.lua ProjectDIR/rt/sh_to_modulefile/tstScript.sh
 ===========================
+lua: ...er/lmod-8.5.23/work/Lmod-8.5.23/src/../tools/MF_Base.lua:92: [string "oldEnvT = {..."]:15: '}' expected (to close '{' at line 1) near '@'
+stack traceback:
+	[C]: in function 'assert'
+	...er/lmod-8.5.23/work/Lmod-8.5.23/src/../tools/MF_Base.lua:92: in function 'MF_Base.process'
+	...luster/lmod-8.5.23/work/Lmod-8.5.23/src/convertSh2MF.lua:194: in function 'convertSh2MF'
+	...lmod-8.5.23/work/Lmod-8.5.23/src/sh_to_modulefile.in.lua:249: in function 'main'
+	...lmod-8.5.23/work/Lmod-8.5.23/src/sh_to_modulefile.in.lua:345: in main chunk
+	[C]: in ?
 ===========================
... (remaining output stripped)

This looks like a real problem in Lmod.

@rtmclay
Copy link
Member

rtmclay commented Nov 26, 2021

I have fixed the LMOD_LD_PRELOAD issue with some filtering (via rt/common_func.sh) but the second issue is something special that is happening in your environment. Please using the "testing" branch from the github and retest. It should report the full text of what caused the Lua syntax error above.

If you want to be sure to capture everything you can change line 26 in rt/sh_to_modulefile/sh_to_modulefile.tdesc to:

 runSh2MF  -D         $(testDir)/tstScript.sh      # 2

and send me the file: _stderr.orig and s.log and after re-running the tests from the rt/sh_to_modulefile/t1/*/ directory.

Thanks for the bug report!

@rtmclay
Copy link
Member

rtmclay commented Dec 1, 2021

If you had a chance to look at this issue, please let me know.

@amadio
Copy link
Author

amadio commented Dec 2, 2021

Sorry, was busy at work and did not remember to look at this. Here's the stderr.log and s.log

@rtmclay
Copy link
Member

rtmclay commented Dec 2, 2021

The problem is that the sandbox is adding a variable with an "@" in it. Something that I have not see before:

SANDBOX_MESSAGE_P@TH = "/proc/4/fd/2",

So I have modified Lmod to be able to deal with these unusual names. I have updated the "testing" branch. Please test this branch to see if it now passes the test under gentoo. If it fails, please send me the_stderr.orig and s.log like before.

@amadio
Copy link
Author

amadio commented Dec 3, 2021

That's odd, I wonder why it uses an @ there. In any case, here is the new stderr.txt, there was no s.log in the directory this time (I did try to add the -D flag, maybe I added it to the wrong line?).

@rtmclay
Copy link
Member

rtmclay commented Dec 3, 2021

Looking at the stderr.txt file, it looks correct to me. Can I assume that all the tests pass?

@amadio
Copy link
Author

amadio commented Dec 4, 2021

No, even though it seems to pass, I get an error for the test. Here is the diff. Let me know if anything else would be useful to see.

# diff -u /tmp/portage/sys-cluster/lmod-9999/work/lmod-9999/rt/sh_to_modulefile/t1/2021_12_03_10_57_06-Linux-x86_64-sh_to_modulefile/_err.{left,right}
--- /tmp/portage/sys-cluster/lmod-9999/work/lmod-9999/rt/sh_to_modulefile/t1/2021_12_03_10_57_06-Linux-x86_64-sh_to_modulefile/_err.left	2021-12-03 10:57:58.958080388 +0100
+++ /tmp/portage/sys-cluster/lmod-9999/work/lmod-9999/rt/sh_to_modulefile/t1/2021_12_03_10_57_06-Linux-x86_64-sh_to_modulefile/_err.right	2021-12-03 10:57:58.958080388 +0100
@@ -6,8 +6,18 @@
     by Robert McLay mclay@tacc.utexas.edu
 ===========================
 step 2
-lua ProjectDIR/src/sh_to_modulefile.in.lua ProjectDIR/rt/sh_to_modulefile/tstScript.sh
+lua ProjectDIR/src/sh_to_modulefile.in.lua -D ProjectDIR/rt/sh_to_modulefile/tstScript.sh
 ===========================
+capture(/bin/bash --noprofile -norc -c " set -e;/lua ProjectDIR/src/printEnvT.lua oldEnvT; echo %__________blk_divider__________%; alias; echo %__________blk_divider__________%; declare -f; echo %__________blk_divider__________%; . ProjectDIR/rt/sh_to_modulefile/tstScript.sh 2>&1; echo %__________blk_divider__________%;/lua ProjectDIR/src/printEnvT.lua envT; echo %__________blk_divider__________%; alias; echo %__________blk_divider__________%; declare -f; echo %__________blk_divider__________%; "){
+} capture
+MF_Base:process(shellName, ignoreT, resultT){
+  MF_Base:processVars(ignoreT, oldEnvT, envT, a){
+  } MF_Base:processVars
+  MF_Base:processAliases(shellName, old, new, a){
+  } MF_Base:processAliases
+  MF_Base:processFuncs(shellName, old, new, a){
+  } MF_Base:processFuncs
+} MF_Base:process
 ===========================
 step 3
 lua ProjectDIR/src/sh_to_modulefile.in.lua ProjectDIR/rt/sh_to_modulefile/path_both_ends.sh
@@ -110,8 +120,8 @@
           "setenv(\"SECOND\",\"FOO_BAR\")",
         },
         ["ProjectDIR/rt/sh_to_modulefile/tstScript.sh"] = {
-          "setenv(\"MY_NAME\",\"tstScript.sh\")", "prepend_path(\"PATH\",\"ProjectDIR/rt/sh_to_modulefile/bin\")", "append_path(\"PATH\",\"ProjectDIR/rt/sh_to_modulefile/sbin\")", "setenv(\"TST_SCRIPT\",\"1\")", "set_alias(\"fooAlias\",\"foobin -q -l\")"
-          , [[set_shell_function("banner"," \\
+          "setenv(\"MY_NAME\",\"tstScript.sh\")", "prepend_path(\"PATH\",\"ProjectDIR/rt/sh_to_modulefile/bin\")", "append_path(\"PATH\",\"ProjectDIR/rt/sh_to_modulefile/sbin\")", "setenv(\"TST_SCRIPT\",\"1\")"
+          , "set_alias(\"fooAlias\",\"foobin -q -l\")", [[set_shell_function("banner"," \\
     local str=\\"$1\\";\\
     local RED='\\033[1;31m';\\
     local NONE='\\033[0m';\\
@@ -180,8 +190,8 @@
           "setenv(\"SECOND\",\"FOO_BAR\")",
         },
         ["ProjectDIR/rt/sh_to_modulefile/tstScript.sh"] = {
-          "setenv(\"MY_NAME\",\"tstScript.sh\")", "prepend_path(\"PATH\",\"ProjectDIR/rt/sh_to_modulefile/bin\")", "append_path(\"PATH\",\"ProjectDIR/rt/sh_to_modulefile/sbin\")", "setenv(\"TST_SCRIPT\",\"1\")", "set_alias(\"fooAlias\",\"foobin -q -l\")"
-          , [[set_shell_function("banner"," \\
+          "setenv(\"MY_NAME\",\"tstScript.sh\")", "prepend_path(\"PATH\",\"ProjectDIR/rt/sh_to_modulefile/bin\")", "append_path(\"PATH\",\"ProjectDIR/rt/sh_to_modulefile/sbin\")", "setenv(\"TST_SCRIPT\",\"1\")"
+          , "set_alias(\"fooAlias\",\"foobin -q -l\")", [[set_shell_function("banner"," \\
     local str=\\"$1\\";\\
     local RED='\\033[1;31m';\\
     local NONE='\\033[0m';\\

@amadio
Copy link
Author

amadio commented Dec 4, 2021

Without trying to add -D, I get

# diff -u /tmp/portage/sys-cluster/lmod-9999/work/lmod-9999/rt/sh_to_modulefile/t1/2021_12_04_12_31_58-Linux-x86_64-sh_to_modulefile/_err.{left,right}
--- /tmp/portage/sys-cluster/lmod-9999/work/lmod-9999/rt/sh_to_modulefile/t1/2021_12_04_12_31_58-Linux-x86_64-sh_to_modulefile/_err.left	2021-12-04 12:32:50.411831925 +0100
+++ /tmp/portage/sys-cluster/lmod-9999/work/lmod-9999/rt/sh_to_modulefile/t1/2021_12_04_12_31_58-Linux-x86_64-sh_to_modulefile/_err.right	2021-12-04 12:32:50.411831925 +0100
@@ -110,8 +110,8 @@
           "setenv(\"SECOND\",\"FOO_BAR\")",
         },
         ["ProjectDIR/rt/sh_to_modulefile/tstScript.sh"] = {
-          "setenv(\"MY_NAME\",\"tstScript.sh\")", "prepend_path(\"PATH\",\"ProjectDIR/rt/sh_to_modulefile/bin\")", "append_path(\"PATH\",\"ProjectDIR/rt/sh_to_modulefile/sbin\")", "setenv(\"TST_SCRIPT\",\"1\")", "set_alias(\"fooAlias\",\"foobin -q -l\")"
-          , [[set_shell_function("banner"," \\
+          "setenv(\"MY_NAME\",\"tstScript.sh\")", "prepend_path(\"PATH\",\"ProjectDIR/rt/sh_to_modulefile/bin\")", "append_path(\"PATH\",\"ProjectDIR/rt/sh_to_modulefile/sbin\")", "setenv(\"TST_SCRIPT\",\"1\")"
+          , "set_alias(\"fooAlias\",\"foobin -q -l\")", [[set_shell_function("banner"," \\
     local str=\\"$1\\";\\
     local RED='\\033[1;31m';\\
     local NONE='\\033[0m';\\
@@ -180,8 +180,8 @@
           "setenv(\"SECOND\",\"FOO_BAR\")",
         },
         ["ProjectDIR/rt/sh_to_modulefile/tstScript.sh"] = {
-          "setenv(\"MY_NAME\",\"tstScript.sh\")", "prepend_path(\"PATH\",\"ProjectDIR/rt/sh_to_modulefile/bin\")", "append_path(\"PATH\",\"ProjectDIR/rt/sh_to_modulefile/sbin\")", "setenv(\"TST_SCRIPT\",\"1\")", "set_alias(\"fooAlias\",\"foobin -q -l\")"
-          , [[set_shell_function("banner"," \\
+          "setenv(\"MY_NAME\",\"tstScript.sh\")", "prepend_path(\"PATH\",\"ProjectDIR/rt/sh_to_modulefile/bin\")", "append_path(\"PATH\",\"ProjectDIR/rt/sh_to_modulefile/sbin\")", "setenv(\"TST_SCRIPT\",\"1\")"
+          , "set_alias(\"fooAlias\",\"foobin -q -l\")", [[set_shell_function("banner"," \\
     local str=\\"$1\\";\\
     local RED='\\033[1;31m';\\
     local NONE='\\033[0m';\\

This is probably not a real failure, but the test is marked as failed for me.

@rtmclay
Copy link
Member

rtmclay commented Dec 4, 2021

Thanks for working with me on this. Your tests have a longer directory name then my tests which lead to the difference you saw. I have update Lmod to handle longer directory names when testing. Please update your "testing" branching and re-run the tests. I believe that it will pass this time but please let me know either way.

rtmclay pushed a commit that referenced this issue Dec 4, 2021
…orts that are effected by long directory names
@amadio
Copy link
Author

amadio commented Dec 6, 2021

Indeed, after your last changes, all tests pass. Thank you!

@rtmclay
Copy link
Member

rtmclay commented Dec 6, 2021

Great. I'm closing this issue.

@amadio
Copy link
Author

amadio commented Dec 7, 2021

Just a follow up request. I noticed that ksh and zsh are now test dependencies of Lmod. Is there a way to easily disable tests using ksh at least?

@rtmclay
Copy link
Member

rtmclay commented Dec 7, 2021

There are no tests that depend on ksh. I moved /usr/bin/ksh to /usr/bin/ksh.orig and all the test passed.

@amadio
Copy link
Author

amadio commented Dec 8, 2021

I see this when I run without ksh and zsh installed:

diff -u /tmp/portage/sys-cluster/lmod-8.6/work/Lmod-8.6/rt/sh_to_modulefile/t1/2021_12_08_10_28_32-Linux-x86_64-sh_to_modulefile/_err.{left,right}
--- /tmp/portage/sys-cluster/lmod-8.6/work/Lmod-8.6/rt/sh_to_modulefile/t1/2021_12_08_10_28_32-Linux-x86_64-sh_to_modulefile/_err.left	2021-12-08 10:29:24.751946959 +0100
+++ /tmp/portage/sys-cluster/lmod-8.6/work/Lmod-8.6/rt/sh_to_modulefile/t1/2021_12_08_10_28_32-Linux-x86_64-sh_to_modulefile/_err.right	2021-12-08 10:29:24.751946959 +0100
@@ -20,10 +20,14 @@
 step 5
 lua ProjectDIR/src/sh_to_modulefile.in.lua --from zsh ProjectDIR/rt/sh_to_modulefile/tstScript.zsh
 ===========================
+sh: line 1: unknown_path_for_zsh: command not found
+Error in script "ProjectDIR/rt/sh_to_modulefile/tstScript.zsh": nil
 ===========================
 step 6
 lua ProjectDIR/src/sh_to_modulefile.in.lua --from ksh ProjectDIR/rt/sh_to_modulefile/kshScript.ksh
 ===========================
+sh: line 1: unknown_path_for_ksh: command not found
+Error in script "ProjectDIR/rt/sh_to_modulefile/kshScript.ksh": nil
 ===========================
 step 7
 lua ProjectDIR/src/sh_to_modulefile.in.lua ProjectDIR/rt/sh_to_modulefile/broken.sh

@rtmclay
Copy link
Member

rtmclay commented Dec 19, 2021

Lmod 8.6.1+ have changed the tests so that there is a separate test for ksh and another for zsh. So for each of these test, they are only run if that shell is installed. Please test this when you get a chance.

@amadio
Copy link
Author

amadio commented Dec 20, 2021

Lmod 8.6.1 still tries to run ksh and zsh tests for me.

...
passed   R  0.272  rt/versionTest/versionTest/t1              
diff     R  0.153  rt/ksh_to_modulefile/ksh_to_modulefile/t1  
diff     R  0.152  rt/zsh_to_modulefile/zsh_to_modulefile/t1  

*******  ****************
Results  Output Directory
*******  ****************
diff     /tmp/portage/sys-cluster/lmod-8.6.1/work/Lmod-8.6.1/rt/ksh_to_modulefile/t1/2021_12_20_12_35_30-Linux-x86_64-ksh_to_modulefile
diff     /tmp/portage/sys-cluster/lmod-8.6.1/work/Lmod-8.6.1/rt/zsh_to_modulefile/t1/2021_12_20_12_35_30-Linux-x86_64-sh_to_modulefile

FWIW, the tests are run with tm -vvv, so maybe there's some extra output that makes the two tests above fail?

@rtmclay
Copy link
Member

rtmclay commented Dec 20, 2021

The new tests, ksh_to_modulefile and zsh_to_modulefile, first test to see if the shell is in the path. If not the test is marked as active equals false. So the only way that you could get a failure is if there is some command "ksh" in the path but it not the actual shell.

Lets stick with just the ksh test. Is ksh installed? Or is there some executable called ksh installed? What error to you see in the ksh test directory? What does result.csv say? What do err.txt or out.txt say?

@amadio
Copy link
Author

amadio commented Mar 9, 2022

I do not have ksh or zsh installed, and no such commands are in the PATH. The tests still fail (just tried with version 8.6.14), the error being that the shell command is not found. The results for ksh are shown below:

# diff -u /tmp/portage/sys-cluster/lmod-8.6.14/work/Lmod-8.6.14/rt/ksh_to_modulefile/t1/2022_03_09_17_15_22-Linux-x86_64-ksh_to_modulefile/_{out,err}.right
--- /tmp/portage/sys-cluster/lmod-8.6.14/work/Lmod-8.6.14/rt/ksh_to_modulefile/t1/2022_03_09_17_15_22-Linux-x86_64-ksh_to_modulefile/_out.right	2022-03-09 17:15:40.008222489 +0100
+++ /tmp/portage/sys-cluster/lmod-8.6.14/work/Lmod-8.6.14/rt/ksh_to_modulefile/t1/2022_03_09_17_15_22-Linux-x86_64-ksh_to_modulefile/_err.right	2022-03-09 17:15:40.028222497 +0100
@@ -2,7 +2,11 @@
 step 1
 lua ProjectDIR/src/lmod.in.lua bash --regression_testing --version
 ===========================
+Modules based on Lua: Version
+    by Robert McLay mclay@tacc.utexas.edu
 ===========================
 step 2
 buildSh2MF --from ksh ProjectDIR/rt/ksh_to_modulefile/script.ksh
 ===========================
+sh: line 1: unknown_path_for_ksh: command not found
+Error in script "ProjectDIR/rt/ksh_to_modulefile/script.ksh": nil

@rtmclay
Copy link
Member

rtmclay commented Mar 10, 2022

This is not a bug in Lmod but a bug in the Hermes testing system. Please update Hermes to version 2.9 and try again. Thanks for the bug report!

@amadio
Copy link
Author

amadio commented Mar 11, 2022

Indeed, I updates Hermes to 2.9 and now all the tests pass. Thanks for your patience with this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants