summaryrefslogtreecommitdiffstats
path: root/tools/check_ecs_deps
diff options
context:
space:
mode:
authorpetermayo@chromium.org <petermayo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-22 06:37:01 +0000
committerpetermayo@chromium.org <petermayo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-22 06:37:01 +0000
commit690cc1ba068050768689b62e9b1c9864ccb7f128 (patch)
tree4efcf536dcdb8789efef9c7336d3a67292152507 /tools/check_ecs_deps
parenta5b90fb1bd8427ed1a8251fba2e0dfc486fc36c3 (diff)
downloadchromium_src-690cc1ba068050768689b62e9b1c9864ccb7f128.zip
chromium_src-690cc1ba068050768689b62e9b1c9864ccb7f128.tar.gz
chromium_src-690cc1ba068050768689b62e9b1c9864ccb7f128.tar.bz2
Add whitelist and annotations to check_ecs_deps.
This should allow the step to turn orange. This should also allow the step to pass the build until certain eliminations have landed. This also escapes the list of libraries used to generate REs. R=rjkroege@chromium.org, spang@chromium.org BUG=None TEST=local Review URL: https://codereview.chromium.org/78783010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@236697 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/check_ecs_deps')
-rwxr-xr-xtools/check_ecs_deps/check_ecs_deps.py100
1 files changed, 88 insertions, 12 deletions
diff --git a/tools/check_ecs_deps/check_ecs_deps.py b/tools/check_ecs_deps/check_ecs_deps.py
index e6a2001..073001e 100755
--- a/tools/check_ecs_deps/check_ecs_deps.py
+++ b/tools/check_ecs_deps/check_ecs_deps.py
@@ -17,14 +17,65 @@ import optparse
kUndesiredLibraryList = [
'libcairo',
'libpango',
- 'libglib',
+# 'libglib', # TODO(spang) Stop depending on this.
+]
+
+kAllowedLibraryList = [
+ 'linux-vdso',
+ 'libfreetype',
+ 'librt',
+ 'libdl',
+ 'libgobject-2.0',
+ 'libnss3',
+ 'libnssutil3',
+ 'libsmime3',
+ 'libplc4',
+ 'libnspr4',
+ 'libfontconfig',
+ 'libdrm',
+ 'libasound',
+ 'libexpat',
+ # 'libudev', # TODO(rjkroege) Decide about this one.
+ 'libstdc++',
+ 'libm',
+ 'libgcc_s',
+ 'libpthread',
+ 'libc',
+ 'libz',
+ 'libffi',
+ 'libpcre',
+ 'libplds4',
]
binary_target = 'content_shell'
+def stdmsg(final, errors):
+ if errors:
+ for message in errors:
+ print message
+
+def bbmsg(final, errors):
+ if errors:
+ for message in errors:
+ print '@@@STEP_TEXT@%s@@@' % message
+ if final:
+ print '\n@@@STEP_%s@@@' % final
+
+
def _main():
+ output = {
+ 'message': lambda x: stdmsg(None, x),
+ 'fail': lambda x: stdmsg('FAILED', x),
+ 'warn': lambda x: stdmsg('WARNING', x),
+ 'abend': lambda x: stdmsg('FAILED', x),
+ 'ok': lambda x: stdmsg('SUCCESS', x),
+ }
+
parser = optparse.OptionParser(
"usage: %prog -b <dir> --target <Debug|Release>")
+ parser.add_option("", "--annotate", dest='annotate', action='store_true',
+ default=False, help="include buildbot annotations in output")
+ parser.add_option("", "--noannotate", dest='annotate', action='store_false')
parser.add_option("-b", "--build-dir",
help="the location of the compiler output")
parser.add_option("--target", help="Debug or Release")
@@ -42,36 +93,61 @@ def _main():
else:
target = binary_target
- forbidden_regexp = re.compile(string.join(kUndesiredLibraryList, '|'))
+ if options.annotate:
+ output = {
+ 'message': lambda x: bbmsg(None, x),
+ 'fail': lambda x: bbmsg('FAILURE', x),
+ 'warn': lambda x: bbmsg('WARNINGS', x),
+ 'abend': lambda x: bbmsg('EXCEPTIONS', x),
+ 'ok': lambda x: bbmsg('SUCCESS', x),
+ }
+
+ forbidden_regexp = re.compile(string.join(map(re.escape,
+ kUndesiredLibraryList), '|'))
+ mapping_regexp = re.compile(r"\s*([^/]*) => ")
+ blessed_regexp = re.compile(r"(%s)[-0-9.]*\.so" % string.join(map(re.escape,
+ kAllowedLibraryList), '|')
success = 0
+ warning = 0
p = subprocess.Popen(['ldd', target], stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
out, err = p.communicate()
if err != '':
- print "Failed to execute ldd to analyze dependencies for " + target + ':'
- print ' ' + err
- print "FAILED\n"
+ output['abend']([
+ 'Failed to execute ldd to analyze dependencies for ' + target + ':',
+ ' ' + err,
+ ])
return 1
if out == '':
- print "No output to scan for forbidden dependencies?\n"
- print "\nFAILED\n"
+ output['abend']([
+ 'No output to scan for forbidden dependencies.'
+ ])
return 1
success = 1
deps = string.split(out, '\n')
for d in deps:
- if re.search(forbidden_regexp, d) != None:
- success = 0
- print "Forbidden library: " + d
+ libmatch = mapping_regexp.match(d)
+ if libmatch:
+ lib = libmatch.group(1)
+ if forbidden_regexp.search(lib):
+ success = 0
+ output['message'](['Forbidden library: ' + lib])
+ if not blessed_regexp.match(lib):
+ warning = 1
+ output['message'](['Unexpected library: ' + lib])
if success == 1:
- print "\nSUCCESS\n"
+ if warning == 1:
+ output['warn'](None)
+ else:
+ output['ok'](None)
return 0
else:
- print "\nFAILED\n"
+ output['fail'](None)
return 1
if __name__ == "__main__":