OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 | 2 |
3 # Copyright (c) 2009 Google Inc. All rights reserved. | 3 # Copyright (c) 2009 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 building a subsidiary dependent target from a .gyp file in a | 8 Verifies building a subsidiary dependent target from a .gyp file in a |
9 subdirectory, without specifying an explicit output build directory, | 9 subdirectory, without specifying an explicit output build directory, |
10 and using the subdirectory's solution or project file as the entry point. | 10 and using the subdirectory's solution or project file as the entry point. |
11 """ | 11 """ |
12 | 12 |
13 import TestGyp | 13 import TestGyp |
| 14 import errno |
14 | 15 |
15 test = TestGyp.TestGyp() | 16 test = TestGyp.TestGyp() |
16 | 17 |
17 test.run_gyp('prog1.gyp', chdir='src') | 18 test.run_gyp('prog1.gyp', chdir='src') |
18 | 19 |
19 test.relocate('src', 'relocate/src') | 20 test.relocate('src', 'relocate/src') |
20 | 21 |
21 test.build('prog2.gyp', chdir='relocate/src/subdir') | 22 chdir = 'relocate/src/subdir' |
22 | 23 |
23 test.must_not_exist('relocate/src/prog1'+test._exe) | 24 # Make can build sub-projects, but it's still through the top-level Makefile, |
| 25 # and there is no 'default' or 'all' sub-project, so the target must be |
| 26 # explicit. |
| 27 # TODO(mmoss) Should make create self-contained, sub-project Makefiles, |
| 28 # equilvalent to the sub-project .sln/SConstruct/etc. files of other generators? |
| 29 if test.format == 'make': |
| 30 chdir = 'relocate/src' |
| 31 test.build('prog2.gyp', 'prog2', chdir=chdir) |
| 32 else: |
| 33 test.build('prog2.gyp', chdir=chdir) |
| 34 |
| 35 # 'prog1' shouldn't have been built, so it should throw a 'No such file or |
| 36 # directory' exception. If it does exist, running it should fail the stdout |
| 37 # match. This is clunky, but it's arguably less fragile than looking for the |
| 38 # different platform/generator-dependent paths. |
| 39 try: |
| 40 test.run_built_executable('prog1', |
| 41 chdir=chdir, |
| 42 stdout="") |
| 43 except OSError, e: |
| 44 if e.errno != errno.ENOENT: |
| 45 raise e |
24 | 46 |
25 test.run_built_executable('prog2', | 47 test.run_built_executable('prog2', |
26 chdir='relocate/src/subdir', | 48 chdir=chdir, |
27 stdout="Hello from prog2.c\n") | 49 stdout="Hello from prog2.c\n") |
28 | 50 |
29 test.pass_test() | 51 test.pass_test() |
OLD | NEW |