Home | History | Annotate | Download | only in mac
      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   test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode'])
     19 
     20   test.run_gyp('framework.gyp', chdir='framework')
     21 
     22   test.build('framework.gyp', 'copy_target', chdir='framework')
     23 
     24   # Check that the copy succeeded.
     25   test.built_file_must_exist(
     26       'Test Framework.framework/foo/Dependency Bundle.framework',
     27       chdir='framework')
     28   test.built_file_must_exist(
     29       'Test Framework.framework/foo/Dependency Bundle.framework/Versions/A',
     30       chdir='framework')
     31   test.built_file_must_exist(
     32       'Test Framework.framework/Versions/A/Libraries/empty.c',
     33       chdir='framework')
     34 
     35 
     36   # Check that rebuilding the target a few times works.
     37   dep_bundle = test.built_file_path('Dependency Bundle.framework',
     38                                     chdir='framework')
     39   mtime = os.path.getmtime(dep_bundle)
     40   atime = os.path.getatime(dep_bundle)
     41   for i in range(3):
     42     os.utime(dep_bundle, (atime + i * 1000, mtime + i * 1000))
     43     test.build('framework.gyp', 'copy_target', chdir='framework')
     44 
     45 
     46   # Check that actions ran.
     47   test.built_file_must_exist('action_file', chdir='framework')
     48 
     49   test.pass_test()
     50