michael@0: #!/usr/bin/env python michael@0: michael@0: # Copyright (c) 2012 Google Inc. All rights reserved. michael@0: # Use of this source code is governed by a BSD-style license that can be michael@0: # found in the LICENSE file. michael@0: michael@0: """ michael@0: Verifies building a project hierarchy created when the --generator-output= michael@0: option is used to put the build configuration files in a separate michael@0: directory tree. michael@0: """ michael@0: michael@0: import TestGyp michael@0: michael@0: # Ninja and Android don't support --generator-output. michael@0: test = TestGyp.TestGyp(formats=['!ninja', '!android']) michael@0: michael@0: test.writable(test.workpath('src'), False) michael@0: michael@0: test.run_gyp('prog1.gyp', michael@0: '-Dset_symroot=1', michael@0: '--generator-output=' + test.workpath('gypfiles'), michael@0: chdir='src') michael@0: michael@0: test.writable(test.workpath('src/build'), True) michael@0: test.writable(test.workpath('src/subdir2/build'), True) michael@0: test.writable(test.workpath('src/subdir3/build'), True) michael@0: michael@0: test.build('prog1.gyp', test.ALL, chdir='gypfiles') michael@0: michael@0: chdir = 'gypfiles' michael@0: michael@0: expect = """\ michael@0: Hello from %s michael@0: Hello from inc.h michael@0: Hello from inc1/include1.h michael@0: Hello from inc2/include2.h michael@0: Hello from inc3/include3.h michael@0: Hello from subdir2/deeper/deeper.h michael@0: """ michael@0: michael@0: if test.format == 'xcode': michael@0: chdir = 'src' michael@0: test.run_built_executable('prog1', chdir=chdir, stdout=expect % 'prog1.c') michael@0: michael@0: if test.format == 'xcode': michael@0: chdir = 'src/subdir2' michael@0: test.run_built_executable('prog2', chdir=chdir, stdout=expect % 'prog2.c') michael@0: michael@0: if test.format == 'xcode': michael@0: chdir = 'src/subdir3' michael@0: test.run_built_executable('prog3', chdir=chdir, stdout=expect % 'prog3.c') michael@0: michael@0: test.pass_test()