diff mbox series

[3/3] elf: Fix tst-pldd for non-default --prefix and/or --bindir (BZ#24544)

Message ID 20190513165952.28972-3-adhemerval.zanella@linaro.org
State New
Headers show
Series [1/3] Make --bindir effetive | expand

Commit Message

Adhemerval Zanella Netto May 13, 2019, 4:59 p.m. UTC
Use a new libsupport support_bindir_prefix instead of a hardcoded
/usr/bin to create the pldd path on container directory.

Checked on x86_64-linux-gnu with default and non-default --prefix and
--bindir paths, as well with --enable-hardcoded-path-in-tests.

	[BZ #24544]
	* elf/tst-pldd.c (do_test): Use support_bindir_prefix instead of
	pre-defined value.
---
 elf/tst-pldd.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

-- 
2.17.1

Comments

Rafal Luzynski May 18, 2019, 7:07 p.m. UTC | #1
13.05.2019 18:59 Adhemerval Zanella <adhemerval.zanella@linaro.org> wrote:
> 

> Use a new libsupport support_bindir_prefix instead of a hardcoded

> /usr/bin to create the pldd path on container directory.

> 

> Checked on x86_64-linux-gnu with default and non-default --prefix and

> --bindir paths, as well with --enable-hardcoded-path-in-tests.

> 

> 	[BZ #24544]

> 	* elf/tst-pldd.c (do_test): Use support_bindir_prefix instead of

> 	pre-defined value.


Thank you for this fix Adhemerval.  I'd like to say that thanks to this
fix the testsuite passes again on my older machine and fixes the problem
which I complained about the other day.  So if anybody (Florian?) wants
to backport the pldd fix to 2.27 *with* the test cases it is possible now.

(Disclaimer: Before changing anything it must be verified that it's really
this patch which fixes the problem and that whether it requires some other
patches.  I have not verified every single commit.)

Regards,

Rafal
Florian Weimer May 20, 2019, 9:12 a.m. UTC | #2
* Rafal Luzynski:

> 13.05.2019 18:59 Adhemerval Zanella <adhemerval.zanella@linaro.org> wrote:

>> 

>> Use a new libsupport support_bindir_prefix instead of a hardcoded

>> /usr/bin to create the pldd path on container directory.

>> 

>> Checked on x86_64-linux-gnu with default and non-default --prefix and

>> --bindir paths, as well with --enable-hardcoded-path-in-tests.

>> 

>> 	[BZ #24544]

>> 	* elf/tst-pldd.c (do_test): Use support_bindir_prefix instead of

>> 	pre-defined value.

>

> Thank you for this fix Adhemerval.  I'd like to say that thanks to this

> fix the testsuite passes again on my older machine and fixes the problem

> which I complained about the other day.  So if anybody (Florian?) wants

> to backport the pldd fix to 2.27 *with* the test cases it is possible

> now.


The other blocker for the test backport is the lack of the
test-in-container framework.  I'm not sure if we should backport that.

Thanks,
Florian
diff mbox series

Patch

diff --git a/elf/tst-pldd.c b/elf/tst-pldd.c
index 2a9f58936f..6b7c94a1c0 100644
--- a/elf/tst-pldd.c
+++ b/elf/tst-pldd.c
@@ -18,6 +18,7 @@ 
 
 #include <stdio.h>
 #include <string.h>
+#include <stdlib.h>
 #include <unistd.h>
 #include <stdint.h>
 #include <stdbool.h>
@@ -28,6 +29,7 @@ 
 #include <support/subprocess.h>
 #include <support/capture_subprocess.h>
 #include <support/check.h>
+#include <support/support.h>
 
 static void
 target_process (void *arg)
@@ -60,12 +62,14 @@  do_test (void)
     char pid[3 * sizeof (uint32_t) + 1];
     snprintf (pid, array_length (pid), "%d", target.pid);
 
-    const char prog[] = "/usr/bin/pldd";
+    char *prog = xasprintf ("%s/pldd", support_bindir_prefix);
 
     pldd = support_capture_subprogram (prog,
       (char *const []) { (char *) prog, pid, NULL });
 
     support_capture_subprocess_check (&pldd, "pldd", 0, sc_allow_stdout);
+
+    free (prog);
   }
 
   /* Check 'pldd' output.  The test is expected to be linked against only