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