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 that a project hierarchy created with the --generator-output= |
| 9 | option can be built even when it's relocated to a different path. |
| 10 | """ |
| 11 | |
| 12 | import TestGyp |
| 13 | |
| 14 | test = TestGyp.TestGyp() |
| 15 | |
| 16 | test.writable(test.workpath('src'), False) |
| 17 | |
| 18 | test.run_gyp('prog1.gyp', |
| 19 | '-Dset_symroot=1', |
| 20 | '--generator-output=' + test.workpath('gypfiles'), |
| 21 | chdir='src') |
| 22 | |
| 23 | test.writable(test.workpath('src'), True) |
| 24 | |
| 25 | test.relocate('src', 'relocate/src') |
| 26 | test.relocate('gypfiles', 'relocate/gypfiles') |
| 27 | |
| 28 | test.writable(test.workpath('relocate/src'), False) |
| 29 | |
| 30 | test.writable(test.workpath('relocate/src/build'), True) |
| 31 | test.writable(test.workpath('relocate/src/subdir2/build'), True) |
| 32 | test.writable(test.workpath('relocate/src/subdir3/build'), True) |
| 33 | |
| 34 | test.build('prog1.gyp', test.ALL, chdir='relocate/gypfiles') |
| 35 | |
| 36 | chdir = 'relocate/gypfiles' |
| 37 | |
| 38 | expect = """\ |
| 39 | Hello from %s |
| 40 | Hello from inc.h |
| 41 | Hello from inc1/include1.h |
| 42 | Hello from inc2/include2.h |
| 43 | Hello from inc3/include3.h |
| 44 | Hello from subdir2/deeper/deeper.h |
| 45 | """ |
| 46 | |
| 47 | if test.format == 'xcode': |
| 48 | chdir = 'relocate/src' |
| 49 | test.run_built_executable('prog1', chdir=chdir, stdout=expect % 'prog1.c') |
| 50 | |
| 51 | if test.format == 'xcode': |
| 52 | chdir = 'relocate/src/subdir2' |
| 53 | test.run_built_executable('prog2', chdir=chdir, stdout=expect % 'prog2.c') |
| 54 | |
| 55 | if test.format == 'xcode': |
| 56 | chdir = 'relocate/src/subdir3' |
| 57 | test.run_built_executable('prog3', chdir=chdir, stdout=expect % 'prog3.c') |
| 58 | |
| 59 | test.pass_test() |