Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 | 2 |
| 3 # Copyright (c) 2012 Google Inc. All rights reserved. | 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 | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 """ | 7 """ |
| 8 Verify that relinking a solib doesn't relink a dependent executable if the | 8 Verify that relinking a solib doesn't relink a dependent executable if the |
| 9 solib's public API hasn't changed. | 9 solib's public API hasn't changed. |
| 10 """ | 10 """ |
| 11 | 11 |
| 12 import os | 12 import os |
| 13 import sys | 13 import sys |
| 14 import TestGyp | 14 import TestGyp |
| 15 | 15 |
| 16 # NOTE(fischman): This test will not work with other generators because the | 16 # NOTE(fischman): This test will not work with other generators because the |
| 17 # API-hash-based-mtime-preservation optimization is only implemented in | 17 # API-hash-based-mtime-preservation optimization is only implemented in |
| 18 # ninja.py. It could be extended to the make.py generator as well pretty | 18 # ninja.py. It could be extended to the make.py generator as well pretty |
| 19 # easily, probably. | 19 # easily, probably. |
| 20 # (also, it tests ninja-specific out paths, which would have to be generalized | 20 # (also, it tests ninja-specific out paths, which would have to be generalized |
| 21 # if this was extended to other generators). | 21 # if this was extended to other generators). |
| 22 test = TestGyp.TestGyp(formats=['ninja']) | 22 test = TestGyp.TestGyp(formats=['ninja']) |
| 23 | 23 |
| 24 # The optimization being tested for is only implemented on linux. | 24 # The optimization being tested for is only implemented on linux and mac. |
| 25 if sys.platform in ['win32', 'cygwin', 'darwin']: | 25 # XXX does win do this implicitly? ask scott |
|
Ami GONE FROM CHROMIUM
2012/06/30 22:37:04
I'm pretty sure the test failed on a gyp win bot b
| |
| 26 if sys.platform in ['win32', 'cygwin']: | |
| 26 test.pass_test() | 27 test.pass_test() |
| 27 sys.exit(0) | 28 sys.exit(0) |
| 28 | 29 |
| 29 test.run_gyp('solibs_avoid_relinking.gyp') | 30 test.run_gyp('solibs_avoid_relinking.gyp') |
| 30 | 31 |
| 31 # Build the executable, grab its timestamp, touch the solib's source, rebuild | 32 # Build the executable, grab its timestamp, touch the solib's source, rebuild |
| 32 # executable, ensure timestamp hasn't changed. | 33 # executable, ensure timestamp hasn't changed. |
| 33 test.build('solibs_avoid_relinking.gyp', 'b') | 34 test.build('solibs_avoid_relinking.gyp', 'b') |
| 34 test.built_file_must_exist('b') | 35 test.built_file_must_exist('b') |
| 35 pre_stat = os.stat(test.built_file_path('b')) | 36 pre_stat = os.stat(test.built_file_path('b')) |
| 36 os.utime(os.path.join(test.workdir, 'solib.cc'), | 37 os.utime(os.path.join(test.workdir, 'solib.cc'), |
| 37 (pre_stat.st_atime, pre_stat.st_mtime + 100)) | 38 (pre_stat.st_atime, pre_stat.st_mtime + 100)) |
| 38 test.sleep() | 39 test.sleep() |
| 39 test.build('solibs_avoid_relinking.gyp', 'b') | 40 test.build('solibs_avoid_relinking.gyp', 'b') |
| 40 post_stat = os.stat(test.built_file_path('b')) | 41 post_stat = os.stat(test.built_file_path('b')) |
| 41 | 42 |
| 42 if pre_stat.st_mtime != post_stat.st_mtime: | 43 if pre_stat.st_mtime != post_stat.st_mtime: |
| 43 test.fail_test() | 44 test.fail_test() |
| 44 else: | 45 else: |
| 45 test.pass_test() | 46 test.pass_test() |
| OLD | NEW |