From 135429fa63ed2ecd5b503cb8f2441762d4346a55 Mon Sep 17 00:00:00 2001 From: Cengiz Can Date: Mon, 14 Mar 2016 02:14:35 +0200 Subject: [PATCH] Add a script to CI to check dynamic symbols in Android binary #8351 --- etc/ci/check_dynamic_symbols.py | 34 +++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 etc/ci/check_dynamic_symbols.py diff --git a/etc/ci/check_dynamic_symbols.py b/etc/ci/check_dynamic_symbols.py new file mode 100644 index 00000000000..3eb8bd87f13 --- /dev/null +++ b/etc/ci/check_dynamic_symbols.py @@ -0,0 +1,34 @@ +# Copyright 2013 The Servo Project Developers. See the COPYRIGHT +# file at the top-level directory of this distribution. +# +# Licensed under the Apache License, Version 2.0 or the MIT license +# , at your +# option. This file may not be copied, modified, or distributed +# except according to those terms. + +import sys +import re +import subprocess + +symbol_regex = re.compile("D \*UND\*\t(.*) (.*)$") +allowed_symbols = frozenset(['unshare', 'malloc_usable_size']) +actual_symbols = set() + +objdump_output = subprocess.check_output([ + 'arm-linux-androideabi-objdump', + '-T', + 'target/arm-linux-androideabi/debug/libservo.so'] +).split('\n') + +for line in objdump_output: + m = symbol_regex.search(line) + if m is not None: + actual_symbols.add(m.group(2)) + +difference = actual_symbols - allowed_symbols + +if len(difference) > 0: + human_readable_difference = ", ".join(str(s) for s in difference) + print("Unexpected dynamic symbols in binary: {0}".format(human_readable_difference)) + sys.exit(-1)