Home | History | Annotate | Download | only in win
      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 Make sure we don't cause unnecessary builds due to import libs appearing
      9 to be out of date.
     10 """
     11 
     12 import TestGyp
     13 
     14 import sys
     15 import time
     16 
     17 if sys.platform == 'win32':
     18   test = TestGyp.TestGyp(formats=['msvs', 'ninja'])
     19 
     20   CHDIR = 'importlib'
     21   test.run_gyp('importlib.gyp', chdir=CHDIR)
     22   test.build('importlib.gyp', test.ALL, chdir=CHDIR)
     23 
     24   # Delay briefly so that there's time for this touch not to have the
     25   # timestamp as the previous run.
     26   test.sleep()
     27 
     28   # Touch the .cc file; the .dll will rebuild, but the import libs timestamp
     29   # won't be updated.
     30   test.touch('importlib/has-exports.cc')
     31   test.build('importlib.gyp', 'test_importlib', chdir=CHDIR)
     32 
     33   # This is the important part. The .dll above will relink and have an updated
     34   # timestamp, however the import .libs timestamp won't be updated. So, we
     35   # have to handle restating inputs in ninja so the final binary doesn't
     36   # continually relink (due to thinking the .lib isn't up to date).
     37   test.up_to_date('importlib.gyp', test.ALL, chdir=CHDIR)
     38 
     39   test.pass_test()
     40