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

Fri, 16 Jan 2015 18:13:44 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 18:13:44 +0100
branch
TOR_BUG_9701
changeset 14
925c144e1f1f
permissions
-rwxr-xr-x

Integrate suggestion from review to improve consistency with existing code.

     1 #!/usr/bin/env python
     3 # Copyright (c) 2012 Google Inc. All rights reserved.
     4 # Use of this source code is governed by a BSD-style license that can be
     5 # found in the LICENSE file.
     7 """
     8 Verifies --generator-output= behavior when using actions.
     9 """
    11 import TestGyp
    13 # Ninja and Android don't support --generator-output.
    14 test = TestGyp.TestGyp(formats=['!ninja', '!android'])
    16 # All the generated files should go under 'gypfiles'. The source directory
    17 # ('actions') should be untouched.
    18 test.writable(test.workpath('actions'), False)
    19 test.run_gyp('actions.gyp',
    20              '--generator-output=' + test.workpath('gypfiles'),
    21              chdir='actions')
    23 test.writable(test.workpath('actions'), True)
    25 test.relocate('actions', 'relocate/actions')
    26 test.relocate('gypfiles', 'relocate/gypfiles')
    28 test.writable(test.workpath('relocate/actions'), False)
    30 # Some of the action outputs use "pure" relative paths (i.e. without prefixes
    31 # like <(INTERMEDIATE_DIR) or <(PROGRAM_DIR)). Even though we are building under
    32 # 'gypfiles', such outputs will still be created relative to the original .gyp
    33 # sources. Projects probably wouldn't normally do this, since it kind of defeats
    34 # the purpose of '--generator-output', but it is supported behaviour.
    35 test.writable(test.workpath('relocate/actions/build'), True)
    36 test.writable(test.workpath('relocate/actions/subdir1/build'), True)
    37 test.writable(test.workpath('relocate/actions/subdir1/actions-out'), True)
    38 test.writable(test.workpath('relocate/actions/subdir2/build'), True)
    39 test.writable(test.workpath('relocate/actions/subdir2/actions-out'), True)
    41 test.build('actions.gyp', test.ALL, chdir='relocate/gypfiles')
    43 expect = """\
    44 Hello from program.c
    45 Hello from make-prog1.py
    46 Hello from make-prog2.py
    47 """
    49 if test.format == 'xcode':
    50   chdir = 'relocate/actions/subdir1'
    51 else:
    52   chdir = 'relocate/gypfiles'
    53 test.run_built_executable('program', chdir=chdir, stdout=expect)
    55 test.must_match('relocate/actions/subdir2/actions-out/file.out',
    56                 "Hello from make-file.py\n")
    58 test.pass_test()

mercurial