Fri, 16 Jan 2015 18:13:44 +0100
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 file copies with --generator-output using an explicit build
9 target of 'all'.
10 """
12 import TestGyp
14 # Ninja and Android don't support --generator-output.
15 test = TestGyp.TestGyp(formats=['!ninja', '!android'])
17 test.writable(test.workpath('copies'), False)
19 test.run_gyp('copies.gyp',
20 '--generator-output=' + test.workpath('gypfiles'),
21 chdir='copies')
23 test.writable(test.workpath('copies'), True)
25 test.relocate('copies', 'relocate/copies')
26 test.relocate('gypfiles', 'relocate/gypfiles')
28 test.writable(test.workpath('relocate/copies'), False)
30 test.writable(test.workpath('relocate/copies/build'), True)
31 test.writable(test.workpath('relocate/copies/copies-out'), True)
32 test.writable(test.workpath('relocate/copies/subdir/build'), True)
33 test.writable(test.workpath('relocate/copies/subdir/copies-out'), True)
35 test.build('copies.gyp', test.ALL, chdir='relocate/gypfiles')
37 test.must_match(['relocate', 'copies', 'copies-out', 'file1'],
38 "file1 contents\n")
40 if test.format == 'xcode':
41 chdir = 'relocate/copies/build'
42 elif test.format == 'make':
43 chdir = 'relocate/gypfiles/out'
44 else:
45 chdir = 'relocate/gypfiles'
46 test.must_match([chdir, 'Default', 'copies-out', 'file2'], "file2 contents\n")
48 test.must_match(['relocate', 'copies', 'subdir', 'copies-out', 'file3'],
49 "file3 contents\n")
51 if test.format == 'xcode':
52 chdir = 'relocate/copies/subdir/build'
53 elif test.format == 'make':
54 chdir = 'relocate/gypfiles/out'
55 else:
56 chdir = 'relocate/gypfiles'
57 test.must_match([chdir, 'Default', 'copies-out', 'file4'], "file4 contents\n")
59 test.pass_test()