| 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 test = TestGyp.TestGyp() | 16 test = TestGyp.TestGyp() |
| 17 | 17 |
| 18 test.run_gyp('mylib.gyp') | 18 test.run_gyp('mylib.gyp') |
| 19 test.build('mylib.gyp', target='prog') | 19 test.build('mylib.gyp', target='prog') |
| 20 | 20 |
| 21 # Verify that the static library is copied to PRODUCT_DIR | 21 # Verify that the static library is copied to PRODUCT_DIR. |
| 22 built_lib = test.built_file_basename('mylib', type=test.STATIC_LIB) | 22 built_lib = test.built_file_basename('mylib', type=test.STATIC_LIB) |
| 23 path = test.built_file_path(built_lib) | 23 path = test.built_file_path(built_lib) |
| 24 test.must_exist(path) | 24 test.must_exist(path) |
| 25 | 25 |
| 26 # Verify that the program runs properly | 26 # Verify that the program runs properly. |
| 27 expect = 'hello from mylib.c\n' | 27 expect = 'hello from mylib.c\n' |
| 28 test.run_built_executable('prog', stdout=expect) | 28 test.run_built_executable('prog', stdout=expect) |
| 29 | 29 |
| 30 # Verify that libmylib.a contains symbols. "ar -x" fails on a 'thin' archive. | 30 # Verify that libmylib.a contains symbols. "ar -x" fails on a 'thin' archive. |
| 31 if test.format in ('make', 'ninja') and sys.platform.startswith('linux'): | 31 if test.format in ('make', 'ninja') and sys.platform.startswith('linux'): |
| 32 retcode = subprocess.call(['ar', '-x', path]) | 32 retcode = subprocess.call(['ar', '-x', path]) |
| 33 assert retcode == 0 | 33 assert retcode == 0 |
| 34 | 34 |
| 35 test.pass_test() | 35 test.pass_test() |
| OLD | NEW |