|
OLD | NEW |
---|---|
(Empty) | |
1 #!/usr/bin/env python | |
2 | |
3 # Copyright (c) 2013 Google Inc. All rights reserved. | |
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, o_expected): | |
31 proc = subprocess.Popen(['nm', '-aU', p], stdout=subprocess.PIPE) | |
32 o = proc.communicate()[0] | |
33 | |
34 # Filter out mysterious "00 0000 OPT radr://5614542" symbol which | |
35 # is apparently only printed on the bots (older toolchain?). | |
36 # Yes, "radr", not "rdar". | |
37 o = ''.join(filter(lambda s: 'radr://5614542' not in s, o.splitlines(True))) | |
Mark Mentovai
2013/09/14 04:23:37
If you Google that number, https://github.com/nico
Nico
2013/09/14 04:30:42
:-)
| |
38 | |
39 o = o.replace('A', 'T') | |
40 o = re.sub(r'^[a-fA-F0-9]+', 'XXXXXXXX', o, flags=re.MULTILINE) | |
Mark Mentovai
2013/09/14 04:23:37
OK, but be aware that 64-bit binaries are gonna ha
Nico
2013/09/14 04:30:42
Done.
| |
41 assert not proc.returncode | |
42 if o != o_expected: | |
43 print 'Stripping: Expected symbols """\n%s""", got """\n%s"""' % ( | |
44 o_expected, o) | |
45 test.fail_test() | |
46 | |
47 # The actual numbers here are not interesting, they just need to be the same | |
Mark Mentovai
2013/09/14 04:23:37
But you’re not testing that the numbers are the sa
Nico
2013/09/14 04:30:42
Done.
| |
48 # in both the xcode and the ninja build. | |
49 CheckNsyms(OutPath('libsingle_dylib.dylib'), | |
50 """\ | |
51 XXXXXXXX S _ci | |
52 XXXXXXXX S _i | |
53 XXXXXXXX T _the_function | |
54 XXXXXXXX t _the_hidden_function | |
55 XXXXXXXX T _the_used_function | |
56 XXXXXXXX T _the_visible_function | |
57 """) | |
58 CheckNsyms(OutPath('single_so.so'), | |
59 """\ | |
60 XXXXXXXX S _ci | |
61 XXXXXXXX S _i | |
62 XXXXXXXX T _the_function | |
63 XXXXXXXX t _the_hidden_function | |
64 XXXXXXXX T _the_used_function | |
65 XXXXXXXX T _the_visible_function | |
66 """) | |
67 CheckNsyms(OutPath('single_exe'), | |
68 """\ | |
69 XXXXXXXX T __mh_execute_header | |
70 """) | |
71 | |
72 CheckNsyms(test.built_file_path( | |
73 'bundle_dylib.framework/Versions/A/bundle_dylib', chdir=CHDIR), | |
74 """\ | |
75 XXXXXXXX S _ci | |
76 XXXXXXXX S _i | |
77 XXXXXXXX T _the_function | |
78 XXXXXXXX t _the_hidden_function | |
79 XXXXXXXX T _the_used_function | |
80 XXXXXXXX T _the_visible_function | |
81 """) | |
82 CheckNsyms(test.built_file_path( | |
83 'bundle_so.bundle/Contents/MacOS/bundle_so', chdir=CHDIR), | |
84 """\ | |
85 XXXXXXXX S _ci | |
86 XXXXXXXX S _i | |
87 XXXXXXXX T _the_function | |
88 XXXXXXXX T _the_used_function | |
89 XXXXXXXX T _the_visible_function | |
90 """) | |
91 CheckNsyms(test.built_file_path( | |
92 'bundle_exe.app/Contents/MacOS/bundle_exe', chdir=CHDIR), | |
93 """\ | |
94 XXXXXXXX T __mh_execute_header | |
95 """) | |
96 | |
97 test.pass_test() | |
OLD | NEW |