Chromium Code Reviews| 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', test.ALL, chdir='relocate/src/subdir') | 22 chdir = 'relocate/src/subdir' |
| 23 target = test.ALL | |
| 22 | 24 |
| 23 test.must_not_exist('relocate/src/prog1'+test._exe) | 25 # Make can build sub-projects, but it's still through the top-level Makefile, |
| 26 # and there is no 'default' or 'all' sub-project, so the target must be | |
| 27 # explicit. | |
| 28 # TODO(mmoss) Should make create self-contained, sub-project Makefiles, | |
|
Evan Martin
2009/10/27 19:25:39
s/Should/Should we/
?
Here and in the other file
Michael Moss
2009/10/27 19:38:10
Actually, that's meant to read "Should (the) make
| |
| 29 # equilvalent to the sub-project .sln/SConstruct/etc. files of other generators? | |
| 30 if test.format == 'make': | |
| 31 chdir = 'relocate/src' | |
| 32 target = 'prog2' | |
| 33 | |
| 34 test.build('prog2.gyp', target, chdir=chdir) | |
| 35 | |
| 36 # 'prog1' shouldn't have been built, so it should throw a 'No such file or | |
| 37 # directory' exception. If it does exist, running it should fail the stdout | |
| 38 # match. This is clunky, but it's arguably less fragile than looking for the | |
| 39 # different platform/generator-dependent paths. | |
| 40 try: | |
| 41 test.run_built_executable('prog1', | |
| 42 chdir=chdir, | |
| 43 stdout="") | |
| 44 except OSError, e: | |
| 45 if e.errno != errno.ENOENT: | |
| 46 raise e | |
| 24 | 47 |
| 25 test.run_built_executable('prog2', | 48 test.run_built_executable('prog2', |
| 26 chdir='relocate/src/subdir', | 49 chdir=chdir, |
| 27 stdout="Hello from prog2.c\n") | 50 stdout="Hello from prog2.c\n") |
| 28 | 51 |
| 29 test.pass_test() | 52 test.pass_test() |
| OLD | NEW |