| 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 that LD_DYLIB_INSTALL_NAME and DYLIB_INSTALL_NAME_BASE are handled | 8 Verifies that LD_DYLIB_INSTALL_NAME and DYLIB_INSTALL_NAME_BASE are handled |
| 9 correctly. | 9 correctly. |
| 10 """ | 10 """ |
| 11 | 11 |
| 12 import TestGyp | 12 import TestGyp |
| 13 | 13 |
| 14 import re | 14 import re |
| 15 import subprocess | 15 import subprocess |
| 16 import sys | 16 import sys |
| 17 | 17 |
| 18 if sys.platform == 'darwin': | 18 if sys.platform == 'darwin': |
| 19 test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode']) | 19 test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode']) |
| 20 | 20 |
| 21 CHDIR = 'rpath' | 21 CHDIR = 'rpath' |
| 22 test.run_gyp('test.gyp', chdir=CHDIR) | 22 test.run_gyp('test.gyp', chdir=CHDIR) |
| 23 |
| 23 test.build('test.gyp', test.ALL, chdir=CHDIR) | 24 test.build('test.gyp', test.ALL, chdir=CHDIR) |
| 24 | 25 |
| 25 def GetRpaths(p): | 26 def GetRpaths(p): |
| 26 p = test.built_file_path(p, chdir=CHDIR) | 27 p = test.built_file_path(p, chdir=CHDIR) |
| 27 r = re.compile(r'cmd LC_RPATH.*?path (.*?) \(offset \d+\)', re.DOTALL) | 28 r = re.compile(r'cmd LC_RPATH.*?path (.*?) \(offset \d+\)', re.DOTALL) |
| 28 proc = subprocess.Popen(['otool', '-l', p], stdout=subprocess.PIPE) | 29 proc = subprocess.Popen(['otool', '-l', p], stdout=subprocess.PIPE) |
| 29 o = proc.communicate()[0] | 30 o = proc.communicate()[0] |
| 30 assert not proc.returncode | 31 assert not proc.returncode |
| 31 return r.findall(o) | 32 return r.findall(o) |
| 32 | 33 |
| 33 if GetRpaths('libdefault_rpath.dylib') != []: | 34 if GetRpaths('libdefault_rpath.dylib') != []: |
| 34 test.fail_test() | 35 test.fail_test() |
| 35 | 36 |
| 36 if GetRpaths('libexplicit_rpath.dylib') != ['@executable_path/.']: | 37 if GetRpaths('libexplicit_rpath.dylib') != ['@executable_path/.']: |
| 37 test.fail_test() | 38 test.fail_test() |
| 38 | 39 |
| 39 if (GetRpaths('libexplicit_rpaths_escaped.dylib') != | 40 if (GetRpaths('libexplicit_rpaths_escaped.dylib') != |
| 40 ['First rpath', 'Second rpath']): | 41 ['First rpath', 'Second rpath']): |
| 41 test.fail_test() | 42 test.fail_test() |
| 42 | 43 |
| 43 if GetRpaths('My Framework.framework/My Framework') != ['@loader_path/.']: | 44 if GetRpaths('My Framework.framework/My Framework') != ['@loader_path/.']: |
| 44 test.fail_test() | 45 test.fail_test() |
| 45 | 46 |
| 46 if GetRpaths('executable') != ['@executable_path/.']: | 47 if GetRpaths('executable') != ['@executable_path/.']: |
| 47 test.fail_test() | 48 test.fail_test() |
| 48 | 49 |
| 49 test.pass_test() | 50 test.pass_test() |
| OLD | NEW |