[CRIU] [PATCH 2/4] test: enhance library lookup when building mntns root

Filipe Brandenburger filbranden at google.com
Mon Aug 25 20:53:58 PDT 2014


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: Filipe Brandenburger <filbranden at google.com>
---
 test/zdtm.sh | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/test/zdtm.sh b/test/zdtm.sh
index 06152a6589e6..cfbdce27eb9c 100755
--- a/test/zdtm.sh
+++ b/test/zdtm.sh
@@ -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
-- 
1.9.3



More information about the CRIU mailing list