| 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 setting SDKROOT works. | 8 Verifies that setting SDKROOT works. |
| 9 """ | 9 """ |
| 10 | 10 |
| 11 import TestGyp | 11 import TestGyp |
| 12 | 12 |
| 13 import os | 13 import os |
| 14 import subprocess | 14 import subprocess |
| 15 import sys | 15 import sys |
| 16 | 16 |
| 17 if sys.platform == 'darwin': | 17 if sys.platform == 'darwin': |
| 18 test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode']) | 18 test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode']) |
| 19 | 19 |
| 20 # Make sure this works on the bots, which only have the 10.6 sdk, and on | 20 # Make sure this works on the bots, which only have the 10.6 sdk, and on |
| 21 # dev machines, who usually don't have the 10.6 sdk. | 21 # dev machines, which usually don't have the 10.6 sdk. |
| 22 sdk = '10.6' | 22 sdk = '10.6' |
| 23 DEVNULL = open(os.devnull, 'wb') | 23 DEVNULL = open(os.devnull, 'wb') |
| 24 proc = subprocess.Popen(['xcodebuild', '-version', '-sdk', 'macosx' + sdk], | 24 proc = subprocess.Popen(['xcodebuild', '-version', '-sdk', 'macosx' + sdk], |
| 25 stdout=DEVNULL, stderr=DEVNULL) | 25 stdout=DEVNULL, stderr=DEVNULL) |
| 26 proc.communicate() | 26 proc.communicate() |
| 27 DEVNULL.close() | 27 DEVNULL.close() |
| 28 if proc.returncode: | 28 if proc.returncode: |
| 29 sdk = '10.7' | 29 sdk = '10.7' |
| 30 | 30 |
| 31 proc = subprocess.Popen(['xcodebuild', '-version', | 31 proc = subprocess.Popen(['xcodebuild', '-version', |
| 32 '-sdk', 'macosx' + sdk, 'Path'], | 32 '-sdk', 'macosx' + sdk, 'Path'], |
| 33 stdout=subprocess.PIPE) | 33 stdout=subprocess.PIPE) |
| 34 sdk_path = proc.communicate()[0].rstrip('\n') | 34 sdk_path = proc.communicate()[0].rstrip('\n') |
| 35 if proc.returncode != 0: | 35 if proc.returncode != 0: |
| 36 test.fail_test() | 36 test.fail_test() |
| 37 | 37 |
| 38 test.write('sdkroot/test.gyp', test.read('sdkroot/test.gyp') % sdk) | 38 test.write('sdkroot/test.gyp', test.read('sdkroot/test.gyp') % sdk) |
| 39 | 39 |
| 40 test.run_gyp('test.gyp', '-D', 'sdk_path=%s' % sdk_path, | 40 test.run_gyp('test.gyp', '-D', 'sdk_path=%s' % sdk_path, |
| 41 chdir='sdkroot') | 41 chdir='sdkroot') |
| 42 test.build('test.gyp', test.ALL, chdir='sdkroot') | 42 test.build('test.gyp', test.ALL, chdir='sdkroot') |
| 43 test.pass_test() | 43 test.pass_test() |
| OLD | NEW |