blob: 262dfc30faf11c377072208eb28cec232fdc417d [file] [log] [blame]
Ben Murdoch097c5b22016-05-18 11:27:45 +01001#!/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
14test = TestGyp.TestGyp()
15
16test.writable(test.workpath('copies'), False)
17
18test.run_gyp('copies.gyp',
19 '--generator-output=' + test.workpath('gypfiles'),
20 '-G', 'xcode_ninja_target_pattern=^(?!copies_null)',
21 chdir='copies')
22
23test.writable(test.workpath('copies'), True)
24
25test.relocate('copies', 'relocate/copies')
26test.relocate('gypfiles', 'relocate/gypfiles')
27
28test.writable(test.workpath('relocate/copies'), False)
29
30test.writable(test.workpath('relocate/copies/build'), True)
31test.writable(test.workpath('relocate/copies/copies-out'), True)
32test.writable(test.workpath('relocate/copies/subdir/build'), True)
33test.writable(test.workpath('relocate/copies/subdir/copies-out'), True)
34
35test.build('copies.gyp', test.ALL, chdir='relocate/gypfiles')
36
37test.must_match(['relocate', 'copies', 'copies-out', 'file1'],
38 "file1 contents\n")
39
40if test.format == 'xcode':
41 chdir = 'relocate/copies/build'
42elif test.format in ['make', 'ninja', 'xcode-ninja', 'cmake']:
43 chdir = 'relocate/gypfiles/out'
44else:
45 chdir = 'relocate/gypfiles'
46test.must_match([chdir, 'Default', 'copies-out', 'file2'], "file2 contents\n")
47
48test.must_match(['relocate', 'copies', 'subdir', 'copies-out', 'file3'],
49 "file3 contents\n")
50
51if test.format == 'xcode':
52 chdir = 'relocate/copies/subdir/build'
53elif test.format in ['make', 'ninja', 'xcode-ninja', 'cmake']:
54 chdir = 'relocate/gypfiles/out'
55else:
56 chdir = 'relocate/gypfiles'
57test.must_match([chdir, 'Default', 'copies-out', 'file4'], "file4 contents\n")
58
59test.pass_test()