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

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rwxr-xr-x

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

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 actions.
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 # All the generated files should go under 'gypfiles'. The source directory
michael@0 17 # ('actions') should be untouched.
michael@0 18 test.writable(test.workpath('actions'), False)
michael@0 19 test.run_gyp('actions.gyp',
michael@0 20 '--generator-output=' + test.workpath('gypfiles'),
michael@0 21 chdir='actions')
michael@0 22
michael@0 23 test.writable(test.workpath('actions'), True)
michael@0 24
michael@0 25 test.relocate('actions', 'relocate/actions')
michael@0 26 test.relocate('gypfiles', 'relocate/gypfiles')
michael@0 27
michael@0 28 test.writable(test.workpath('relocate/actions'), False)
michael@0 29
michael@0 30 # Some of the action outputs use "pure" relative paths (i.e. without prefixes
michael@0 31 # like <(INTERMEDIATE_DIR) or <(PROGRAM_DIR)). Even though we are building under
michael@0 32 # 'gypfiles', such outputs will still be created relative to the original .gyp
michael@0 33 # sources. Projects probably wouldn't normally do this, since it kind of defeats
michael@0 34 # the purpose of '--generator-output', but it is supported behaviour.
michael@0 35 test.writable(test.workpath('relocate/actions/build'), True)
michael@0 36 test.writable(test.workpath('relocate/actions/subdir1/build'), True)
michael@0 37 test.writable(test.workpath('relocate/actions/subdir1/actions-out'), True)
michael@0 38 test.writable(test.workpath('relocate/actions/subdir2/build'), True)
michael@0 39 test.writable(test.workpath('relocate/actions/subdir2/actions-out'), True)
michael@0 40
michael@0 41 test.build('actions.gyp', test.ALL, chdir='relocate/gypfiles')
michael@0 42
michael@0 43 expect = """\
michael@0 44 Hello from program.c
michael@0 45 Hello from make-prog1.py
michael@0 46 Hello from make-prog2.py
michael@0 47 """
michael@0 48
michael@0 49 if test.format == 'xcode':
michael@0 50 chdir = 'relocate/actions/subdir1'
michael@0 51 else:
michael@0 52 chdir = 'relocate/gypfiles'
michael@0 53 test.run_built_executable('program', chdir=chdir, stdout=expect)
michael@0 54
michael@0 55 test.must_match('relocate/actions/subdir2/actions-out/file.out',
michael@0 56 "Hello from make-file.py\n")
michael@0 57
michael@0 58 test.pass_test()

mercurial