Skip to contentSkip to conversation

nettle-ptest: fix a failing test

PATCH In review Juro Bystricky 2 participants 5 messages Oct 13, 2017 – Oct 16, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nettle-ptest: fix a failing test

This patch changes the result of the nettle dlopen-test from FAIL to PASS. The test used to fail because the test could not find and load libnettle.so.
This patch fixes this by using absolute path instead of relative.

This was the only test out of 88 that used to fail.

---
 .../nettle/nettle-3.3/dlopen-test.patch              | 20 ++++++++++++++++++++
 meta/recipes-support/nettle/nettle_3.3.bb            |  4 ++++
 2 files changed, 24 insertions(+)
 create mode 100644 meta/recipes-support/nettle/nettle-3.3/dlopen-test.patch
meta/recipes-support/nettle/nettle-3.3/dlopen-test.patch new file +20 -0
new file mode 100644
index 0000000..c4f0b7e
@@ -0,0 +1,20 @@
+Replace relative path of libnettle.so with absolute path so the test
+program can find it.
+Relative paths are not suitable, as the folder strucure for ptest
+is different from the one expected by the nettle testsuite.
+
+Upstream-Status: Inappropriate [embedded specific]
+
+Signed-off-by: Juro Bystricky <[email protected]>
+
+--- a/testsuite/dlopen-test.c	2016-10-01 00:28:38.000000000 -0700
++++ b/testsuite/dlopen-test.c	2017-10-13 11:08:57.227572860 -0700
+@@ -9,7 +9,7 @@
+ main (int argc UNUSED, char **argv UNUSED)
+ {
+ #if HAVE_LIBDL
+-  void *handle = dlopen ("../libnettle.so", RTLD_NOW);
++  void *handle = dlopen ("/usr/lib/libnettle.so", RTLD_NOW);
+   int (*get_version)(void);
+   if (!handle)
+     {
meta/recipes-support/nettle/nettle_3.3.bb +4 -0
index b76babf..3951678 100644
@@ -11,5 +11,9 @@ SRC_URI += "\
             file://check-header-files-of-openssl-only-if-enable_.patch \
             "
 
+SRC_URI_append_class-target = "\
+            file://dlopen-test.patch \
+            "
+
 SRC_URI[md5sum] = "10f969f78a463704ae73529978148dbe"
 SRC_URI[sha256sum] = "46942627d5d0ca11720fec18d81fc38f7ef837ea4197c1f630e71ce0d470b11e"
Signature · 1 line
2.7.4
#1 lore raw
Quoted 30 lines · Juro Bystricky

This patch changes the result of the nettle dlopen-test from FAIL to PASS. The test used to fail because the test could not find and load libnettle.so.
This patch fixes this by using absolute path instead of relative.

This was the only test out of 88 that used to fail.

---
 .../nettle/nettle-3.3/dlopen-test.patch              | 20
++++++++++++++++++++
 meta/recipes-support/nettle/nettle_3.3.bb            |  4 ++++
 2 files changed, 24 insertions(+)
 create mode 100644

meta/recipes-support/nettle/nettle-3.3/dlopen-test.patch

meta/recipes-support/nettle/nettle-3.3/dlopen-test.patch new file +7 -0
new file mode 100644
index 0000000..c4f0b7e
@@ -0,0 +1,20 @@
+Replace relative path of libnettle.so with absolute path so the test
+program can find it.
+Relative paths are not suitable, as the folder strucure for ptest
+is different from the one expected by the nettle testsuite.
+
+Upstream-Status: Inappropriate [embedded specific]
+

meta/recipes-support/nettle/nettle-3.3/dlopen-test.patch line 17

Quoted 10 lines
meta/recipes-support/nettle/nettle-3.3/dlopen-test.patch new file +10 -0
+Signed-off-by: Juro Bystricky <[email protected]>
+
+--- a/testsuite/dlopen-test.c  2016-10-01 00:28:38.000000000 -0700
++++ b/testsuite/dlopen-test.c  2017-10-13 11:08:57.227572860 -0700
+@@ -9,7 +9,7 @@
+ main (int argc UNUSED, char **argv UNUSED)
+ {
+ #if HAVE_LIBDL
+-  void *handle = dlopen ("../libnettle.so", RTLD_NOW);
++  void *handle = dlopen ("/usr/lib/libnettle.so", RTLD_NOW);

I think it would be preferred if you could use LD_LIBRARY_PATH to search for it

Quoted 29 lines
meta/recipes-support/nettle/nettle-3.3/dlopen-test.patch new file +3 -0
+   int (*get_version)(void);
+   if (!handle)
+     {
meta/recipes-support/nettle/nettle_3.3.bb +4 -0
index b76babf..3951678 100644
@@ -11,5 +11,9 @@ SRC_URI += "\
             file://check-header-files-of-openssl-only-if-enable_.patch \
             "
 
+SRC_URI_append_class-target = "\
+            file://dlopen-test.patch \
+            "
+
 SRC_URI[md5sum] = "10f969f78a463704ae73529978148dbe"
 SRC_URI[sha256sum] =

"46942627d5d0ca11720fec18d81fc38f7ef837ea4197c1f630e71ce0d470b11e" --
2.7.4

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

#2 lore raw

I don’t think you can use LD_LIBRARY_PATH due to the hardcoded relative path in "../libnettle.so”.
I could, however, change the patch from "/usr/lib/libnettle.so" to “libnettle.so”, removing any paths. That way LD_LIBRARY_PATH can be used if needed. But in the end it will load the library from /usr/lib/nettle.so anyway.

I think it would be preferred if you could use LD_LIBRARY_PATH to search for it

#3 lore raw
Quoted 2 lines · Juro

I don’t think you can use LD_LIBRARY_PATH due to the hardcoded relative path in "../libnettle.so”.

It should look in paths relative to LD_LIBRARY_PATH, do you see it doesn't happen ?

Quoted 18 lines

I could, however, change the patch from "/usr/lib/libnettle.so" to “libnettle.so”, removing any paths.

That way LD_LIBRARY_PATH can be used if needed. But in the end it will load the library from /usr/lib/nettle.so anyway.

I think it would be preferred if you could use LD_LIBRARY_PATH to search for it

#4 lore raw
Quoted 4 lines

It should look in paths relative to LD_LIBRARY_PATH, do you see it doesn't happen ?

The problem is, for dlopen relative/absolute names LD_LIBRARY_PATH is not used.

The man for dlopen says:
If filename contains a slash ("/"), then it is interpreted as a (relative or absolute) pathname. Otherwise <...> if the dynamic linker at the time that the program was started, the environment variable LD_LIBRARY_PATH was defined to contain a colon-separated list of directories, then these are searched.