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', '-a', p], stdout=subprocess.PIPE) |
| 32 o = proc.communicate()[0] |
| 33 assert not proc.returncode |
| 34 if o != o_expected: |
| 35 print 'Stripping: Expected symbols """\n%s""", got """\n%s"""' % ( |
| 36 o_expected, o) |
| 37 test.fail_test() |
| 38 |
| 39 # The actual numbers here are not interesting, they just need to be the same |
| 40 # in both the xcode and the ninja build. |
| 41 CheckNsyms(OutPath('libsingle_dylib.dylib'), |
| 42 """\ |
| 43 00000fb3 T _the_function |
| 44 00000fa9 t _the_hidden_function |
| 45 00000fa4 T _the_used_function |
| 46 00000fae T _the_visible_function |
| 47 U dyld_stub_binder |
| 48 """) |
| 49 CheckNsyms(OutPath('single_so.so'), |
| 50 """\ |
| 51 00000fb3 T _the_function |
| 52 00000fa9 t _the_hidden_function |
| 53 00000fa4 T _the_used_function |
| 54 00000fae T _the_visible_function |
| 55 U dyld_stub_binder |
| 56 """) |
| 57 CheckNsyms(OutPath('single_exe'), |
| 58 """\ |
| 59 00001000 T __mh_execute_header |
| 60 U dyld_stub_binder |
| 61 """) |
| 62 |
| 63 CheckNsyms(test.built_file_path( |
| 64 'bundle_dylib.framework/Versions/A/bundle_dylib', chdir=CHDIR), |
| 65 """\ |
| 66 00000fb3 T _the_function |
| 67 00000fa9 t _the_hidden_function |
| 68 00000fa4 T _the_used_function |
| 69 00000fae T _the_visible_function |
| 70 U dyld_stub_binder |
| 71 """) |
| 72 CheckNsyms(test.built_file_path( |
| 73 'bundle_so.bundle/Contents/MacOS/bundle_so', chdir=CHDIR), |
| 74 """\ |
| 75 00000fb3 T _the_function |
| 76 00000fa4 T _the_used_function |
| 77 00000fae T _the_visible_function |
| 78 U dyld_stub_binder |
| 79 """) |
| 80 CheckNsyms(test.built_file_path( |
| 81 'bundle_exe.app/Contents/MacOS/bundle_exe', chdir=CHDIR), |
| 82 """\ |
| 83 00001000 T __mh_execute_header |
| 84 U dyld_stub_binder |
| 85 """) |
| 86 |
| 87 test.pass_test() |
OLD | NEW |