Hi all,
Tests asm-tst4, asm-tst5 and asm-tst6 can fail if binaries produced by compiler require shared libraries which are not in system directories. For instance if the binaries are produced by development version of compiler. In such cases LD_LIBRARY_PATH should contain path to non-standard location of libraries, but in the aforementioned tests content of this variable is lost. The following patch can be used to solve the problem:
diff --git a/tests/asm-tst4.c b/tests/asm-tst4.c index 54d054c..e6a6210 100644 --- a/tests/asm-tst4.c +++ b/tests/asm-tst4.c @@ -102,7 +102,8 @@ main (void)
if (result == 0) result = WEXITSTATUS (system ("\ -env LD_LIBRARY_PATH=../libelf ../src/elflint -q asm-tst4-out.o")); +env LD_LIBRARY_PATH=../libelf${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH\ + ../src/elflint -q asm-tst4-out.o"));
/* We don't need the file anymore. */ unlink (fname); diff --git a/tests/asm-tst5.c b/tests/asm-tst5.c index 2a8b3f0..f81272b 100644 --- a/tests/asm-tst5.c +++ b/tests/asm-tst5.c @@ -114,7 +114,8 @@ main (void)
if (result == 0) result = WEXITSTATUS (system ("\ -env LD_LIBRARY_PATH=../libelf ../src/elflint -q asm-tst5-out.o")); +env LD_LIBRARY_PATH=../libelf${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH\ + ../src/elflint -q asm-tst5-out.o"));
/* We don't need the file anymore. */ unlink (fname); diff --git a/tests/asm-tst6.c b/tests/asm-tst6.c index bd6a71d..a4f5ac8 100644 --- a/tests/asm-tst6.c +++ b/tests/asm-tst6.c @@ -148,7 +148,8 @@ main (void)
if (result == 0) result = WEXITSTATUS (system ("\ -env LD_LIBRARY_PATH=../libelf ../src/elflint -q asm-tst6-out.o")); +env LD_LIBRARY_PATH=../libelf${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH\ + ../src/elflint -q asm-tst6-out.o"));
/* We don't need the file anymore. */ unlink (fname);
Thanks, --Serge
I think it would actually be better to have those use the wrapper scripts we use to run the tests. Or perhaps they don't need either the scripts or the LD_LIBRARY_PATH machinations at all because those tests themselves are now always run under the testing scripts and so have those settings as they need them in the environment.
Thanks, Roland
Not sure if I understand correctly what can I do. Maybe I should describe the problem in more details.
All tests are run using 'make check'. I use development compiler which keeps its runtime libraries in specific location. So in my environment the variable LD_LIBRARY_PATH contains path to this location and all tests pass but three ones. These tests fail because the executable file 'src/elflint' needs some shared libraries which cannot be found in usual places. The executable 'src/elflint' is launched using call 'system' and in the call LD_LIBRARY_PATH is overriden, previous content is lost so necessary shared libraries cannot be found.
I think this problem can be avoided if previous content of LD_LIBRARY_PATH is kept by tests asm_tst{4,5,6}. Are there another solution?
Thanks, --Serge 2011/12/30 Roland McGrath roland@hack.frob.com
I think it would actually be better to have those use the wrapper scripts we use to run the tests. Or perhaps they don't need either the scripts or the LD_LIBRARY_PATH machinations at all because those tests themselves are now always run under the testing scripts and so have those settings as they need them in the environment.
Thanks, Roland
What I suggested were two options for how to change the command lines run via the 'system' function in those tests. One is just to remove their clauses about LD_LIBRARY_PATH altogether and leave it at that. The other is to change them to run test-wrapper.sh.
Thanks, Roland
You are absolutely right! Removal of setting LD_LIBRARY_PATH in the aforementioned tests made them passing. The fix I used is below. Thank you!
--Serge diff --git a/tests/asm-tst4.c b/tests/asm-tst4.c index 54d054c..ffea204 100644 --- a/tests/asm-tst4.c +++ b/tests/asm-tst4.c @@ -101,8 +101,7 @@ main (void) }
if (result == 0) - result = WEXITSTATUS (system ("\ -env LD_LIBRARY_PATH=../libelf ../src/elflint -q asm-tst4-out.o")); + result = WEXITSTATUS (system ("../src/elflint -q asm-tst4-out.o"));
/* We don't need the file anymore. */ unlink (fname); diff --git a/tests/asm-tst5.c b/tests/asm-tst5.c index 2a8b3f0..c5f13c0 100644 --- a/tests/asm-tst5.c +++ b/tests/asm-tst5.c @@ -113,8 +113,7 @@ main (void) }
if (result == 0) - result = WEXITSTATUS (system ("\ -env LD_LIBRARY_PATH=../libelf ../src/elflint -q asm-tst5-out.o")); + result = WEXITSTATUS (system ("../src/elflint -q asm-tst5-out.o"));
/* We don't need the file anymore. */ unlink (fname); diff --git a/tests/asm-tst6.c b/tests/asm-tst6.c index bd6a71d..548e87c 100644 --- a/tests/asm-tst6.c +++ b/tests/asm-tst6.c @@ -147,8 +147,7 @@ main (void) }
if (result == 0) - result = WEXITSTATUS (system ("\ -env LD_LIBRARY_PATH=../libelf ../src/elflint -q asm-tst6-out.o")); + result = WEXITSTATUS (system ("../src/elflint -q asm-tst6-out.o"));
/* We don't need the file anymore. */ unlink (fname);
elfutils-devel@lists.fedorahosted.org