| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 | 2 |
| 3 # Copyright (c) 2009 Google Inc. All rights reserved. | 3 # Copyright (c) 2009 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 Verifies simple actions when using an explicit build target of 'all'. | 8 Verifies simple actions when using an explicit build target of 'all'. |
| 9 """ | 9 """ |
| 10 | 10 |
| 11 import glob | 11 import glob |
| 12 import os | 12 import os |
| 13 import TestGyp | 13 import TestGyp |
| 14 | 14 |
| 15 test = TestGyp.TestGyp(workdir='workarea_all') | 15 test = TestGyp.TestGyp(workdir='workarea_all') |
| 16 | 16 |
| 17 test.run_gyp('actions.gyp', chdir='src') | 17 test.run_gyp('actions.gyp', chdir='src') |
| 18 | 18 |
| 19 test.relocate('src', 'relocate/src') | 19 test.relocate('src', 'relocate/src') |
| 20 | 20 |
| 21 # Test that an "always run" action increases a counter on multiple invocations, | 21 # Some gyp files use an action that mentions an output but never writes it |
| 22 # and that a dependent action updates in step. | 22 # as a means to making something run on every build. That makes some pretty |
| 23 test.build('actions.gyp', test.ALL, chdir='relocate/src') | 23 # far-reaching assumptions about how build systems work and doesn't work with |
| 24 test.must_match('relocate/src/subdir1/actions-out/action-counter.txt', '1') | 24 # ninja. TODO(evan): figure out how to work always-run actions in to ninja. |
| 25 test.must_match('relocate/src/subdir1/actions-out/action-counter_2.txt', '1') | 25 if test.format == 'ninja': |
| 26 test.build('actions.gyp', test.ALL, chdir='relocate/src') | 26 test.build('actions.gyp', test.ALL, chdir='relocate/src') |
| 27 test.must_match('relocate/src/subdir1/actions-out/action-counter.txt', '2') | 27 else: |
| 28 test.must_match('relocate/src/subdir1/actions-out/action-counter_2.txt', '2') | 28 # Test that an "always run" action increases a counter on multiple invocations
, |
| 29 # and that a dependent action updates in step. |
| 30 test.build('actions.gyp', test.ALL, chdir='relocate/src') |
| 31 test.must_match('relocate/src/subdir1/actions-out/action-counter.txt', '1') |
| 32 test.must_match('relocate/src/subdir1/actions-out/action-counter_2.txt', '1') |
| 33 test.build('actions.gyp', test.ALL, chdir='relocate/src') |
| 34 test.must_match('relocate/src/subdir1/actions-out/action-counter.txt', '2') |
| 35 test.must_match('relocate/src/subdir1/actions-out/action-counter_2.txt', '2') |
| 29 | 36 |
| 30 # The "always run" action only counts to 2, but the dependent target will count | 37 # The "always run" action only counts to 2, but the dependent target will coun
t |
| 31 # forever if it's allowed to run. This verifies that the dependent target only | 38 # forever if it's allowed to run. This verifies that the dependent target only |
| 32 # runs when the "always run" action generates new output, not just because the | 39 # runs when the "always run" action generates new output, not just because the |
| 33 # "always run" ran. | 40 # "always run" ran. |
| 34 test.build('actions.gyp', test.ALL, chdir='relocate/src') | 41 test.build('actions.gyp', test.ALL, chdir='relocate/src') |
| 35 test.must_match('relocate/src/subdir1/actions-out/action-counter.txt', '2') | 42 test.must_match('relocate/src/subdir1/actions-out/action-counter.txt', '2') |
| 36 test.must_match('relocate/src/subdir1/actions-out/action-counter_2.txt', '2') | 43 test.must_match('relocate/src/subdir1/actions-out/action-counter_2.txt', '2') |
| 37 | 44 |
| 38 expect = """\ | 45 expect = """\ |
| 39 Hello from program.c | 46 Hello from program.c |
| 40 Hello from make-prog1.py | 47 Hello from make-prog1.py |
| 41 Hello from make-prog2.py | 48 Hello from make-prog2.py |
| 42 """ | 49 """ |
| 43 | 50 |
| 44 if test.format == 'xcode': | 51 if test.format == 'xcode': |
| 45 chdir = 'relocate/src/subdir1' | 52 chdir = 'relocate/src/subdir1' |
| 46 else: | 53 else: |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 # previous tests deleted. Confirm this execution did NOT run the ALL | 92 # previous tests deleted. Confirm this execution did NOT run the ALL |
| 86 # target which would mess up our dep tests. | 93 # target which would mess up our dep tests. |
| 87 clean_dep_files() | 94 clean_dep_files() |
| 88 test.build('actions.gyp', 'action_with_dependencies_321', chdir='relocate/src', | 95 test.build('actions.gyp', 'action_with_dependencies_321', chdir='relocate/src', |
| 89 arguments=arguments) | 96 arguments=arguments) |
| 90 test.must_exist('relocate/src/deps_all_done_first_321.txt') | 97 test.must_exist('relocate/src/deps_all_done_first_321.txt') |
| 91 test.must_not_exist('relocate/src/deps_all_done_first_123.txt') | 98 test.must_not_exist('relocate/src/deps_all_done_first_123.txt') |
| 92 | 99 |
| 93 | 100 |
| 94 test.pass_test() | 101 test.pass_test() |
| OLD | NEW |