Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame^] | 1 | #!/usr/bin/env python |
| 2 | |
| 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 |
| 5 | # found in the LICENSE file. |
| 6 | |
| 7 | """ |
| 8 | Verifies simple rules when using an explicit build target of 'all'. |
| 9 | """ |
| 10 | |
| 11 | import sys |
| 12 | |
| 13 | if sys.platform == 'win32': |
| 14 | print "This test is currently disabled: https://crbug.com/483696." |
| 15 | sys.exit(0) |
| 16 | |
| 17 | |
| 18 | import TestGyp |
| 19 | |
| 20 | test = TestGyp.TestGyp() |
| 21 | |
| 22 | test.run_gyp('no_action_with_rules_fails.gyp', chdir='src/noaction', status=1, |
| 23 | stderr=None) |
| 24 | |
| 25 | test.run_gyp('actions.gyp', |
| 26 | '-G', 'xcode_ninja_target_pattern=^pull_in_all_actions$', |
| 27 | chdir='src') |
| 28 | |
| 29 | test.relocate('src', 'relocate/src') |
| 30 | |
| 31 | test.build('actions.gyp', test.ALL, chdir='relocate/src') |
| 32 | |
| 33 | expect = """\ |
| 34 | Hello from program.c |
| 35 | Hello from function1.in |
| 36 | Hello from function2.in |
| 37 | """ |
| 38 | |
| 39 | if test.format == 'xcode': |
| 40 | chdir = 'relocate/src/subdir1' |
| 41 | else: |
| 42 | chdir = 'relocate/src' |
| 43 | test.run_built_executable('program', chdir=chdir, stdout=expect) |
| 44 | |
| 45 | expect = """\ |
| 46 | Hello from program.c |
| 47 | Hello from function3.in |
| 48 | """ |
| 49 | |
| 50 | if test.format == 'xcode': |
| 51 | chdir = 'relocate/src/subdir3' |
| 52 | else: |
| 53 | chdir = 'relocate/src' |
| 54 | test.run_built_executable('program2', chdir=chdir, stdout=expect) |
| 55 | |
| 56 | test.must_match('relocate/src/subdir2/file1.out', 'Hello from file1.in\n') |
| 57 | test.must_match('relocate/src/subdir2/file2.out', 'Hello from file2.in\n') |
| 58 | |
| 59 | test.must_match('relocate/src/subdir2/file1.out2', 'Hello from file1.in\n') |
| 60 | test.must_match('relocate/src/subdir2/file2.out2', 'Hello from file2.in\n') |
| 61 | |
| 62 | test.must_match('relocate/src/subdir2/file1.out4', 'Hello from file1.in\n') |
| 63 | test.must_match('relocate/src/subdir2/file2.out4', 'Hello from file2.in\n') |
| 64 | test.must_match('relocate/src/subdir2/file1.copy', 'Hello from file1.in\n') |
| 65 | |
| 66 | test.must_match('relocate/src/external/file1.external_rules.out', |
| 67 | 'Hello from file1.in\n') |
| 68 | test.must_match('relocate/src/external/file2.external_rules.out', |
| 69 | 'Hello from file2.in\n') |
| 70 | |
| 71 | expect = """\ |
| 72 | Hello from program.c |
| 73 | Got 41. |
| 74 | """ |
| 75 | |
| 76 | if test.format == 'xcode': |
| 77 | chdir = 'relocate/src/subdir4' |
| 78 | else: |
| 79 | chdir = 'relocate/src' |
| 80 | test.run_built_executable('program4', chdir=chdir, stdout=expect) |
| 81 | |
| 82 | test.pass_test() |