• 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 file copies with --generator-output using an explicit build
9target of 'all'.
10"""
11
12import TestGyp
13
14# Android doesn't support --generator-output.
15test = TestGyp.TestGyp(formats=['!android'])
16
17test.writable(test.workpath('copies'), False)
18
19test.run_gyp('copies.gyp',
20             '--generator-output=' + test.workpath('gypfiles'),
21             '-G', 'xcode_ninja_target_pattern=^(?!copies_null)',
22             chdir='copies')
23
24test.writable(test.workpath('copies'), True)
25
26test.relocate('copies', 'relocate/copies')
27test.relocate('gypfiles', 'relocate/gypfiles')
28
29test.writable(test.workpath('relocate/copies'), False)
30
31test.writable(test.workpath('relocate/copies/build'), True)
32test.writable(test.workpath('relocate/copies/copies-out'), True)
33test.writable(test.workpath('relocate/copies/subdir/build'), True)
34test.writable(test.workpath('relocate/copies/subdir/copies-out'), True)
35
36test.build('copies.gyp', test.ALL, chdir='relocate/gypfiles')
37
38test.must_match(['relocate', 'copies', 'copies-out', 'file1'],
39                "file1 contents\n")
40
41if test.format == 'xcode':
42  chdir = 'relocate/copies/build'
43elif test.format in ['make', 'ninja', 'xcode-ninja', 'cmake']:
44  chdir = 'relocate/gypfiles/out'
45else:
46  chdir = 'relocate/gypfiles'
47test.must_match([chdir, 'Default', 'copies-out', 'file2'], "file2 contents\n")
48
49test.must_match(['relocate', 'copies', 'subdir', 'copies-out', 'file3'],
50                "file3 contents\n")
51
52if test.format == 'xcode':
53  chdir = 'relocate/copies/subdir/build'
54elif test.format in ['make', 'ninja', 'xcode-ninja', 'cmake']:
55  chdir = 'relocate/gypfiles/out'
56else:
57  chdir = 'relocate/gypfiles'
58test.must_match([chdir, 'Default', 'copies-out', 'file4'], "file4 contents\n")
59
60test.pass_test()
61