Commit 3b9e9b84 authored by Filipe Brandenburger's avatar Filipe Brandenburger Committed by Pavel Emelyanov

test: enhance library lookup when building mntns root

Use a single awk script to parse the ldd output. Filter out other cases that
are clearly not libraries, such as static builds ("not a dynamic executable")
and linux-gate.so. Make the grep for vdso more specific into linux-vdso.so.

Tested:
- sudo test/zdtm.sh '^ns/.*'
Signed-off-by: 's avatarFilipe Brandenburger <filbranden@google.com>
Acked-by: 's avatarAndrew Vagin <avagin@parallels.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 3a8cf03d
......@@ -337,7 +337,15 @@ construct_root()
# libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0xb6dc5000)
# /lib/ld-linux-armhf.so.3 (0xb6f0b000)
for i in `ldd $test_path $ps_path | grep -P '^\s' | grep -v vdso | sed "s/.*=> //" | awk '{ print $1 }'`; do
local libs=$(ldd $test_path $ps_path | awk '
!/^[ \t]/ { next }
/\<linux-vdso\.so\>/ { next }
/\<linux-gate\.so\>/ { next }
/\<not a dynamic executable$/ { next }
$2 ~ /^=>$/ { print $3; next }
{ print $1 }
')
for i in ${libs}; do
local ldir lib=`basename $i`
[ -f $libdir2/$lib ] && continue # fast path
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment