[libcxx-commits] [libcxx] [libcxx] Work around picolibc argv handling in tests. (PR #127662)
via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Feb 18 08:33:22 PST 2025
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {darker}-->
:warning: Python code formatter, darker found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
darker --check --diff -r 2cb5241c7724cbf4fa02b25547e098bfc635aba9...8b31aa204ce3c3e8601501b9d0d2d193f5741b26 libcxx/utils/libcxx/test/dsl.py
``````````
</details>
<details>
<summary>
View the diff from darker here.
</summary>
``````````diff
--- dsl.py 2025-02-18 16:21:39.000000 +0000
+++ dsl.py 2025-02-18 16:32:55.031729 +0000
@@ -278,13 +278,14 @@
# Some locale names contain spaces, and some embedded use cases
# (in particular picolibc under Arm semihosting) can't support
# spaces in argv words. Work around this by applying URL-style
# %-encoding to the locale names, and undoing it in our test
# program.
- percent_encode = lambda s: ''.join(
- "%{:02x}".format(c) if c in b' %\\"\'' or c >= 128 else chr(c)
- for c in s.encode())
+ percent_encode = lambda s: "".join(
+ "%{:02x}".format(c) if c in b" %\\\"'" or c >= 128 else chr(c)
+ for c in s.encode()
+ )
program = """
#include <stddef.h>
#if defined(_LIBCPP_VERSION) && !_LIBCPP_HAS_LOCALIZATION
int main(int, char**) { return 1; }
@@ -312,12 +313,13 @@
}
return 1;
}
#endif
"""
- return programSucceeds(config, program, args=[
- shlex.quote(percent_encode(l)) for l in locales])
+ return programSucceeds(
+ config, program, args=[shlex.quote(percent_encode(l)) for l in locales]
+ )
@_memoizeExpensiveOperation(lambda c, flags="": (c.substitutions, c.environment, flags))
def compilerMacros(config, flags=""):
"""
``````````
</details>
https://github.com/llvm/llvm-project/pull/127662
More information about the libcxx-commits
mailing list