1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/media/webrtc/trunk/tools/gyp/test/generator-output/gyptest-top-all.py Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,54 @@ 1.4 +#!/usr/bin/env python 1.5 + 1.6 +# Copyright (c) 2012 Google Inc. All rights reserved. 1.7 +# Use of this source code is governed by a BSD-style license that can be 1.8 +# found in the LICENSE file. 1.9 + 1.10 +""" 1.11 +Verifies building a project hierarchy created when the --generator-output= 1.12 +option is used to put the build configuration files in a separate 1.13 +directory tree. 1.14 +""" 1.15 + 1.16 +import TestGyp 1.17 + 1.18 +# Ninja and Android don't support --generator-output. 1.19 +test = TestGyp.TestGyp(formats=['!ninja', '!android']) 1.20 + 1.21 +test.writable(test.workpath('src'), False) 1.22 + 1.23 +test.run_gyp('prog1.gyp', 1.24 + '-Dset_symroot=1', 1.25 + '--generator-output=' + test.workpath('gypfiles'), 1.26 + chdir='src') 1.27 + 1.28 +test.writable(test.workpath('src/build'), True) 1.29 +test.writable(test.workpath('src/subdir2/build'), True) 1.30 +test.writable(test.workpath('src/subdir3/build'), True) 1.31 + 1.32 +test.build('prog1.gyp', test.ALL, chdir='gypfiles') 1.33 + 1.34 +chdir = 'gypfiles' 1.35 + 1.36 +expect = """\ 1.37 +Hello from %s 1.38 +Hello from inc.h 1.39 +Hello from inc1/include1.h 1.40 +Hello from inc2/include2.h 1.41 +Hello from inc3/include3.h 1.42 +Hello from subdir2/deeper/deeper.h 1.43 +""" 1.44 + 1.45 +if test.format == 'xcode': 1.46 + chdir = 'src' 1.47 +test.run_built_executable('prog1', chdir=chdir, stdout=expect % 'prog1.c') 1.48 + 1.49 +if test.format == 'xcode': 1.50 + chdir = 'src/subdir2' 1.51 +test.run_built_executable('prog2', chdir=chdir, stdout=expect % 'prog2.c') 1.52 + 1.53 +if test.format == 'xcode': 1.54 + chdir = 'src/subdir3' 1.55 +test.run_built_executable('prog3', chdir=chdir, stdout=expect % 'prog3.c') 1.56 + 1.57 +test.pass_test()