summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorAlexander Richardson <arichardson.kde@gmail.com>2018-11-14 17:58:55 +0000
committerAlexander Richardson <arichardson.kde@gmail.com>2018-11-14 17:58:55 +0000
commiteabc47899b716c91ced10846f4478a710ba0b012 (patch)
tree8bf7b2e584354a360ee08601e103994d0c592795 /utils
parent439de45011289e8b3e7d63459d2dc45560d01282 (diff)
downloadlibcxx-eabc47899b716c91ced10846f4478a710ba0b012.tar.gz
[libcxx] [test] Fix running tests on macOS with python3
Summary: The result of subprocess.check_output() is bytes in python3 which we need to convert to str(). Simplify this by using the executeCommand() helper. Reviewers: ldionne, EricWF Reviewed By: ldionne Subscribers: christof, libcxx-commits Differential Revision: https://reviews.llvm.org/D54522 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@346878 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r--utils/libcxx/test/target_info.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/utils/libcxx/test/target_info.py b/utils/libcxx/test/target_info.py
index de2232ff4..2ca09dc5d 100644
--- a/utils/libcxx/test/target_info.py
+++ b/utils/libcxx/test/target_info.py
@@ -15,6 +15,8 @@ import re
import subprocess
import sys
+from libcxx.util import executeCommand
+
class DefaultTargetInfo(object):
def __init__(self, full_config):
self.full_config = full_config
@@ -127,14 +129,13 @@ class DarwinLocalTI(DefaultTargetInfo):
cmd = ['xcrun', '--sdk', name, '--show-sdk-path']
else:
cmd = ['xcrun', '--show-sdk-path']
- try:
- out = subprocess.check_output(cmd).strip()
- res = 0
- except OSError:
- res = -1
- if res == 0 and out:
- sdk_path = out
+ out, err, exit_code = executeCommand(cmd)
+ if exit_code != 0:
+ self.full_config.lit_config.warning("Could not determine macOS SDK path! stderr was " + err)
+ if exit_code == 0 and out:
+ sdk_path = out.strip()
self.full_config.lit_config.note('using SDKROOT: %r' % sdk_path)
+ assert isinstance(sdk_path, str)
flags += ["-isysroot", sdk_path]
def add_cxx_link_flags(self, flags):