gyptest-sourceless-module.py 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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 bundles that have no 'sources' (pure resource containers) work.
  7. """
  8. import TestGyp
  9. import sys
  10. if sys.platform == 'darwin':
  11. test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode'])
  12. test.run_gyp('test.gyp', chdir='sourceless-module')
  13. # Just needs to build without errors.
  14. test.build('test.gyp', 'empty_bundle', chdir='sourceless-module')
  15. test.built_file_must_not_exist(
  16. 'empty_bundle.bundle', chdir='sourceless-module')
  17. # Needs to build, and contain a resource.
  18. test.build('test.gyp', 'resource_bundle', chdir='sourceless-module')
  19. test.built_file_must_exist(
  20. 'resource_bundle.bundle/Contents/Resources/foo.manifest',
  21. chdir='sourceless-module')
  22. test.built_file_must_not_exist(
  23. 'resource_bundle.bundle/Contents/MacOS/resource_bundle',
  24. chdir='sourceless-module')
  25. # Build an app containing an actionless bundle.
  26. test.build(
  27. 'test.gyp',
  28. 'bundle_dependent_on_resource_bundle_no_actions',
  29. chdir='sourceless-module')
  30. test.built_file_must_exist(
  31. 'bundle_dependent_on_resource_bundle_no_actions.app/Contents/Resources/'
  32. 'mac_resource_bundle_no_actions.bundle/Contents/Resources/empty.txt',
  33. chdir='sourceless-module')
  34. # Needs to build and cause the bundle to be built.
  35. test.build(
  36. 'test.gyp', 'dependent_on_resource_bundle', chdir='sourceless-module')
  37. test.built_file_must_exist(
  38. 'resource_bundle.bundle/Contents/Resources/foo.manifest',
  39. chdir='sourceless-module')
  40. test.built_file_must_not_exist(
  41. 'resource_bundle.bundle/Contents/MacOS/resource_bundle',
  42. chdir='sourceless-module')
  43. # TODO(thakis): shared_libraries that have no sources but depend on static
  44. # libraries currently only work with the ninja generator. This is used by
  45. # chrome/mac's components build.
  46. if test.format == 'ninja':
  47. # Check that an executable depending on a resource framework links fine too.
  48. test.build(
  49. 'test.gyp', 'dependent_on_resource_framework', chdir='sourceless-module')
  50. test.built_file_must_exist(
  51. 'resource_framework.framework/Resources/foo.manifest',
  52. chdir='sourceless-module')
  53. test.built_file_must_exist(
  54. 'resource_framework.framework/resource_framework',
  55. chdir='sourceless-module')
  56. test.pass_test()