OLD | NEW |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 | 2 |
3 # Copyright (c) 2011 Google Inc. All rights reserved. | 3 # Copyright (c) 2011 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 building an object file correctly depends on running actions in | 8 Verify that building an object file correctly depends on running actions in |
9 dependent targets, but not the targets themselves. | 9 dependent targets, but not the targets themselves. |
10 """ | 10 """ |
11 | 11 |
12 import os | |
13 import sys | |
12 import TestGyp | 14 import TestGyp |
13 | 15 |
14 # NOTE(piman): This test will not work with other generators because: | 16 # NOTE(piman): This test will not work with other generators because: |
15 # - it explicitly tests the optimization, which is not implemented (yet?) on | 17 # - it explicitly tests the optimization, which is not implemented (yet?) on |
16 # other generators | 18 # other generators |
17 # - it relies on the exact path to output object files, which is generator | 19 # - it relies on the exact path to output object files, which is generator |
18 # dependent, and actually, relies on the ability to build only that object file, | 20 # dependent, and actually, relies on the ability to build only that object file, |
19 # which I don't think is available on all generators. | 21 # which I don't think is available on all generators. |
20 # TODO(piman): Extend to other generators when possible. | 22 # TODO(piman): Extend to other generators when possible. |
21 test = TestGyp.TestGyp(formats=['ninja']) | 23 test = TestGyp.TestGyp(formats=['ninja']) |
22 | 24 |
23 test.run_gyp('action_dependencies.gyp', chdir='src') | 25 test.run_gyp('action_dependencies.gyp', chdir='src') |
24 | 26 |
25 chdir = 'relocate/src' | 27 chdir = 'relocate/src' |
26 test.relocate('src', chdir) | 28 test.relocate('src', chdir) |
27 | 29 |
28 test.build('action_dependencies.gyp', 'obj/b.b.o', chdir=chdir) | 30 # TODO(cross-compile) |
Evan Martin
2012/02/21 00:55:55
normal argument for TODO is who should do that wor
| |
31 objext = '.obj' if sys.platform == 'win32' else '.o' | |
32 | |
33 test.build('action_dependencies.gyp', | |
34 os.path.join('obj', 'b.b' + objext), | |
35 chdir=chdir) | |
29 | 36 |
30 # The 'a' actions should be run (letting b.c compile), but the a static library | 37 # The 'a' actions should be run (letting b.c compile), but the a static library |
31 # should not be built. | 38 # should not be built. |
32 test.built_file_must_not_exist('a', type=test.STATIC_LIB, chdir=chdir) | 39 test.built_file_must_not_exist('a', type=test.STATIC_LIB, chdir=chdir) |
33 test.built_file_must_not_exist('b', type=test.STATIC_LIB, chdir=chdir) | 40 test.built_file_must_not_exist('b', type=test.STATIC_LIB, chdir=chdir) |
34 test.built_file_must_exist('obj/b.b.o', chdir=chdir) | 41 test.built_file_must_exist(os.path.join('obj', 'b.b' + objext), chdir=chdir) |
35 | 42 |
36 test.build('action_dependencies.gyp', 'obj/c.c.o', chdir=chdir) | 43 test.build('action_dependencies.gyp', |
44 os.path.join('obj', 'c.c' + objext), | |
45 chdir=chdir) | |
37 | 46 |
38 # 'a' and 'b' should be built, so that the 'c' action succeeds, letting c.c | 47 # 'a' and 'b' should be built, so that the 'c' action succeeds, letting c.c |
39 # compile | 48 # compile |
40 test.built_file_must_exist('a', type=test.STATIC_LIB, chdir=chdir) | 49 test.built_file_must_exist('a', type=test.STATIC_LIB, chdir=chdir) |
41 test.built_file_must_exist('b', type=test.EXECUTABLE, chdir=chdir) | 50 test.built_file_must_exist('b', type=test.EXECUTABLE, chdir=chdir) |
42 test.built_file_must_exist('obj/c.c.o', chdir=chdir) | 51 test.built_file_must_exist(os.path.join('obj', 'c.c' + objext), chdir=chdir) |
43 | 52 |
44 | 53 |
45 test.pass_test() | 54 test.pass_test() |
OLD | NEW |