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 | import TestGyp |
| 8 | |
| 9 | test = TestGyp.TestGyp() |
| 10 | |
| 11 | # The xcode-ninja generator handles gypfiles which are not at the |
| 12 | # project root incorrectly. |
| 13 | # cf. https://code.google.com/p/gyp/issues/detail?id=460 |
| 14 | if test.format == 'xcode-ninja': |
| 15 | test.skip_test() |
| 16 | |
| 17 | test.run_gyp('build/all.gyp', chdir='src') |
| 18 | |
| 19 | test.relocate('src', 'relocate/src') |
| 20 | |
| 21 | test.build('build/all.gyp', test.ALL, chdir='relocate/src') |
| 22 | |
| 23 | chdir = 'relocate/src/build' |
| 24 | |
| 25 | # The top-level Makefile is in the directory where gyp was run. |
| 26 | # TODO(mmoss) Should the Makefile go in the directory of the passed in .gyp |
| 27 | # file? What about when passing in multiple .gyp files? Would sub-project |
| 28 | # Makefiles (see http://codereview.chromium.org/340008 comments) solve this? |
| 29 | if test.format in ('make', 'ninja', 'cmake'): |
| 30 | chdir = 'relocate/src' |
| 31 | |
| 32 | if test.format == 'xcode': |
| 33 | chdir = 'relocate/src/prog1' |
| 34 | test.run_built_executable('program1', |
| 35 | chdir=chdir, |
| 36 | stdout="Hello from prog1.c\n") |
| 37 | |
| 38 | if test.format == 'xcode': |
| 39 | chdir = 'relocate/src/prog2' |
| 40 | test.run_built_executable('program2', |
| 41 | chdir=chdir, |
| 42 | stdout="Hello from prog2.c\n") |
| 43 | |
| 44 | test.pass_test() |