[llvm-branch-commits] [compiler-rt] 99d650b - [compiler-rt][test] Make glibc-* feature detection work on a musl distribution
Fangrui Song via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Sun Dec 27 21:54:48 PST 2020
Author: Fangrui Song
Date: 2020-12-27T21:50:47-08:00
New Revision: 99d650b3699eaf23adcff6b28ebbc7ec4b890b3b
URL: https://github.com/llvm/llvm-project/commit/99d650b3699eaf23adcff6b28ebbc7ec4b890b3b
DIFF: https://github.com/llvm/llvm-project/commit/99d650b3699eaf23adcff6b28ebbc7ec4b890b3b.diff
LOG: [compiler-rt][test] Make glibc-* feature detection work on a musl distribution
... where `ldd --version` has empty stdout and non-empty stderr.
Added:
Modified:
compiler-rt/test/lit.common.cfg.py
Removed:
################################################################################
diff --git a/compiler-rt/test/lit.common.cfg.py b/compiler-rt/test/lit.common.cfg.py
index e2de463f85c0..e487b4d955bf 100644
--- a/compiler-rt/test/lit.common.cfg.py
+++ b/compiler-rt/test/lit.common.cfg.py
@@ -363,7 +363,7 @@ def get_macos_aligned_version(macos_vers):
for required in [26, 28, 30]:
if android_api_level >= required:
config.available_features.add('android-%s' % required)
- # FIXME: Replace with appropriate version when availible.
+ # FIXME: Replace with appropriate version when availible.
if android_api_level > 30 or (android_api_level == 30 and android_api_codename == 'S'):
config.available_features.add('android-thread-properties-api')
@@ -380,18 +380,18 @@ def get_macos_aligned_version(macos_vers):
if config.host_os == 'Linux':
# detect whether we are using glibc, and which version
- # NB: 'ldd' is just one of the tools commonly installed as part of glibc
+ # NB: 'ldd' is just one of the tools commonly installed as part of glibc/musl
ldd_ver_cmd = subprocess.Popen(['ldd', '--version'],
stdout=subprocess.PIPE,
env={'LANG': 'C'})
sout, _ = ldd_ver_cmd.communicate()
- ver_line = sout.splitlines()[0]
- if not config.android and ver_line.startswith(b"ldd "):
+ ver_lines = sout.splitlines()
+ if not config.android and len(ver_lines) and ver_lines[0].startswith(b"ldd "):
from distutils.version import LooseVersion
- ver = LooseVersion(ver_line.split()[-1].decode())
+ ver = LooseVersion(ver_lines[0].split()[-1].decode())
for required in ["2.27", "2.30"]:
if ver >= LooseVersion(required):
- config.available_features.add("glibc-" + required)
+ config.available_features.add("glibc-" + required)
sancovcc_path = os.path.join(config.llvm_tools_dir, "sancov")
if os.path.exists(sancovcc_path):
More information about the llvm-branch-commits
mailing list