media/webrtc/trunk/tools/gyp/test/generator-output/gyptest-rules.py

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rwxr-xr-x

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 #!/usr/bin/env python
michael@0 2
michael@0 3 # Copyright (c) 2012 Google Inc. All rights reserved.
michael@0 4 # Use of this source code is governed by a BSD-style license that can be
michael@0 5 # found in the LICENSE file.
michael@0 6
michael@0 7 """
michael@0 8 Verifies --generator-output= behavior when using rules.
michael@0 9 """
michael@0 10
michael@0 11 import TestGyp
michael@0 12
michael@0 13 # Ninja and Android don't support --generator-output.
michael@0 14 test = TestGyp.TestGyp(formats=['!ninja', '!android'])
michael@0 15
michael@0 16 test.writable(test.workpath('rules'), False)
michael@0 17
michael@0 18 test.run_gyp('rules.gyp',
michael@0 19 '--generator-output=' + test.workpath('gypfiles'),
michael@0 20 chdir='rules')
michael@0 21
michael@0 22 test.writable(test.workpath('rules'), True)
michael@0 23
michael@0 24 test.relocate('rules', 'relocate/rules')
michael@0 25 test.relocate('gypfiles', 'relocate/gypfiles')
michael@0 26
michael@0 27 test.writable(test.workpath('relocate/rules'), False)
michael@0 28
michael@0 29 test.writable(test.workpath('relocate/rules/build'), True)
michael@0 30 test.writable(test.workpath('relocate/rules/subdir1/build'), True)
michael@0 31 test.writable(test.workpath('relocate/rules/subdir2/build'), True)
michael@0 32 test.writable(test.workpath('relocate/rules/subdir2/rules-out'), True)
michael@0 33
michael@0 34 test.build('rules.gyp', test.ALL, chdir='relocate/gypfiles')
michael@0 35
michael@0 36 expect = """\
michael@0 37 Hello from program.c
michael@0 38 Hello from function1.in1
michael@0 39 Hello from function2.in1
michael@0 40 Hello from define3.in0
michael@0 41 Hello from define4.in0
michael@0 42 """
michael@0 43
michael@0 44 if test.format == 'xcode':
michael@0 45 chdir = 'relocate/rules/subdir1'
michael@0 46 else:
michael@0 47 chdir = 'relocate/gypfiles'
michael@0 48 test.run_built_executable('program', chdir=chdir, stdout=expect)
michael@0 49
michael@0 50 test.must_match('relocate/rules/subdir2/rules-out/file1.out',
michael@0 51 "Hello from file1.in0\n")
michael@0 52 test.must_match('relocate/rules/subdir2/rules-out/file2.out',
michael@0 53 "Hello from file2.in0\n")
michael@0 54 test.must_match('relocate/rules/subdir2/rules-out/file3.out',
michael@0 55 "Hello from file3.in1\n")
michael@0 56 test.must_match('relocate/rules/subdir2/rules-out/file4.out',
michael@0 57 "Hello from file4.in1\n")
michael@0 58
michael@0 59 test.pass_test()

mercurial