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

« back to all changes in this revision

Viewing changes to test/mac/gyptest-app.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 os
 
15
import plistlib
 
16
import subprocess
14
17
import sys
15
18
 
16
19
 
 
20
if sys.platform in ('darwin', 'win32'):
 
21
  print "This test is currently disabled: https://crbug.com/483696."
 
22
  sys.exit(0)
 
23
 
 
24
 
 
25
def CheckFileXMLPropertyList(file):
 
26
  output = subprocess.check_output(['file', file])
 
27
  # The double space after XML is intentional.
 
28
  if not 'XML  document text' in output:
 
29
    print 'File: Expected XML  document text, got %s' % output
 
30
    test.fail_test()
 
31
 
 
32
def ExpectEq(expected, actual):
 
33
  if expected != actual:
 
34
    print >>sys.stderr, 'Expected "%s", got "%s"' % (expected, actual)
 
35
    test.fail_test()
 
36
 
17
37
def ls(path):
18
38
  '''Returns a list of all files in a directory, relative to the directory.'''
19
39
  result = []
38
58
  info_plist = test.built_file_path('Test App Gyp.app/Contents/Info.plist',
39
59
                                    chdir='app-bundle')
40
60
  test.must_exist(info_plist)
41
 
  test.must_contain(info_plist, 'com.google.Test App Gyp')  # Variable expansion
 
61
  test.must_contain(info_plist, 'com.google.Test-App-Gyp')  # Variable expansion
42
62
  test.must_not_contain(info_plist, '${MACOSX_DEPLOYMENT_TARGET}');
 
63
  CheckFileXMLPropertyList(info_plist)
 
64
 
 
65
  if test.format != 'make':
 
66
    # TODO: Synthesized plist entries aren't hooked up in the make generator.
 
67
    machine = subprocess.check_output(['sw_vers', '-buildVersion']).rstrip('\n')
 
68
    plist = plistlib.readPlist(info_plist)
 
69
    ExpectEq(machine, plist['BuildMachineOSBuild'])
 
70
 
 
71
    # Prior to Xcode 5.0.0, SDKROOT (and thus DTSDKName) was only defined if
 
72
    # set in the Xcode project file. Starting with that version, it is always
 
73
    # defined.
 
74
    expected = ''
 
75
    if TestMac.Xcode.Version() >= '0500':
 
76
      version = TestMac.Xcode.SDKVersion()
 
77
      expected = 'macosx' + version
 
78
    ExpectEq(expected, plist['DTSDKName'])
 
79
    sdkbuild = TestMac.Xcode.SDKBuild()
 
80
    if not sdkbuild:
 
81
      # Above command doesn't work in Xcode 4.2.
 
82
      sdkbuild = plist['BuildMachineOSBuild']
 
83
    ExpectEq(sdkbuild, plist['DTSDKBuild'])
 
84
    ExpectEq(TestMac.Xcode.Version(), plist['DTXcode'])
 
85
    ExpectEq(TestMac.Xcode.Build(), plist['DTXcodeBuild'])
43
86
 
44
87
  # Resources
45
88
  strings_files = ['InfoPlist.strings', 'utf-16be.strings', 'utf-16le.strings']