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 that missing 'sources' files are treated as fatal errors when the | 8 Verifies that missing 'sources' files are treated as fatal errors when the |
9 the generator flag 'msvs_error_on_missing_sources' is set. | 9 the generator flag 'msvs_error_on_missing_sources' is set. |
10 """ | 10 """ |
11 | 11 |
12 import TestGyp | 12 import TestGyp |
13 import os | 13 import os |
| 14 import sys |
14 | 15 |
15 test = TestGyp.TestGyp(formats=['msvs'], workdir='workarea_all') | 16 if sys.platform == 'win32': |
| 17 test = TestGyp.TestGyp(formats=['msvs', 'ninja'], workdir='workarea_all') |
16 | 18 |
17 # With the flag not set | 19 # With the flag not set |
18 test.run_gyp('hello_missing.gyp') | 20 test.run_gyp('hello_missing.gyp') |
19 | 21 |
20 # With the flag explicitly set to 0 | 22 # With the flag explicitly set to 0 |
21 try: | 23 try: |
22 os.environ['GYP_GENERATOR_FLAGS'] = 'msvs_error_on_missing_sources=0' | 24 os.environ['GYP_GENERATOR_FLAGS'] = 'msvs_error_on_missing_sources=0' |
23 test.run_gyp('hello_missing.gyp') | 25 test.run_gyp('hello_missing.gyp') |
24 finally: | 26 finally: |
25 del os.environ['GYP_GENERATOR_FLAGS'] | 27 del os.environ['GYP_GENERATOR_FLAGS'] |
26 | 28 |
27 # With the flag explicitly set to 1 | 29 # With the flag explicitly set to 1 |
28 try: | 30 try: |
29 os.environ['GYP_GENERATOR_FLAGS'] = 'msvs_error_on_missing_sources=1' | 31 os.environ['GYP_GENERATOR_FLAGS'] = 'msvs_error_on_missing_sources=1' |
30 # Test to make sure GYP raises an exception (exit status 1). Since this will | 32 # Test to make sure GYP raises an exception (exit status 1). Since this will |
31 # also print a backtrace, ensure that TestGyp is not checking that stderr is | 33 # also print a backtrace, ensure that TestGyp is not checking that stderr is |
32 # empty by specifying None, which means do not perform any checking. | 34 # empty by specifying None, which means do not perform any checking. |
33 # Instead, stderr is checked below to ensure it contains the expected | 35 # Instead, stderr is checked below to ensure it contains the expected |
34 # output. | 36 # output. |
35 test.run_gyp('hello_missing.gyp', status=1, stderr=None) | 37 test.run_gyp('hello_missing.gyp', status=1, stderr=None) |
36 finally: | 38 finally: |
37 del os.environ['GYP_GENERATOR_FLAGS'] | 39 del os.environ['GYP_GENERATOR_FLAGS'] |
38 test.must_contain_any_line(test.stderr(), | 40 test.must_contain_any_line(test.stderr(), |
39 ["Missing input files:"]) | 41 ["Missing input files:"]) |
40 | 42 |
41 test.pass_test() | 43 test.pass_test() |
OLD | NEW |