Fri, 16 Jan 2015 18:13:44 +0100
Integrate suggestion from review to improve consistency with existing code.
1 #!/usr/bin/env python
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.
7 """
8 Verifies building a project hierarchy created when the --generator-output=
9 option is used to put the build configuration files in a separate
10 directory tree.
11 """
13 import TestGyp
15 # Ninja and Android don't support --generator-output.
16 test = TestGyp.TestGyp(formats=['!ninja', '!android'])
18 test.writable(test.workpath('src'), False)
20 test.run_gyp('prog1.gyp',
21 '-Dset_symroot=1',
22 '--generator-output=' + test.workpath('gypfiles'),
23 chdir='src')
25 test.writable(test.workpath('src/build'), True)
26 test.writable(test.workpath('src/subdir2/build'), True)
27 test.writable(test.workpath('src/subdir3/build'), True)
29 test.build('prog1.gyp', test.ALL, chdir='gypfiles')
31 chdir = 'gypfiles'
33 expect = """\
34 Hello from %s
35 Hello from inc.h
36 Hello from inc1/include1.h
37 Hello from inc2/include2.h
38 Hello from inc3/include3.h
39 Hello from subdir2/deeper/deeper.h
40 """
42 if test.format == 'xcode':
43 chdir = 'src'
44 test.run_built_executable('prog1', chdir=chdir, stdout=expect % 'prog1.c')
46 if test.format == 'xcode':
47 chdir = 'src/subdir2'
48 test.run_built_executable('prog2', chdir=chdir, stdout=expect % 'prog2.c')
50 if test.format == 'xcode':
51 chdir = 'src/subdir3'
52 test.run_built_executable('prog3', chdir=chdir, stdout=expect % 'prog3.c')
54 test.pass_test()