• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env python
2
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.
6
7"""
8Verifies --generator-output= behavior when using actions.
9"""
10
11import TestGyp
12
13# Android doesn't support --generator-output.
14test = TestGyp.TestGyp(formats=['!android'])
15
16# All the generated files should go under 'gypfiles'. The source directory
17# ('actions') should be untouched.
18test.writable(test.workpath('actions'), False)
19test.run_gyp('actions.gyp',
20             '--generator-output=' + test.workpath('gypfiles'),
21             '-G', 'xcode_ninja_target_pattern=^pull_in_all_actions$',
22             chdir='actions')
23
24test.writable(test.workpath('actions'), True)
25
26test.relocate('actions', 'relocate/actions')
27test.relocate('gypfiles', 'relocate/gypfiles')
28
29test.writable(test.workpath('relocate/actions'), False)
30
31# Some of the action outputs use "pure" relative paths (i.e. without prefixes
32# like <(INTERMEDIATE_DIR) or <(PROGRAM_DIR)). Even though we are building under
33# 'gypfiles', such outputs will still be created relative to the original .gyp
34# sources. Projects probably wouldn't normally do this, since it kind of defeats
35# the purpose of '--generator-output', but it is supported behaviour.
36test.writable(test.workpath('relocate/actions/build'), True)
37test.writable(test.workpath('relocate/actions/subdir1/build'), True)
38test.writable(test.workpath('relocate/actions/subdir1/actions-out'), True)
39test.writable(test.workpath('relocate/actions/subdir2/build'), True)
40test.writable(test.workpath('relocate/actions/subdir2/actions-out'), True)
41
42test.build('actions.gyp', test.ALL, chdir='relocate/gypfiles')
43
44expect = """\
45Hello from program.c
46Hello from make-prog1.py
47Hello from make-prog2.py
48"""
49
50if test.format == 'xcode':
51  chdir = 'relocate/actions/subdir1'
52else:
53  chdir = 'relocate/gypfiles'
54test.run_built_executable('program', chdir=chdir, stdout=expect)
55
56test.must_match('relocate/actions/subdir2/actions-out/file.out',
57                "Hello from make-file.py\n")
58
59test.pass_test()
60