| 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) 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 Verifies two actions can be attached to the same input files. | 8 Verifies two actions can be attached to the same input files. |
| 9 """ | 9 """ |
| 10 | 10 |
| 11 import sys |
| 12 |
| 11 import TestGyp | 13 import TestGyp |
| 12 | 14 |
| 13 test = TestGyp.TestGyp() | 15 test = TestGyp.TestGyp() |
| 14 | 16 |
| 15 test.run_gyp('actions.gyp', chdir='src') | 17 test.run_gyp('actions.gyp', chdir='src') |
| 16 | 18 |
| 17 test.relocate('src', 'relocate/src') | 19 test.relocate('src', 'relocate/src') |
| 18 | 20 |
| 21 # Test of fine-grained dependencies for generators that can build individual |
| 22 # files on demand. |
| 23 # In particular: |
| 24 # - TargetA depends on TargetB. |
| 25 # - TargetA and TargetB are 'none' type with actions attached. |
| 26 # - TargetA has multiple actions. |
| 27 # - An output from one of the actions in TargetA (not the first listed), |
| 28 # is requested as the build target. |
| 29 # Ensure that TargetB gets built. |
| 30 # |
| 31 # This sub-test can only be done with generators/build tools that can |
| 32 # be asked to build individual files rather than whole targets (make, ninja). |
| 33 if test.format in ['make', 'ninja']: |
| 34 # Select location of target based on generator. |
| 35 if test.format == 'make': |
| 36 target = 'multi2.txt' |
| 37 elif test.format == 'ninja': |
| 38 if sys.platform in ['win32', 'cygwin']: |
| 39 target = '..\\..\\multi2.txt' |
| 40 else: |
| 41 target = '../../multi2.txt' |
| 42 else: |
| 43 assert False |
| 44 test.build('actions.gyp', chdir='relocate/src', target=target) |
| 45 test.must_contain('relocate/src/multi2.txt', 'hello there') |
| 46 test.must_contain('relocate/src/multi_dep.txt', 'hello there') |
| 47 |
| 48 |
| 19 # Test that two actions can be attached to the same inputs. | 49 # Test that two actions can be attached to the same inputs. |
| 20 test.build('actions.gyp', test.ALL, chdir='relocate/src') | 50 test.build('actions.gyp', test.ALL, chdir='relocate/src') |
| 21 test.must_contain('relocate/src/output1.txt', 'hello there') | 51 test.must_contain('relocate/src/output1.txt', 'hello there') |
| 22 test.must_contain('relocate/src/output2.txt', 'hello there') | 52 test.must_contain('relocate/src/output2.txt', 'hello there') |
| 23 test.must_contain('relocate/src/output3.txt', 'hello there') | 53 test.must_contain('relocate/src/output3.txt', 'hello there') |
| 24 test.must_contain('relocate/src/output4.txt', 'hello there') | 54 test.must_contain('relocate/src/output4.txt', 'hello there') |
| 25 | 55 |
| 26 # Test that process_outputs_as_sources works in conjuction with merged | 56 # Test that process_outputs_as_sources works in conjuction with merged |
| 27 # actions. | 57 # actions. |
| 28 test.run_built_executable( | 58 test.run_built_executable( |
| 29 'multiple_action_source_filter', | 59 'multiple_action_source_filter', |
| 30 chdir='relocate/src', | 60 chdir='relocate/src', |
| 31 stdout=( | 61 stdout=( |
| 32 '{\n' | 62 '{\n' |
| 33 'bar\n' | 63 'bar\n' |
| 34 'car\n' | 64 'car\n' |
| 35 'dar\n' | 65 'dar\n' |
| 36 'ear\n' | 66 'ear\n' |
| 37 '}\n' | 67 '}\n' |
| 38 ), | 68 ), |
| 39 ) | 69 ) |
| 40 | 70 |
| 41 | 71 |
| 42 test.pass_test() | 72 test.pass_test() |
| OLD | NEW |