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 | 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 os |
| 15 | import sys |
| 16 | import time |
| 17 | |
| 18 | if sys.platform == 'win32': |
| 19 | test = TestGyp.TestGyp(formats=['msvs', 'ninja']) |
| 20 | |
| 21 | if not os.environ.get('ProgramFiles(x86)'): |
| 22 | # TODO(scottmg) |
| 23 | print 'Skipping test on x86, http://crbug.com/365833' |
| 24 | test.pass_test() |
| 25 | |
| 26 | CHDIR = 'importlib' |
| 27 | test.run_gyp('importlib.gyp', chdir=CHDIR) |
| 28 | test.build('importlib.gyp', test.ALL, chdir=CHDIR) |
| 29 | |
| 30 | # Delay briefly so that there's time for this touch not to have the |
| 31 | # timestamp as the previous run. |
| 32 | test.sleep() |
| 33 | |
| 34 | # Touch the .cc file; the .dll will rebuild, but the import libs timestamp |
| 35 | # won't be updated. |
| 36 | test.touch('importlib/has-exports.cc') |
| 37 | test.build('importlib.gyp', 'test_importlib', chdir=CHDIR) |
| 38 | |
| 39 | # This is the important part. The .dll above will relink and have an updated |
| 40 | # timestamp, however the import .libs timestamp won't be updated. So, we |
| 41 | # have to handle restating inputs in ninja so the final binary doesn't |
| 42 | # continually relink (due to thinking the .lib isn't up to date). |
| 43 | test.up_to_date('importlib.gyp', test.ALL, chdir=CHDIR) |
| 44 | |
| 45 | test.pass_test() |