Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame^] | 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 | """ |
| 8 | Verifies that 'copies' with app bundles are handled correctly. |
| 9 | """ |
| 10 | |
| 11 | import TestGyp |
| 12 | |
| 13 | import os |
| 14 | import sys |
| 15 | import time |
| 16 | |
| 17 | if sys.platform == 'darwin': |
| 18 | print "This test is currently disabled: https://crbug.com/483696." |
| 19 | sys.exit(0) |
| 20 | |
| 21 | test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode']) |
| 22 | |
| 23 | test.run_gyp('framework.gyp', chdir='framework') |
| 24 | |
| 25 | test.build('framework.gyp', 'copy_target', chdir='framework') |
| 26 | |
| 27 | # Check that the copy succeeded. |
| 28 | test.built_file_must_exist( |
| 29 | 'Test Framework.framework/foo/Dependency Bundle.framework', |
| 30 | chdir='framework') |
| 31 | test.built_file_must_exist( |
| 32 | 'Test Framework.framework/foo/Dependency Bundle.framework/Versions/A', |
| 33 | chdir='framework') |
| 34 | test.built_file_must_exist( |
| 35 | 'Test Framework.framework/Versions/A/Libraries/empty.c', |
| 36 | chdir='framework') |
| 37 | |
| 38 | # Verify BUILT_FRAMEWORKS_DIR is set and working. |
| 39 | test.build('framework.gyp', 'copy_embedded', chdir='framework') |
| 40 | |
| 41 | test.built_file_must_exist( |
| 42 | 'Embedded/Test Framework.framework', chdir='framework') |
| 43 | |
| 44 | # Check that rebuilding the target a few times works. |
| 45 | dep_bundle = test.built_file_path('Dependency Bundle.framework', |
| 46 | chdir='framework') |
| 47 | mtime = os.path.getmtime(dep_bundle) |
| 48 | atime = os.path.getatime(dep_bundle) |
| 49 | for i in range(3): |
| 50 | os.utime(dep_bundle, (atime + i * 1000, mtime + i * 1000)) |
| 51 | test.build('framework.gyp', 'copy_target', chdir='framework') |
| 52 | |
| 53 | |
| 54 | # Check that actions ran. |
| 55 | test.built_file_must_exist('action_file', chdir='framework') |
| 56 | |
| 57 | # Test that a copy with the "Code Sign on Copy" flag on succeeds. |
| 58 | test.build('framework.gyp', 'copy_target_code_sign', chdir='framework') |
| 59 | |
| 60 | test.pass_test() |