~hjd/ubuntu/wily/gyp/debian-merged

« back to all changes in this revision

Viewing changes to test/mac/gyptest-strip.py

  • Committer: Hans Joachim Desserud
  • Date: 2015-10-31 12:46:59 UTC
  • mfrom: (6.2.6 sid)
  • Revision ID: hans_joachim_desserud-20151031124659-lzxekr6woskh4k0b
Merge latest Debian version

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
"""
10
10
 
11
11
import TestGyp
 
12
import TestMac
12
13
 
13
14
import re
14
15
import subprocess
28
29
 
29
30
  def CheckNsyms(p, n_expected):
30
31
    r = re.compile(r'nsyms\s+(\d+)')
31
 
    proc = subprocess.Popen(['otool', '-l', p], stdout=subprocess.PIPE)
32
 
    o = proc.communicate()[0]
33
 
    assert not proc.returncode
 
32
    o = subprocess.check_output(['otool', '-l', p])
34
33
    m = r.search(o)
35
34
    n = int(m.group(1))
36
35
    if n != n_expected:
37
36
      print 'Stripping: Expected %d symbols, got %d' % (n_expected, n)
38
37
      test.fail_test()
39
38
 
 
39
  # Starting with Xcode 5.0, clang adds an additional symbols to the compiled
 
40
  # file when using a relative path to the input file. So when using ninja
 
41
  # with Xcode 5.0 or higher, take this additional symbol into consideration
 
42
  # for unstripped builds (it is stripped by all strip commands).
 
43
  expected_extra_symbol_count = 0
 
44
  if test.format in ['ninja', 'xcode-ninja'] \
 
45
      and TestMac.Xcode.Version() >= '0500':
 
46
    expected_extra_symbol_count = 1
 
47
 
40
48
  # The actual numbers here are not interesting, they just need to be the same
41
49
  # in both the xcode and the make build.
42
 
  CheckNsyms(OutPath('no_postprocess'), 10)
43
 
  CheckNsyms(OutPath('no_strip'), 10)
 
50
  CheckNsyms(OutPath('no_postprocess'), 29 + expected_extra_symbol_count)
 
51
  CheckNsyms(OutPath('no_strip'), 29 + expected_extra_symbol_count)
44
52
  CheckNsyms(OutPath('strip_all'), 0)
45
 
  CheckNsyms(OutPath('strip_nonglobal'), 2)
46
 
  CheckNsyms(OutPath('strip_debugging'), 2)
 
53
  CheckNsyms(OutPath('strip_nonglobal'), 6)
 
54
  CheckNsyms(OutPath('strip_debugging'), 7)
47
55
  CheckNsyms(OutPath('strip_all_custom_flags'), 0)
48
56
  CheckNsyms(test.built_file_path(
49
57
      'strip_all_bundle.framework/Versions/A/strip_all_bundle', chdir='strip'),
50
58
      0)
51
 
  CheckNsyms(OutPath('strip_save'), 2)
 
59
  CheckNsyms(OutPath('strip_save'), 7)
52
60
 
53
61
  test.pass_test()