[clang] [libc++][lit] Allow overriding the executor for tests (PR #66545)

Alexander Richardson via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 27 15:47:21 PDT 2023


arichardson wrote:

> @arichardson
> 
> here is a problem with your changes when building the libraries on the windows cross toolchain builders
> 
> * https://lab.llvm.org/buildbot/#/builders/60/builds/14086
> * https://lab.llvm.org/buildbot/#/builders/119/builds/15283
> 
> https://lab.llvm.org/buildbot/#/builders/60/builds/14086/steps/12/logs/stdio
> 
> ```
> llvm-lit.py: C:\buildbot\as-builder-1\x-armv7l\llvm-project\llvm\utils\lit\lit\TestingConfig.py:151: fatal: unable to parse config file 'C:/buildbot/as-builder-1/x-armv7l/build/runtimes/runtimes-armv7-unknown-linux-gnueabihf-bins/libunwind/test/cmake-bridge.cfg', traceback: Traceback (most recent call last):
>   File "C:\buildbot\as-builder-1\x-armv7l\llvm-project\llvm\utils\lit\lit\TestingConfig.py", line 139, in load_from_path
>     exec(compile(data, path, "exec"), cfg_globals, None)
>   File "C:/buildbot/as-builder-1/x-armv7l/build/runtimes/runtimes-armv7-unknown-linux-gnueabihf-bins/libunwind/test/cmake-bridge.cfg", line 7
>     config. 'executor="C:/Python310/python.exe" "C:/buildbot/as-builder-1/x-armv7l/llvm-project/libcxx/utils/ssh.py" --host = "ubuntu at jetson6.lab.llvm.org'"
>                                                                                                                                                            ^
> SyntaxError: unterminated string literal (detected at line 7)
> ```
> 
> would you take care of it?
> 
> UPDATE: Just let me know if you will need to check you changes before commit. I will test them on the builder locally.

@vvereschaka Could you try the following patch? It works in my local testing but I don't have the right setup for you toolchain. The problem appears to be that cmake always uses greedy regexes, so I've changed the split logic to instead find the first =.

```
diff --git a/libcxx/test/CMakeLists.txt b/libcxx/test/CMakeLists.txt
index fd194a36a28f..1416a8343df7 100644
--- a/libcxx/test/CMakeLists.txt
+++ b/libcxx/test/CMakeLists.txt
@@ -39,8 +39,10 @@ if (LLVM_USE_SANITIZER)
 endif()
 
 foreach(param IN LISTS LIBCXX_TEST_PARAMS)
-  string(REGEX REPLACE "(.+)=(.+)" "\\1" name "${param}")
-  string(REGEX REPLACE "(.+)=(.+)" "\\2" value "${param}")
+  string(FIND "${param}" "=" _eq_index)
+  string(SUBSTRING "${param}" 0 ${_eq_index} name)
+  string(SUBSTRING "${param}" ${_eq_index} -1 value)
+  string(SUBSTRING "${value}" 1 -1 value) # strip the leading =
   serialize_lit_param("${name}" "\"${value}\"")
 endforeach()
 
diff --git a/libcxxabi/test/CMakeLists.txt b/libcxxabi/test/CMakeLists.txt
index b65ac3a9d164..1baddf9ab305 100644
--- a/libcxxabi/test/CMakeLists.txt
+++ b/libcxxabi/test/CMakeLists.txt
@@ -53,8 +53,10 @@ else()
 endif()
 
 foreach(param IN LISTS LIBCXXABI_TEST_PARAMS)
-  string(REGEX REPLACE "(.+)=(.+)" "\\1" name "${param}")
-  string(REGEX REPLACE "(.+)=(.+)" "\\2" value "${param}")
+  string(FIND "${param}" "=" _eq_index)
+  string(SUBSTRING "${param}" 0 ${_eq_index} name)
+  string(SUBSTRING "${param}" ${_eq_index} -1 value)
+  string(SUBSTRING "${value}" 1 -1 value) # strip the leading =
   serialize_lit_param("${name}" "\"${value}\"")
 endforeach()
 
diff --git a/libunwind/test/CMakeLists.txt b/libunwind/test/CMakeLists.txt
index 084da0ab8f35..9d128720968c 100644
--- a/libunwind/test/CMakeLists.txt
+++ b/libunwind/test/CMakeLists.txt
@@ -36,8 +36,10 @@ else()
 endif()
 
 foreach(param IN LISTS LIBUNWIND_TEST_PARAMS)
-  string(REGEX REPLACE "(.+)=(.+)" "\\1" name "${param}")
-  string(REGEX REPLACE "(.+)=(.+)" "\\2" value "${param}")
+  string(FIND "${param}" "=" _eq_index)
+  string(SUBSTRING "${param}" 0 ${_eq_index} name)
+  string(SUBSTRING "${param}" ${_eq_index} -1 value)
+  string(SUBSTRING "${value}" 1 -1 value) # strip the leading =
   serialize_lit_param("${name}" "\"${value}\"")
 endforeach()

```

https://github.com/llvm/llvm-project/pull/66545


More information about the cfe-commits mailing list