Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame^] | 1 | #!/usr/bin/env python |
| 2 | |
| 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 |
| 5 | # found in the LICENSE file. |
| 6 | |
| 7 | """ |
| 8 | Verifies simple actions when using an explicit build target of 'all'. |
| 9 | """ |
| 10 | |
| 11 | import TestGyp |
| 12 | |
| 13 | test = TestGyp.TestGyp() |
| 14 | |
| 15 | test.run_gyp('all.gyp', |
| 16 | '-G', 'xcode_ninja_target_pattern=^all_targets$', |
| 17 | chdir='src') |
| 18 | |
| 19 | test.relocate('src', 'relocate/src') |
| 20 | |
| 21 | # Build all. |
| 22 | test.build('all.gyp', chdir='relocate/src') |
| 23 | |
| 24 | if test.format=='xcode': |
| 25 | chdir = 'relocate/src/dir1' |
| 26 | else: |
| 27 | chdir = 'relocate/src' |
| 28 | |
| 29 | # Output is as expected. |
| 30 | file_content = 'Hello from emit.py\n' |
| 31 | test.built_file_must_match('out2.txt', file_content, chdir=chdir) |
| 32 | |
| 33 | test.built_file_must_not_exist('out.txt', chdir='relocate/src') |
| 34 | test.built_file_must_not_exist('foolib1', |
| 35 | type=test.SHARED_LIB, |
| 36 | chdir=chdir) |
| 37 | |
| 38 | # xcode-ninja doesn't generate separate workspaces for sub-gyps by design |
| 39 | if test.format == 'xcode-ninja': |
| 40 | test.pass_test() |
| 41 | |
| 42 | # TODO(mmoss) Make consistent with msvs, with 'dir1' before 'out/Default'? |
| 43 | if test.format in ('make', 'ninja', 'cmake'): |
| 44 | chdir='relocate/src' |
| 45 | else: |
| 46 | chdir='relocate/src/dir1' |
| 47 | |
| 48 | # Build the action explicitly. |
| 49 | test.build('actions.gyp', 'action1_target', chdir=chdir) |
| 50 | |
| 51 | # Check that things got run. |
| 52 | file_content = 'Hello from emit.py\n' |
| 53 | test.built_file_must_exist('out.txt', chdir=chdir) |
| 54 | |
| 55 | # Build the shared library explicitly. |
| 56 | test.build('actions.gyp', 'foolib1', chdir=chdir) |
| 57 | |
| 58 | test.built_file_must_exist('foolib1', |
| 59 | type=test.SHARED_LIB, |
| 60 | chdir=chdir, |
| 61 | subdir='dir1') |
| 62 | |
| 63 | test.pass_test() |