1#!/usr/bin/env python 2 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 5# found in the LICENSE file. 6 7""" 8Verifies that ios app bundles are built correctly. 9""" 10 11import TestGyp 12 13import subprocess 14import sys 15 16def CheckFileXMLPropertyList(file): 17 output = subprocess.check_output(['file', file]) 18 # The double space after XML is intentional. 19 if not 'XML document text' in output: 20 print 'File: Expected XML document text, got %s' % output 21 test.fail_test() 22 23def CheckFileBinaryPropertyList(file): 24 output = subprocess.check_output(['file', file]) 25 if not 'Apple binary property list' in output: 26 print 'File: Expected Apple binary property list, got %s' % output 27 test.fail_test() 28 29if sys.platform == 'darwin': 30 test = TestGyp.TestGyp(formats=['xcode', 'ninja']) 31 32 test.run_gyp('test.gyp', chdir='app-bundle') 33 34 test.build('test.gyp', test.ALL, chdir='app-bundle') 35 36 # Test that the extension is .bundle 37 test.built_file_must_exist('Test App Gyp.app/Test App Gyp', 38 chdir='app-bundle') 39 40 # Info.plist 41 info_plist = test.built_file_path('Test App Gyp.app/Info.plist', 42 chdir='app-bundle') 43 test.built_file_must_exist(info_plist) 44 CheckFileBinaryPropertyList(info_plist) 45 46 # XML Info.plist 47 info_plist = test.built_file_path('Test App Gyp XML.app/Info.plist', 48 chdir='app-bundle') 49 CheckFileXMLPropertyList(info_plist) 50 51 # Resources 52 strings_file = test.built_file_path( 53 'Test App Gyp.app/English.lproj/InfoPlist.strings', 54 chdir='app-bundle') 55 test.built_file_must_exist(strings_file) 56 CheckFileBinaryPropertyList(strings_file) 57 58 extra_plist_file = test.built_file_path( 59 'Test App Gyp.app/English.lproj/LanguageMap.plist', 60 chdir='app-bundle') 61 test.built_file_must_exist(extra_plist_file) 62 CheckFileBinaryPropertyList(extra_plist_file) 63 64 test.built_file_must_exist( 65 'Test App Gyp.app/English.lproj/MainMenu.nib', 66 chdir='app-bundle') 67 test.built_file_must_exist( 68 'Test App Gyp.app/English.lproj/Main_iPhone.storyboardc', 69 chdir='app-bundle') 70 71 # Packaging 72 test.built_file_must_exist('Test App Gyp.app/PkgInfo', 73 chdir='app-bundle') 74 test.built_file_must_match('Test App Gyp.app/PkgInfo', 'APPLause', 75 chdir='app-bundle') 76 77 test.pass_test() 78