[libcxx-commits] [libcxx] [libc++] Fixes lit portability issues. (PR #72435)
Mark de Wever via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Nov 15 12:47:23 PST 2023
https://github.com/mordante created https://github.com/llvm/llvm-project/pull/72435
@StephanTLavavej mentioned the libc++ tests no longer works for MSVC STL. The regex changes have been provided by Stephan.
>From c029f1bc355c1a0c8f4d81ab5a35fe770aac2e09 Mon Sep 17 00:00:00 2001
From: Mark de Wever <koraq at xs4all.nl>
Date: Wed, 15 Nov 2023 21:34:31 +0100
Subject: [PATCH] [libc++] Fixes lit portability issues.
@StephanTLavavej mentioned the libc++ tests no longer works for MSVC STL.
The regex changes have been provided by Stephan.
---
libcxx/test/lit.local.cfg | 8 +++++++-
libcxx/utils/libcxx/test/params.py | 4 ++--
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/libcxx/test/lit.local.cfg b/libcxx/test/lit.local.cfg
index 4116553b6f7a9ae..da214edbccf5a88 100644
--- a/libcxx/test/lit.local.cfg
+++ b/libcxx/test/lit.local.cfg
@@ -29,7 +29,13 @@ def appendToSubstitution(substitutions, key, value):
return [(k, v + " " + value) if k == key else (k, v) for (k, v) in substitutions]
-std = getSubstitution("%{cxx_std}", config)
+# External users of the LLVM test suite might not have set the substitutions.
+std = ""
+try:
+ std = getSubstitution("%{cxx_std}", config)
+except:
+ pass
+
if std == "cxx26":
std = "26"
elif std == "cxx23":
diff --git a/libcxx/utils/libcxx/test/params.py b/libcxx/utils/libcxx/test/params.py
index e31130572df6576..3fedbf972c0c822 100644
--- a/libcxx/utils/libcxx/test/params.py
+++ b/libcxx/utils/libcxx/test/params.py
@@ -114,7 +114,7 @@ def getStdFlag(cfg, std):
),
actions=lambda std: [
AddFeature(std),
- AddSubstitution("%{cxx_std}", re.sub("\+", "x", std)),
+ AddSubstitution("%{cxx_std}", re.sub(r"\+", "x", std)),
AddCompileFlag(lambda cfg: getStdFlag(cfg, std)),
],
),
@@ -187,7 +187,7 @@ def getStdFlag(cfg, std):
AddFeature("stdlib={}".format(stdlib)),
# Also add an umbrella feature 'stdlib=libc++' for all flavors of libc++, to simplify
# the test suite.
- AddFeature("stdlib=libc++") if re.match(".+-libc\+\+", stdlib) else None,
+ AddFeature("stdlib=libc++") if re.match(r".+-libc\+\+", stdlib) else None,
],
),
),
More information about the libcxx-commits
mailing list