OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 | 2 |
3 # Copyright (c) 2011 Google Inc. All rights reserved. | 3 # Copyright (c) 2011 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 a failing postbuild step lets the build fail. | 8 Verifies that a failing postbuild step lets the build fail. |
9 """ | 9 """ |
10 | 10 |
| 11 from __future__ import print_function |
| 12 |
11 import TestGyp | 13 import TestGyp |
12 | 14 |
13 import sys | 15 import sys |
14 | 16 |
15 if sys.platform == 'darwin': | 17 if sys.platform == 'darwin': |
16 # set |match| to ignore build stderr output. | 18 # set |match| to ignore build stderr output. |
17 test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode'], | 19 test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode'], |
18 match = lambda a, b: True) | 20 match = lambda a, b: True) |
19 | 21 |
20 test.run_gyp('test.gyp', chdir='postbuild-fail') | 22 test.run_gyp('test.gyp', chdir='postbuild-fail') |
(...skipping 11 matching lines...) Expand all Loading... |
32 # still executed. In Xcode 4, postbuilds are stopped after the first | 34 # still executed. In Xcode 4, postbuilds are stopped after the first |
33 # failing postbuild. This test checks for the Xcode 4 behavior. | 35 # failing postbuild. This test checks for the Xcode 4 behavior. |
34 | 36 |
35 # Ignore this test on Xcode 3. | 37 # Ignore this test on Xcode 3. |
36 import subprocess | 38 import subprocess |
37 job = subprocess.Popen(['xcodebuild', '-version'], | 39 job = subprocess.Popen(['xcodebuild', '-version'], |
38 stdout=subprocess.PIPE, | 40 stdout=subprocess.PIPE, |
39 stderr=subprocess.STDOUT) | 41 stderr=subprocess.STDOUT) |
40 out, err = job.communicate() | 42 out, err = job.communicate() |
41 if job.returncode != 0: | 43 if job.returncode != 0: |
42 print out | 44 print(out) |
43 raise Exception('Error %d running xcodebuild' % job.returncode) | 45 raise Exception('Error %d running xcodebuild' % job.returncode) |
44 if out.startswith('Xcode 3.'): | 46 if out.startswith('Xcode 3.'): |
45 test.pass_test() | 47 test.pass_test() |
46 | 48 |
47 # Non-bundles | 49 # Non-bundles |
48 test.build('test.gyp', 'nonbundle', chdir='postbuild-fail', | 50 test.build('test.gyp', 'nonbundle', chdir='postbuild-fail', |
49 status=build_error_code) | 51 status=build_error_code) |
50 test.built_file_must_not_exist('static_touch', | 52 test.built_file_must_not_exist('static_touch', |
51 chdir='postbuild-fail') | 53 chdir='postbuild-fail') |
52 # Check for non-up-to-date-ness by checking if building again produces an | 54 # Check for non-up-to-date-ness by checking if building again produces an |
53 # error. | 55 # error. |
54 test.build('test.gyp', 'nonbundle', chdir='postbuild-fail', | 56 test.build('test.gyp', 'nonbundle', chdir='postbuild-fail', |
55 status=build_error_code) | 57 status=build_error_code) |
56 | 58 |
57 | 59 |
58 # Bundles | 60 # Bundles |
59 test.build('test.gyp', 'bundle', chdir='postbuild-fail', | 61 test.build('test.gyp', 'bundle', chdir='postbuild-fail', |
60 status=build_error_code) | 62 status=build_error_code) |
61 test.built_file_must_not_exist('dynamic_touch', | 63 test.built_file_must_not_exist('dynamic_touch', |
62 chdir='postbuild-fail') | 64 chdir='postbuild-fail') |
63 # Check for non-up-to-date-ness by checking if building again produces an | 65 # Check for non-up-to-date-ness by checking if building again produces an |
64 # error. | 66 # error. |
65 test.build('test.gyp', 'bundle', chdir='postbuild-fail', | 67 test.build('test.gyp', 'bundle', chdir='postbuild-fail', |
66 status=build_error_code) | 68 status=build_error_code) |
67 | 69 |
68 test.pass_test() | 70 test.pass_test() |
OLD | NEW |