1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/media/webrtc/trunk/tools/gyp/test/generator-output/gyptest-actions.py Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,58 @@ 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 --generator-output= behavior when using actions. 1.12 +""" 1.13 + 1.14 +import TestGyp 1.15 + 1.16 +# Ninja and Android don't support --generator-output. 1.17 +test = TestGyp.TestGyp(formats=['!ninja', '!android']) 1.18 + 1.19 +# All the generated files should go under 'gypfiles'. The source directory 1.20 +# ('actions') should be untouched. 1.21 +test.writable(test.workpath('actions'), False) 1.22 +test.run_gyp('actions.gyp', 1.23 + '--generator-output=' + test.workpath('gypfiles'), 1.24 + chdir='actions') 1.25 + 1.26 +test.writable(test.workpath('actions'), True) 1.27 + 1.28 +test.relocate('actions', 'relocate/actions') 1.29 +test.relocate('gypfiles', 'relocate/gypfiles') 1.30 + 1.31 +test.writable(test.workpath('relocate/actions'), False) 1.32 + 1.33 +# Some of the action outputs use "pure" relative paths (i.e. without prefixes 1.34 +# like <(INTERMEDIATE_DIR) or <(PROGRAM_DIR)). Even though we are building under 1.35 +# 'gypfiles', such outputs will still be created relative to the original .gyp 1.36 +# sources. Projects probably wouldn't normally do this, since it kind of defeats 1.37 +# the purpose of '--generator-output', but it is supported behaviour. 1.38 +test.writable(test.workpath('relocate/actions/build'), True) 1.39 +test.writable(test.workpath('relocate/actions/subdir1/build'), True) 1.40 +test.writable(test.workpath('relocate/actions/subdir1/actions-out'), True) 1.41 +test.writable(test.workpath('relocate/actions/subdir2/build'), True) 1.42 +test.writable(test.workpath('relocate/actions/subdir2/actions-out'), True) 1.43 + 1.44 +test.build('actions.gyp', test.ALL, chdir='relocate/gypfiles') 1.45 + 1.46 +expect = """\ 1.47 +Hello from program.c 1.48 +Hello from make-prog1.py 1.49 +Hello from make-prog2.py 1.50 +""" 1.51 + 1.52 +if test.format == 'xcode': 1.53 + chdir = 'relocate/actions/subdir1' 1.54 +else: 1.55 + chdir = 'relocate/gypfiles' 1.56 +test.run_built_executable('program', chdir=chdir, stdout=expect) 1.57 + 1.58 +test.must_match('relocate/actions/subdir2/actions-out/file.out', 1.59 + "Hello from make-file.py\n") 1.60 + 1.61 +test.pass_test()