qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

tests/docker: better handle symlinked libs

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>

+9 -7
+9 -7
tests/docker/docker.py
··· 106 106 """Return a list of libraries associated with an executable. 107 107 108 108 The paths may be symbolic links which would need to be resolved to 109 - ensure theright data is copied.""" 109 + ensure the right data is copied.""" 110 110 111 111 libs = [] 112 - ldd_re = re.compile(r"(/.*/)(\S*)") 112 + ldd_re = re.compile(r"(?:\S+ => )?(\S*) \(:?0x[0-9a-f]+\)") 113 113 try: 114 114 ldd_output = subprocess.check_output(["ldd", executable]).decode('utf-8') 115 115 for line in ldd_output.split("\n"): 116 116 search = ldd_re.search(line) 117 - if search and len(search.groups()) == 2: 118 - so_path = search.groups()[0] 119 - so_lib = search.groups()[1] 120 - libs.append("%s/%s" % (so_path, so_lib)) 117 + if search: 118 + try: 119 + libs.append(s.group(1)) 120 + except IndexError: 121 + pass 121 122 except subprocess.CalledProcessError: 122 123 print("%s had no associated libraries (static build?)" % (executable)) 123 124 ··· 145 146 if libs: 146 147 for l in libs: 147 148 so_path = os.path.dirname(l) 148 - _copy_with_mkdir(l, dest_dir, so_path) 149 + real_l = os.path.realpath(l) 150 + _copy_with_mkdir(real_l, dest_dir, so_path) 149 151 150 152 151 153 def _check_binfmt_misc(executable):