OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 | 2 |
3 # Copyright (c) 2012 Google Inc. All rights reserved. | 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 | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 """ | 7 """ |
8 Verifies file copies with --generator-output using an explicit build | 8 Verifies file copies with --generator-output using an explicit build |
9 target of 'all'. | 9 target of 'all'. |
10 """ | 10 """ |
11 | 11 |
12 import TestGyp | 12 import TestGyp |
13 | 13 |
14 # Android doesn't support --generator-output. | 14 # Android doesn't support --generator-output. |
15 # Ninja doesn't support relocation. | 15 test = TestGyp.TestGyp(formats=['!android']) |
16 test = TestGyp.TestGyp(formats=['!ninja', '!android']) | |
17 | 16 |
18 test.writable(test.workpath('copies'), False) | 17 test.writable(test.workpath('copies'), False) |
19 | 18 |
20 test.run_gyp('copies.gyp', | 19 test.run_gyp('copies.gyp', |
21 '--generator-output=' + test.workpath('gypfiles'), | 20 '--generator-output=' + test.workpath('gypfiles'), |
22 chdir='copies') | 21 chdir='copies') |
23 | 22 |
24 test.writable(test.workpath('copies'), True) | 23 test.writable(test.workpath('copies'), True) |
25 | 24 |
26 test.relocate('copies', 'relocate/copies') | 25 test.relocate('copies', 'relocate/copies') |
27 test.relocate('gypfiles', 'relocate/gypfiles') | 26 test.relocate('gypfiles', 'relocate/gypfiles') |
28 | 27 |
29 test.writable(test.workpath('relocate/copies'), False) | 28 test.writable(test.workpath('relocate/copies'), False) |
30 | 29 |
31 test.writable(test.workpath('relocate/copies/build'), True) | 30 test.writable(test.workpath('relocate/copies/build'), True) |
32 test.writable(test.workpath('relocate/copies/copies-out'), True) | 31 test.writable(test.workpath('relocate/copies/copies-out'), True) |
33 test.writable(test.workpath('relocate/copies/subdir/build'), True) | 32 test.writable(test.workpath('relocate/copies/subdir/build'), True) |
34 test.writable(test.workpath('relocate/copies/subdir/copies-out'), True) | 33 test.writable(test.workpath('relocate/copies/subdir/copies-out'), True) |
35 | 34 |
36 test.build('copies.gyp', test.ALL, chdir='relocate/gypfiles') | 35 test.build('copies.gyp', test.ALL, chdir='relocate/gypfiles') |
37 | 36 |
38 test.must_match(['relocate', 'copies', 'copies-out', 'file1'], | 37 test.must_match(['relocate', 'copies', 'copies-out', 'file1'], |
39 "file1 contents\n") | 38 "file1 contents\n") |
40 | 39 |
41 if test.format == 'xcode': | 40 if test.format == 'xcode': |
42 chdir = 'relocate/copies/build' | 41 chdir = 'relocate/copies/build' |
43 elif test.format == 'make': | 42 elif test.format in ['make', 'ninja', 'cmake']: |
44 chdir = 'relocate/gypfiles/out' | 43 chdir = 'relocate/gypfiles/out' |
45 else: | 44 else: |
46 chdir = 'relocate/gypfiles' | 45 chdir = 'relocate/gypfiles' |
47 test.must_match([chdir, 'Default', 'copies-out', 'file2'], "file2 contents\n") | 46 test.must_match([chdir, 'Default', 'copies-out', 'file2'], "file2 contents\n") |
48 | 47 |
49 test.must_match(['relocate', 'copies', 'subdir', 'copies-out', 'file3'], | 48 test.must_match(['relocate', 'copies', 'subdir', 'copies-out', 'file3'], |
50 "file3 contents\n") | 49 "file3 contents\n") |
51 | 50 |
52 if test.format == 'xcode': | 51 if test.format == 'xcode': |
53 chdir = 'relocate/copies/subdir/build' | 52 chdir = 'relocate/copies/subdir/build' |
54 elif test.format == 'make': | 53 elif test.format in ['make', 'ninja', 'cmake']: |
55 chdir = 'relocate/gypfiles/out' | 54 chdir = 'relocate/gypfiles/out' |
56 else: | 55 else: |
57 chdir = 'relocate/gypfiles' | 56 chdir = 'relocate/gypfiles' |
58 test.must_match([chdir, 'Default', 'copies-out', 'file4'], "file4 contents\n") | 57 test.must_match([chdir, 'Default', 'copies-out', 'file4'], "file4 contents\n") |
59 | 58 |
60 test.pass_test() | 59 test.pass_test() |
OLD | NEW |