From: Brenden Blanco Date: Fri, 23 Jun 2017 08:08:07 +0000 (-0700) Subject: test: python3 fix for test_uprobes (#1228) X-Git-Tag: submit/tizen_4.0/20171018.110122~77 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1ffe18f85535052255e50555e33285936b2bc7cb;p=platform%2Fupstream%2Fbcc.git test: python3 fix for test_uprobes (#1228) Treat strings as bytes. This is independent of the larger refactor (#1139) from which it is cherry-picked) Signed-off-by: Brenden Blanco --- diff --git a/tests/python/test_uprobes.py b/tests/python/test_uprobes.py index 3926e35f..62a370fa 100755 --- a/tests/python/test_uprobes.py +++ b/tests/python/test_uprobes.py @@ -88,9 +88,13 @@ int count(struct pt_regs *ctx) { p = subprocess.Popen(["ldconfig", "-p"], stdout=subprocess.PIPE) for l in p.stdout: n = l.split() - if n[0] == "libz.so.1": - libz_path = n[-1] + if n[0] == b"libz.so.1": + # if libz was already found, override only if new lib is more + # specific (e.g. libc6,x86-64 vs libc6) + if not libz_path or len(n[1].split(b",")) > 1: + libz_path = n[-1] p.wait() + p.stdout.close() p = None self.assertIsNotNone(libz_path) @@ -104,15 +108,15 @@ int count(struct pt_regs *ctx) { raise OSError(e, errno.errorcode[e]) # Remount root MS_REC|MS_PRIVATE - if libc.mount(None, "/", None, (1<<14)|(1<<18) , None) == -1: + if libc.mount(None, b"/", None, (1<<14)|(1<<18) , None) == -1: e = ctypes.get_errno() raise OSError(e, errno.errorcode[e]) - if libc.mount("tmpfs", "/tmp", "tmpfs", 0, None) == -1: + if libc.mount(b"tmpfs", b"/tmp", b"tmpfs", 0, None) == -1: e = ctypes.get_errno() raise OSError(e, errno.errorcode[e]) - shutil.copy(libz_path, "/tmp") + shutil.copy(libz_path, b"/tmp") libz = ctypes.CDLL("/tmp/libz.so.1") time.sleep(1)