gyptest-copies.py 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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 'copies' with app bundles are handled correctly.
  7. """
  8. import TestGyp
  9. import os
  10. import sys
  11. import time
  12. if sys.platform == 'darwin':
  13. test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode'])
  14. test.run_gyp('framework.gyp', chdir='framework')
  15. test.build('framework.gyp', 'copy_target', chdir='framework')
  16. # Check that the copy succeeded.
  17. test.built_file_must_exist(
  18. 'Test Framework.framework/foo/Dependency Bundle.framework',
  19. chdir='framework')
  20. test.built_file_must_exist(
  21. 'Test Framework.framework/foo/Dependency Bundle.framework/Versions/A',
  22. chdir='framework')
  23. test.built_file_must_exist(
  24. 'Test Framework.framework/Versions/A/Libraries/empty.c',
  25. chdir='framework')
  26. # Check that rebuilding the target a few times works.
  27. dep_bundle = test.built_file_path('Dependency Bundle.framework',
  28. chdir='framework')
  29. mtime = os.path.getmtime(dep_bundle)
  30. atime = os.path.getatime(dep_bundle)
  31. for i in range(3):
  32. os.utime(dep_bundle, (atime + i * 1000, mtime + i * 1000))
  33. test.build('framework.gyp', 'copy_target', chdir='framework')
  34. # Check that actions ran.
  35. test.built_file_must_exist('action_file', chdir='framework')
  36. # Test that a copy with the "Code Sign on Copy" flag on succeeds.
  37. test.build('framework.gyp', 'copy_target_code_sign', chdir='framework')
  38. test.pass_test()