qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: peter.maydell@linaro.org
Cc: "Fam Zheng" <fam@euphon.net>,
	"Philippe Mathieu-Daudé" <philmd@redhat.com>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	qemu-devel@nongnu.org, "Robert Foley" <robert.foley@linaro.org>
Subject: [PULL 02/16] tests/docker: better handle symlinked libs
Date: Tue,  4 Feb 2020 18:40:14 +0000	[thread overview]
Message-ID: <20200204184028.13708-3-alex.bennee@linaro.org> (raw)
In-Reply-To: <20200204184028.13708-1-alex.bennee@linaro.org>

When we are copying we want to ensure we grab the first
resolution (the found in path section). However even that binary might
be a symlink so lets make sure we chase the symlinks to copy the right
binary to where it can be found.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Robert Foley <robert.foley@linaro.org>

Message-Id: <20200203090932.19147-3-alex.bennee@linaro.org>

diff --git a/tests/docker/docker.py b/tests/docker/docker.py
index 31d8adf836e..d8268c11117 100755
--- a/tests/docker/docker.py
+++ b/tests/docker/docker.py
@@ -106,18 +106,19 @@ def _get_so_libs(executable):
     """Return a list of libraries associated with an executable.
 
     The paths may be symbolic links which would need to be resolved to
-    ensure theright data is copied."""
+    ensure the right data is copied."""
 
     libs = []
-    ldd_re = re.compile(r"(/.*/)(\S*)")
+    ldd_re = re.compile(r"(?:\S+ => )?(\S*) \(:?0x[0-9a-f]+\)")
     try:
         ldd_output = subprocess.check_output(["ldd", executable]).decode('utf-8')
         for line in ldd_output.split("\n"):
             search = ldd_re.search(line)
-            if search and len(search.groups()) == 2:
-                so_path = search.groups()[0]
-                so_lib = search.groups()[1]
-                libs.append("%s/%s" % (so_path, so_lib))
+            if search:
+                try:
+                    libs.append(s.group(1))
+                except IndexError:
+                    pass
     except subprocess.CalledProcessError:
         print("%s had no associated libraries (static build?)" % (executable))
 
@@ -145,7 +146,8 @@ def _copy_binary_with_libs(src, bin_dest, dest_dir):
     if libs:
         for l in libs:
             so_path = os.path.dirname(l)
-            _copy_with_mkdir(l, dest_dir, so_path)
+            real_l = os.path.realpath(l)
+            _copy_with_mkdir(real_l, dest_dir, so_path)
 
 
 def _check_binfmt_misc(executable):
-- 
2.20.1



  parent reply	other threads:[~2020-02-04 18:44 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-04 18:40 [PULL 00/16] testing updates Alex Bennée
2020-02-04 18:40 ` [PULL 01/16] tests/docker: move most cross compilers to buster base Alex Bennée
2020-02-04 18:40 ` Alex Bennée [this message]
2020-02-04 18:40 ` [PULL 03/16] travis.yml: Install genisoimage package Alex Bennée
2020-02-04 18:40 ` [PULL 04/16] .shippable: --disable-docs for cross-compile tests Alex Bennée
2020-02-04 18:40 ` [PULL 05/16] .travis.yml: Drop superfluous use of --python=python3 parameter Alex Bennée
2020-02-04 18:40 ` [PULL 06/16] .travis.yml: Add description to each job Alex Bennée
2020-02-04 18:40 ` [PULL 07/16] .travis.yml: build documents under bionic Alex Bennée
2020-02-04 18:40 ` [PULL 08/16] .travis.yml: move cache flushing to early common phase Alex Bennée
2020-02-04 18:40 ` [PULL 09/16] .travis.yml: probe for number of available processors Alex Bennée
2020-02-04 18:40 ` [PULL 10/16] tests/tcg: add a configure compiler check for ARMv8.1 and SVE Alex Bennée
2020-02-04 18:40 ` [PULL 11/16] tests/tcg: gate pauth-% tests on having compiler support Alex Bennée
2020-02-04 18:40 ` [PULL 12/16] .travis.yml: introduce TEST_BUILD_CMD and use it for check-tcg Alex Bennée
2020-02-04 18:40 ` [PULL 13/16] .travis.yml: drop the travis_retry from tests Alex Bennée
2020-02-04 18:40 ` [PULL 14/16] .travis.yml: drop cris-linux-user from the plugins test Alex Bennée
2020-02-04 18:40 ` [PULL 15/16] .travis.yml: single thread build-tcg Alex Bennée
2020-02-04 18:40 ` [PULL 16/16] .travis.yml: ensure python3-sphinx installed for docs Alex Bennée
2020-02-06  9:53 ` [PULL 00/16] testing updates Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200204184028.13708-3-alex.bennee@linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=fam@euphon.net \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=robert.foley@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).