|
OLD | NEW |
---|---|
(Empty) | |
1 #!/usr/bin/env python | |
2 | |
3 # 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.
| |
4 # Use of this source code is governed by a BSD-style license that can be | |
5 # found in the LICENSE file. | |
6 | |
7 """ | |
8 Verifies that the default STRIP_STYLEs match between different generators. | |
9 """ | |
10 | |
11 import TestGyp | |
12 | |
13 import re | |
14 import subprocess | |
15 import sys | |
16 import time | |
17 | |
18 if sys.platform == 'darwin': | |
19 test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode']) | |
20 | |
21 CHDIR='strip' | |
22 test.run_gyp('test-defaults.gyp', chdir=CHDIR) | |
23 | |
24 test.build('test-defaults.gyp', test.ALL, chdir=CHDIR) | |
25 | |
26 # Lightweight check if stripping was done. | |
27 def OutPath(s): | |
28 return test.built_file_path(s, chdir=CHDIR) | |
29 | |
30 def CheckNsyms(p, n_expected): | |
31 r = re.compile(r'nsyms\s+(\d+)') | |
32 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:
| |
33 o = proc.communicate()[0] | |
34 assert not proc.returncode | |
35 m = r.search(o) | |
36 n = int(m.group(1)) | |
37 if n != n_expected: | |
38 print 'Stripping: Expected %d symbols, got %d' % (n_expected, n) | |
39 test.fail_test() | |
40 | |
41 # The actual numbers here are not interesting, they just need to be the same | |
42 # in both the xcode and the ninja build. | |
43 CheckNsyms(OutPath('libsingle_dylib.dylib'), 2) | |
44 CheckNsyms(OutPath('single_so.so'), 2) | |
45 CheckNsyms(OutPath('single_exe'), 2) | |
46 | |
47 CheckNsyms(test.built_file_path( | |
48 'bundle_dylib.framework/Versions/A/bundle_dylib', chdir=CHDIR), 2) | |
49 CheckNsyms(test.built_file_path( | |
50 'bundle_so.bundle/Contents/MacOS/bundle_so', chdir=CHDIR), 2) | |
51 CheckNsyms(test.built_file_path( | |
52 'bundle_exe.app/Contents/MacOS/bundle_exe', chdir=CHDIR), 2) | |
53 | |
54 test.pass_test() | |
55 | |
Mark Mentovai
2013/09/13 16:09:05
Blank line at EOF.
Nico
2013/09/13 20:11:07
Done.
| |
OLD | NEW |