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 build of a static_library with the standalone_static_library flag set. | 8 Verifies build of a static_library with the standalone_static_library flag set. |
9 """ | 9 """ |
10 | 10 |
11 import os | 11 import os |
12 import subprocess | 12 import subprocess |
13 import sys | 13 import sys |
14 import TestGyp | 14 import TestGyp |
15 | 15 |
16 # standalone_static_library currently means two things: a specific output | 16 # standalone_static_library currently means two things: a specific output |
17 # location for the built target and non-thin archive files. The Android gyp | 17 # location for the built target and non-thin archive files. |
18 # generator leaves both decisions to the Android build system, so this test | 18 test = TestGyp.TestGyp() |
19 # doesn't work for that format. | |
20 test = TestGyp.TestGyp(formats=['!android']) | |
21 | 19 |
22 # Verify that types other than static_library cause a failure. | 20 # Verify that types other than static_library cause a failure. |
23 test.run_gyp('invalid.gyp', status=1, stderr=None) | 21 test.run_gyp('invalid.gyp', status=1, stderr=None) |
24 target_str = 'invalid.gyp:bad#target' | 22 target_str = 'invalid.gyp:bad#target' |
25 err = ['gyp: Target %s has type executable but standalone_static_library flag ' | 23 err = ['gyp: Target %s has type executable but standalone_static_library flag ' |
26 'is only valid for static_library type.' % target_str] | 24 'is only valid for static_library type.' % target_str] |
27 test.must_contain_all_lines(test.stderr(), err) | 25 test.must_contain_all_lines(test.stderr(), err) |
28 | 26 |
29 # Build a valid standalone_static_library. | 27 # Build a valid standalone_static_library. |
30 test.run_gyp('mylib.gyp') | 28 test.run_gyp('mylib.gyp') |
(...skipping 12 matching lines...) Expand all Loading... |
43 expect = 'hello from mylib.c\n' | 41 expect = 'hello from mylib.c\n' |
44 test.run_built_executable('prog', stdout=expect) | 42 test.run_built_executable('prog', stdout=expect) |
45 | 43 |
46 # Verify that libmylib.a contains symbols. "ar -x" fails on a 'thin' archive. | 44 # Verify that libmylib.a contains symbols. "ar -x" fails on a 'thin' archive. |
47 supports_thick = ('make', 'ninja', 'cmake') | 45 supports_thick = ('make', 'ninja', 'cmake') |
48 if test.format in supports_thick and sys.platform.startswith('linux'): | 46 if test.format in supports_thick and sys.platform.startswith('linux'): |
49 retcode = subprocess.call(['ar', '-x', path]) | 47 retcode = subprocess.call(['ar', '-x', path]) |
50 assert retcode == 0 | 48 assert retcode == 0 |
51 | 49 |
52 test.pass_test() | 50 test.pass_test() |
OLD | NEW |