OLD | NEW |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 | 2 |
3 # Copyright (c) 2012 Google Inc. All rights reserved. | 3 # Copyright (c) 2012 Google Inc. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 """ | 7 """ |
8 Verifies that ios app bundles are built correctly. | 8 Verifies that ios app bundles are built correctly. |
9 """ | 9 """ |
10 | 10 |
11 import TestGyp | 11 import TestGyp |
12 | 12 |
13 import subprocess | |
13 import sys | 14 import sys |
14 | 15 |
16 def CheckFileBinaryPropertyList(file): | |
17 proc = subprocess.Popen(['file', file], stdout=subprocess.PIPE) | |
sdefresne
2014/12/22 20:42:03
nit: you can use subprocess.check_output() instead
justincohen
2015/03/06 19:28:03
Done.
| |
18 o = proc.communicate()[0].strip() | |
19 assert not proc.returncode | |
20 if not 'Apple binary property list' in o: | |
21 print 'File: Expected Apple binary property list, got %s' % o | |
22 test.fail_test() | |
23 | |
15 if sys.platform == 'darwin': | 24 if sys.platform == 'darwin': |
16 test = TestGyp.TestGyp(formats=['xcode', 'ninja']) | 25 test = TestGyp.TestGyp(formats=['xcode', 'ninja']) |
17 | 26 |
18 test.run_gyp('test.gyp', chdir='app-bundle') | 27 test.run_gyp('test.gyp', chdir='app-bundle') |
19 | 28 |
20 test.build('test.gyp', test.ALL, chdir='app-bundle') | 29 test.build('test.gyp', test.ALL, chdir='app-bundle') |
21 | 30 |
22 # Test that the extension is .bundle | 31 # Test that the extension is .bundle |
23 test.built_file_must_exist('Test App Gyp.app/Test App Gyp', | 32 test.built_file_must_exist('Test App Gyp.app/Test App Gyp', |
24 chdir='app-bundle') | 33 chdir='app-bundle') |
25 | 34 |
26 # Info.plist | 35 # Info.plist |
27 info_plist = test.built_file_path('Test App Gyp.app/Info.plist', | 36 info_plist = test.built_file_path('Test App Gyp.app/Info.plist', |
28 chdir='app-bundle') | 37 chdir='app-bundle') |
38 test.built_file_must_exist(info_plist) | |
39 CheckFileBinaryPropertyList(info_plist) | |
40 | |
29 # Resources | 41 # Resources |
30 test.built_file_must_exist( | 42 strings_file = test.built_file_path( |
31 'Test App Gyp.app/English.lproj/InfoPlist.strings', | 43 'Test App Gyp.app/English.lproj/InfoPlist.strings', |
32 chdir='app-bundle') | 44 chdir='app-bundle') |
45 test.built_file_must_exist(strings_file) | |
46 CheckFileBinaryPropertyList(strings_file) | |
47 | |
33 test.built_file_must_exist( | 48 test.built_file_must_exist( |
34 'Test App Gyp.app/English.lproj/MainMenu.nib', | 49 'Test App Gyp.app/English.lproj/MainMenu.nib', |
35 chdir='app-bundle') | 50 chdir='app-bundle') |
36 test.built_file_must_exist( | 51 test.built_file_must_exist( |
37 'Test App Gyp.app/English.lproj/Main_iPhone.storyboardc', | 52 'Test App Gyp.app/English.lproj/Main_iPhone.storyboardc', |
38 chdir='app-bundle') | 53 chdir='app-bundle') |
39 | 54 |
40 # Packaging | 55 # Packaging |
41 test.built_file_must_exist('Test App Gyp.app/PkgInfo', | 56 test.built_file_must_exist('Test App Gyp.app/PkgInfo', |
42 chdir='app-bundle') | 57 chdir='app-bundle') |
43 test.built_file_must_match('Test App Gyp.app/PkgInfo', 'APPLause', | 58 test.built_file_must_match('Test App Gyp.app/PkgInfo', 'APPLause', |
44 chdir='app-bundle') | 59 chdir='app-bundle') |
45 | 60 |
46 test.pass_test() | 61 test.pass_test() |
OLD | NEW |