| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 | 2 |
| 3 # Copyright (c) 2014 Google Inc. All rights reserved. | 3 # Copyright (c) 2014 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 swift framework builds correctly. | 8 Verifies that a swift framework builds correctly. |
| 9 """ | 9 """ |
| 10 | 10 |
| 11 from __future__ import print_function |
| 12 |
| 11 import TestGyp | 13 import TestGyp |
| 12 import TestMac | 14 import TestMac |
| 13 | 15 |
| 14 import collections | 16 import collections |
| 15 import sys | 17 import sys |
| 16 import subprocess | 18 import subprocess |
| 17 | 19 |
| 18 if sys.platform == 'darwin': | 20 if sys.platform == 'darwin': |
| 19 print "This test is currently disabled: https://crbug.com/483696." | 21 print("This test is currently disabled: https://crbug.com/483696.") |
| 20 sys.exit(0) | 22 sys.exit(0) |
| 21 | 23 |
| 22 test = TestGyp.TestGyp(formats=['xcode']) | 24 test = TestGyp.TestGyp(formats=['xcode']) |
| 23 | 25 |
| 24 # Ensures that the given symbol is present in the given file, by running nm. | 26 # Ensures that the given symbol is present in the given file, by running nm. |
| 25 def CheckHasSymbolName(path, symbol): | 27 def CheckHasSymbolName(path, symbol): |
| 26 output = subprocess.check_output(['nm', '-j', path]) | 28 output = subprocess.check_output(['nm', '-j', path]) |
| 27 idx = output.find(symbol) | 29 idx = output.find(symbol) |
| 28 if idx == -1: | 30 if idx == -1: |
| 29 print 'Swift: Could not find symobl: %s' % symbol | 31 print('Swift: Could not find symobl: %s' % symbol) |
| 30 test.fail_test() | 32 test.fail_test() |
| 31 | 33 |
| 32 test_cases = [] | 34 test_cases = [] |
| 33 | 35 |
| 34 # Run this for iOS on XCode 6.0 or greater | 36 # Run this for iOS on XCode 6.0 or greater |
| 35 if TestMac.Xcode.Version() >= '0600': | 37 if TestMac.Xcode.Version() >= '0600': |
| 36 test_cases.append(('Default', 'iphoneos')) | 38 test_cases.append(('Default', 'iphoneos')) |
| 37 test_cases.append(('Default', 'iphonesimulator')) | 39 test_cases.append(('Default', 'iphonesimulator')) |
| 38 | 40 |
| 39 # Run it for Mac on XCode 6.1 or greater | 41 # Run it for Mac on XCode 6.1 or greater |
| (...skipping 16 matching lines...) Expand all Loading... |
| 56 filename = 'SwiftFramework.framework/SwiftFramework' | 58 filename = 'SwiftFramework.framework/SwiftFramework' |
| 57 result_file = test.built_file_path(filename, chdir='swift-library') | 59 result_file = test.built_file_path(filename, chdir='swift-library') |
| 58 | 60 |
| 59 test.must_exist(result_file) | 61 test.must_exist(result_file) |
| 60 | 62 |
| 61 # Check to make sure that our swift class (GypSwiftTest) is present in the | 63 # Check to make sure that our swift class (GypSwiftTest) is present in the |
| 62 # built binary | 64 # built binary |
| 63 CheckHasSymbolName(result_file, "C14SwiftFramework12GypSwiftTest") | 65 CheckHasSymbolName(result_file, "C14SwiftFramework12GypSwiftTest") |
| 64 | 66 |
| 65 test.pass_test() | 67 test.pass_test() |
| OLD | NEW |