Fri, 16 Jan 2015 18:13:44 +0100
Integrate suggestion from review to improve consistency with existing code.
michael@0 | 1 | #!/usr/bin/env python |
michael@0 | 2 | |
michael@0 | 3 | # Copyright (c) 2012 Google Inc. All rights reserved. |
michael@0 | 4 | # Use of this source code is governed by a BSD-style license that can be |
michael@0 | 5 | # found in the LICENSE file. |
michael@0 | 6 | |
michael@0 | 7 | """ |
michael@0 | 8 | Verifies building a project hierarchy created when the --generator-output= |
michael@0 | 9 | option is used to put the build configuration files in a separate |
michael@0 | 10 | directory tree. |
michael@0 | 11 | """ |
michael@0 | 12 | |
michael@0 | 13 | import TestGyp |
michael@0 | 14 | |
michael@0 | 15 | # Ninja and Android don't support --generator-output. |
michael@0 | 16 | test = TestGyp.TestGyp(formats=['!ninja', '!android']) |
michael@0 | 17 | |
michael@0 | 18 | test.writable(test.workpath('src'), False) |
michael@0 | 19 | |
michael@0 | 20 | test.run_gyp('prog1.gyp', |
michael@0 | 21 | '-Dset_symroot=1', |
michael@0 | 22 | '--generator-output=' + test.workpath('gypfiles'), |
michael@0 | 23 | chdir='src') |
michael@0 | 24 | |
michael@0 | 25 | test.writable(test.workpath('src/build'), True) |
michael@0 | 26 | test.writable(test.workpath('src/subdir2/build'), True) |
michael@0 | 27 | test.writable(test.workpath('src/subdir3/build'), True) |
michael@0 | 28 | |
michael@0 | 29 | test.build('prog1.gyp', test.ALL, chdir='gypfiles') |
michael@0 | 30 | |
michael@0 | 31 | chdir = 'gypfiles' |
michael@0 | 32 | |
michael@0 | 33 | expect = """\ |
michael@0 | 34 | Hello from %s |
michael@0 | 35 | Hello from inc.h |
michael@0 | 36 | Hello from inc1/include1.h |
michael@0 | 37 | Hello from inc2/include2.h |
michael@0 | 38 | Hello from inc3/include3.h |
michael@0 | 39 | Hello from subdir2/deeper/deeper.h |
michael@0 | 40 | """ |
michael@0 | 41 | |
michael@0 | 42 | if test.format == 'xcode': |
michael@0 | 43 | chdir = 'src' |
michael@0 | 44 | test.run_built_executable('prog1', chdir=chdir, stdout=expect % 'prog1.c') |
michael@0 | 45 | |
michael@0 | 46 | if test.format == 'xcode': |
michael@0 | 47 | chdir = 'src/subdir2' |
michael@0 | 48 | test.run_built_executable('prog2', chdir=chdir, stdout=expect % 'prog2.c') |
michael@0 | 49 | |
michael@0 | 50 | if test.format == 'xcode': |
michael@0 | 51 | chdir = 'src/subdir3' |
michael@0 | 52 | test.run_built_executable('prog3', chdir=chdir, stdout=expect % 'prog3.c') |
michael@0 | 53 | |
michael@0 | 54 | test.pass_test() |