• 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 that a project hierarchy created with the --generator-output=
9option can be built even when it's relocated to a different path.
10"""
11
12import TestGyp
13
14# Android doesn't support --generator-output.
15test = TestGyp.TestGyp(formats=['!android'])
16
17test.writable(test.workpath('src'), False)
18
19test.run_gyp('prog1.gyp',
20             '-Dset_symroot=1',
21             '--generator-output=' + test.workpath('gypfiles'),
22             chdir='src')
23
24test.writable(test.workpath('src'), True)
25
26test.relocate('src', 'relocate/src')
27test.relocate('gypfiles', 'relocate/gypfiles')
28
29test.writable(test.workpath('relocate/src'), False)
30
31test.writable(test.workpath('relocate/src/build'), True)
32test.writable(test.workpath('relocate/src/subdir2/build'), True)
33test.writable(test.workpath('relocate/src/subdir3/build'), True)
34
35test.build('prog1.gyp', test.ALL, chdir='relocate/gypfiles')
36
37chdir = 'relocate/gypfiles'
38
39expect = """\
40Hello from %s
41Hello from inc.h
42Hello from inc1/include1.h
43Hello from inc2/include2.h
44Hello from inc3/include3.h
45Hello from subdir2/deeper/deeper.h
46"""
47
48if test.format == 'xcode':
49  chdir = 'relocate/src'
50test.run_built_executable('prog1', chdir=chdir, stdout=expect % 'prog1.c')
51
52if test.format == 'xcode':
53  chdir = 'relocate/src/subdir2'
54test.run_built_executable('prog2', chdir=chdir, stdout=expect % 'prog2.c')
55
56if test.format == 'xcode':
57  chdir = 'relocate/src/subdir3'
58test.run_built_executable('prog3', chdir=chdir, stdout=expect % 'prog3.c')
59
60test.pass_test()
61