Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1324)

Side by Side Diff: slave/skia_slave_scripts/detect_static_initializers.py

Issue 648353002: Remove Skia's forked buildbot code (Closed) Base URL: https://skia.googlesource.com/buildbot.git@master
Patch Set: Fix launch_slaves, remove more stuff Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 # Copyright (c) 2013 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 """ Detect static initializers in compiled Skia code. """
7
8 from build_step import BuildStep, BuildStepWarning
9 from py.utils import shell_utils
10 import os
11 import re
12 import sys
13 import urllib2
14
15
16 DUMP_STATIC_INITIALIZERS_FILENAME = 'dump-static-initializers.py'
17 DUMP_STATIC_INITIALIZERS_URL = ('http://src.chromium.org/svn/trunk/src/tools/'
18 + 'linux/' + DUMP_STATIC_INITIALIZERS_FILENAME)
19
20
21 class DetectStaticInitializers(BuildStep):
22 def _Run(self):
23 # Build the Skia libraries in Release mode.
24 os.environ['GYP_DEFINES'] = 'skia_static_initializers=0'
25 shell_utils.run(['python', 'gyp_skia'])
26 shell_utils.run(['make', 'skia_lib', 'BUILDTYPE=Release', '--jobs'])
27
28 # Obtain the dump-static-initializers script.
29 print 'Downloading %s' % DUMP_STATIC_INITIALIZERS_URL
30 dl = urllib2.urlopen(DUMP_STATIC_INITIALIZERS_URL)
31 with open(DUMP_STATIC_INITIALIZERS_FILENAME, 'wb') as f:
32 f.write(dl.read())
33
34 # Run the script over the compiled files.
35 results = []
36 for built_file_name in os.listdir(os.path.join('out', 'Release')):
37 if built_file_name.endswith('.a') or built_file_name.endswith('.so'):
38 output = shell_utils.run(['python', DUMP_STATIC_INITIALIZERS_FILENAME,
39 os.path.join('out', 'Release',
40 built_file_name)])
41 matches = re.search('Found (\d+) static initializers', output)
42 if matches:
43 num_found = int(matches.groups()[0])
44 if num_found:
45 results.append((built_file_name, num_found))
46 if results:
47 print
48 print 'Found static initializers:'
49 print
50 for result in results:
51 print ' %s: %d' % result
52 print
53 # TODO(borenet): Make this an error once we have no static initializers.
54 raise BuildStepWarning('Static initializers found!')
55
56
57 if '__main__' == __name__:
58 sys.exit(BuildStep.RunBuildStep(DetectStaticInitializers))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698