Chromium Code Reviews| Index: test/mac/gyptest-strip-default.py |
| =================================================================== |
| --- test/mac/gyptest-strip-default.py (revision 0) |
| +++ test/mac/gyptest-strip-default.py (revision 0) |
| @@ -0,0 +1,55 @@ |
| +#!/usr/bin/env python |
| + |
| +# Copyright (c) 2012 Google Inc. All rights reserved. |
|
Mark Mentovai
2013/09/13 16:09:05
2013
Nico
2013/09/13 20:11:07
Time flies! Done.
|
| +# Use of this source code is governed by a BSD-style license that can be |
| +# found in the LICENSE file. |
| + |
| +""" |
| +Verifies that the default STRIP_STYLEs match between different generators. |
| +""" |
| + |
| +import TestGyp |
| + |
| +import re |
| +import subprocess |
| +import sys |
| +import time |
| + |
| +if sys.platform == 'darwin': |
| + test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode']) |
| + |
| + CHDIR='strip' |
| + test.run_gyp('test-defaults.gyp', chdir=CHDIR) |
| + |
| + test.build('test-defaults.gyp', test.ALL, chdir=CHDIR) |
| + |
| + # Lightweight check if stripping was done. |
| + def OutPath(s): |
| + return test.built_file_path(s, chdir=CHDIR) |
| + |
| + def CheckNsyms(p, n_expected): |
| + r = re.compile(r'nsyms\s+(\d+)') |
| + proc = subprocess.Popen(['otool', '-l', p], stdout=subprocess.PIPE) |
|
Mark Mentovai
2013/09/13 16:09:05
Compare the output of nm -aU instead? That gives y
Nico
2013/09/13 20:11:07
Oh, nice. Why -U?
(Done for `nm -a`)
Mark Mentovai
2013/09/13 21:31:32
Nico wrote:
|
| + o = proc.communicate()[0] |
| + assert not proc.returncode |
| + m = r.search(o) |
| + n = int(m.group(1)) |
| + if n != n_expected: |
| + print 'Stripping: Expected %d symbols, got %d' % (n_expected, n) |
| + test.fail_test() |
| + |
| + # The actual numbers here are not interesting, they just need to be the same |
| + # in both the xcode and the ninja build. |
| + CheckNsyms(OutPath('libsingle_dylib.dylib'), 2) |
| + CheckNsyms(OutPath('single_so.so'), 2) |
| + CheckNsyms(OutPath('single_exe'), 2) |
| + |
| + CheckNsyms(test.built_file_path( |
| + 'bundle_dylib.framework/Versions/A/bundle_dylib', chdir=CHDIR), 2) |
| + CheckNsyms(test.built_file_path( |
| + 'bundle_so.bundle/Contents/MacOS/bundle_so', chdir=CHDIR), 2) |
| + CheckNsyms(test.built_file_path( |
| + 'bundle_exe.app/Contents/MacOS/bundle_exe', chdir=CHDIR), 2) |
| + |
| + test.pass_test() |
| + |
|
Mark Mentovai
2013/09/13 16:09:05
Blank line at EOF.
Nico
2013/09/13 20:11:07
Done.
|
| Property changes on: test/mac/gyptest-strip-default.py |
| ___________________________________________________________________ |
| Added: svn:eol-style |
| + LF |