b1dca6
commit da2b83ef6ba6f4c974664f69e715cc85b9173938
b1dca6
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
b1dca6
Date:   Mon May 13 13:13:46 2019 -0300
b1dca6
b1dca6
    elf: Fix tst-pldd for non-default --prefix and/or --bindir (BZ#24544)
b1dca6
    
b1dca6
    Use a new libsupport support_bindir_prefix instead of a hardcoded
b1dca6
    /usr/bin to create the pldd path on container directory.
b1dca6
    
b1dca6
    Checked on x86_64-linux-gnu with default and non-default --prefix and
b1dca6
    --bindir paths, as well with --enable-hardcoded-path-in-tests.
b1dca6
    
b1dca6
            [BZ #24544]
b1dca6
            * elf/tst-pldd.c (do_test): Use support_bindir_prefix instead of
b1dca6
            pre-defined value.
b1dca6
    
b1dca6
    Reviewed-by: DJ Delorie <dj@redhat.com>
b1dca6
b1dca6
diff --git a/elf/tst-pldd.c b/elf/tst-pldd.c
b1dca6
index 40abee9efb9e7484..e2de31282a131166 100644
b1dca6
--- a/elf/tst-pldd.c
b1dca6
+++ b/elf/tst-pldd.c
b1dca6
@@ -18,6 +18,7 @@
b1dca6
 
b1dca6
 #include <stdio.h>
b1dca6
 #include <string.h>
b1dca6
+#include <stdlib.h>
b1dca6
 #include <unistd.h>
b1dca6
 #include <stdint.h>
b1dca6
 #include <stdbool.h>
b1dca6
@@ -28,6 +29,7 @@
b1dca6
 #include <support/subprocess.h>
b1dca6
 #include <support/capture_subprocess.h>
b1dca6
 #include <support/check.h>
b1dca6
+#include <support/support.h>
b1dca6
 
b1dca6
 static void
b1dca6
 target_process (void *arg)
b1dca6
@@ -60,12 +62,14 @@ do_test (void)
b1dca6
     char pid[3 * sizeof (uint32_t) + 1];
b1dca6
     snprintf (pid, array_length (pid), "%d", target.pid);
b1dca6
 
b1dca6
-    const char prog[] = "/usr/bin/pldd";
b1dca6
+    char *prog = xasprintf ("%s/pldd", support_bindir_prefix);
b1dca6
 
b1dca6
     pldd = support_capture_subprogram (prog,
b1dca6
       (char *const []) { (char *) prog, pid, NULL });
b1dca6
 
b1dca6
     support_capture_subprocess_check (&pldd, "pldd", 0, sc_allow_stdout);
b1dca6
+
b1dca6
+    free (prog);
b1dca6
   }
b1dca6
 
b1dca6
   /* Check 'pldd' output.  The test is expected to be linked against only