Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame^] | 1 | #!/usr/bin/env python |
| 2 | |
| 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 |
| 5 | # found in the LICENSE file. |
| 6 | |
| 7 | """ |
| 8 | Verifies libraries (in identical-names) are properly handeled by xcode. |
| 9 | |
| 10 | The names for all libraries participating in this build are: |
| 11 | libtestlib.a - identical-name/testlib |
| 12 | libtestlib.a - identical-name/proxy/testlib |
| 13 | libproxy.a - identical-name/proxy |
| 14 | The first two libs produce a hash collision in Xcode when Gyp is executed, |
| 15 | because they have the same name and would be copied to the same directory with |
| 16 | Xcode default settings. |
| 17 | For this scenario to work one needs to change the Xcode variables SYMROOT and |
| 18 | CONFIGURATION_BUILD_DIR. Setting these to per-lib-unique directories, avoids |
| 19 | copying the libs into the same directory. |
| 20 | |
| 21 | The test consists of two steps. The first one verifies that by setting both |
| 22 | vars, there is no hash collision anymore during Gyp execution and that the libs |
| 23 | can actually be be built. The second one verifies that there is still a hash |
| 24 | collision if the vars are not set and thus the current behavior is preserved. |
| 25 | """ |
| 26 | |
| 27 | import TestGyp |
| 28 | |
| 29 | import sys |
| 30 | |
| 31 | def IgnoreOutput(string, expected_string): |
| 32 | return True |
| 33 | |
| 34 | if sys.platform == 'darwin': |
| 35 | test = TestGyp.TestGyp(formats=['xcode']) |
| 36 | |
| 37 | |
| 38 | test.run_gyp('test.gyp', chdir='identical-name') |
| 39 | test.build('test.gyp', test.ALL, chdir='identical-name') |
| 40 | |
| 41 | test.run_gyp('test-should-fail.gyp', chdir='identical-name') |
| 42 | test.built_file_must_not_exist('test-should-fail.xcodeproj') |
| 43 | |
| 44 | test.pass_test() |
| 45 | |