1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/media/webrtc/trunk/tools/gyp/test/generator-output/gyptest-rules.py Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,59 @@ 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 rules. 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 +test.writable(test.workpath('rules'), False) 1.20 + 1.21 +test.run_gyp('rules.gyp', 1.22 + '--generator-output=' + test.workpath('gypfiles'), 1.23 + chdir='rules') 1.24 + 1.25 +test.writable(test.workpath('rules'), True) 1.26 + 1.27 +test.relocate('rules', 'relocate/rules') 1.28 +test.relocate('gypfiles', 'relocate/gypfiles') 1.29 + 1.30 +test.writable(test.workpath('relocate/rules'), False) 1.31 + 1.32 +test.writable(test.workpath('relocate/rules/build'), True) 1.33 +test.writable(test.workpath('relocate/rules/subdir1/build'), True) 1.34 +test.writable(test.workpath('relocate/rules/subdir2/build'), True) 1.35 +test.writable(test.workpath('relocate/rules/subdir2/rules-out'), True) 1.36 + 1.37 +test.build('rules.gyp', test.ALL, chdir='relocate/gypfiles') 1.38 + 1.39 +expect = """\ 1.40 +Hello from program.c 1.41 +Hello from function1.in1 1.42 +Hello from function2.in1 1.43 +Hello from define3.in0 1.44 +Hello from define4.in0 1.45 +""" 1.46 + 1.47 +if test.format == 'xcode': 1.48 + chdir = 'relocate/rules/subdir1' 1.49 +else: 1.50 + chdir = 'relocate/gypfiles' 1.51 +test.run_built_executable('program', chdir=chdir, stdout=expect) 1.52 + 1.53 +test.must_match('relocate/rules/subdir2/rules-out/file1.out', 1.54 + "Hello from file1.in0\n") 1.55 +test.must_match('relocate/rules/subdir2/rules-out/file2.out', 1.56 + "Hello from file2.in0\n") 1.57 +test.must_match('relocate/rules/subdir2/rules-out/file3.out', 1.58 + "Hello from file3.in1\n") 1.59 +test.must_match('relocate/rules/subdir2/rules-out/file4.out', 1.60 + "Hello from file4.in1\n") 1.61 + 1.62 +test.pass_test()