gyptest-app-ios.py 2.2 KB

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