Skip to content

[libcxx] [test] Merge the MinGW static/shared test config files #111759

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 10, 2024

Conversation

mstorsjo
Copy link
Member

@mstorsjo mstorsjo commented Oct 9, 2024

These were split in 0e8208e, with the only functional difference between them at the time being --prepend_env PATH=%{lib-dir} in the static config and --prepend_env PATH=%{install-prefix}/bin in the shared library config.

However this difference is unnecessary - the static library config doesn't need any --prepend_env argument at all. Before 0e8208e, both configurations used the same config file, where the --prepend_env argument was unnecessary but benign in the static case.

Reduce the unnecessary config duplication in this case, and return these configs to using one single config file for both setups.

These were split in 0e8208e,
with the only functional difference between them at the time
being `--prepend_env PATH=%{lib-dir}` in the static config
and `--prepend_env PATH=%{install-prefix}/bin` in the shared
library config.

However this difference is unnecessary - the static library config
doesn't need any `--prepend_env` argument at all. Before
0e8208e, both configurations
used the same config file, where the `--prepend_env` argument was
unnecessary but benign in the static case.

Reduce the unnecessary config duplication in this case, and return
these configs to using one single config file for both setups.
@mstorsjo mstorsjo requested a review from a team as a code owner October 9, 2024 20:40
@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Oct 9, 2024
@llvmbot
Copy link
Member

llvmbot commented Oct 9, 2024

@llvm/pr-subscribers-libcxx

Author: Martin Storsjö (mstorsjo)

Changes

These were split in 0e8208e, with the only functional difference between them at the time being --prepend_env PATH=%{lib-dir} in the static config and --prepend_env PATH=%{install-prefix}/bin in the shared library config.

However this difference is unnecessary - the static library config doesn't need any --prepend_env argument at all. Before 0e8208e, both configurations used the same config file, where the --prepend_env argument was unnecessary but benign in the static case.

Reduce the unnecessary config duplication in this case, and return these configs to using one single config file for both setups.


Full diff: https://github.com/llvm/llvm-project/pull/111759.diff

3 Files Affected:

  • (modified) libcxx/CMakeLists.txt (+1-5)
  • (renamed) libcxx/test/configs/llvm-libc++-mingw.cfg.in (+1-1)
  • (removed) libcxx/test/configs/llvm-libc++-static-mingw.cfg.in (-25)
diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt
index f1942e963ccc31..75c926f5432aea 100644
--- a/libcxx/CMakeLists.txt
+++ b/libcxx/CMakeLists.txt
@@ -131,11 +131,7 @@ option(LIBCXX_ENABLE_VENDOR_AVAILABILITY_ANNOTATIONS
 if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
   set(LIBCXX_DEFAULT_TEST_CONFIG "llvm-libc++-shared-gcc.cfg.in")
 elseif(MINGW)
-  if (LIBCXX_ENABLE_SHARED)
-    set(LIBCXX_DEFAULT_TEST_CONFIG "llvm-libc++-shared-mingw.cfg.in")
-  else()
-    set(LIBCXX_DEFAULT_TEST_CONFIG "llvm-libc++-static-mingw.cfg.in")
-  endif()
+  set(LIBCXX_DEFAULT_TEST_CONFIG "llvm-libc++-mingw.cfg.in")
 elseif(WIN32) # clang-cl
   if (LIBCXX_ENABLE_SHARED)
     set(LIBCXX_DEFAULT_TEST_CONFIG "llvm-libc++-shared-clangcl.cfg.in")
diff --git a/libcxx/test/configs/llvm-libc++-shared-mingw.cfg.in b/libcxx/test/configs/llvm-libc++-mingw.cfg.in
similarity index 92%
rename from libcxx/test/configs/llvm-libc++-shared-mingw.cfg.in
rename to libcxx/test/configs/llvm-libc++-mingw.cfg.in
index 8868f0cadd2aa2..01c4d58ca05f96 100644
--- a/libcxx/test/configs/llvm-libc++-shared-mingw.cfg.in
+++ b/libcxx/test/configs/llvm-libc++-mingw.cfg.in
@@ -1,5 +1,5 @@
 # This testing configuration handles running the test suite against LLVM's libc++
-# using a DLL with MinGW/Clang on Windows.
+# using either a DLL or a static library, with MinGW/Clang on Windows.
 
 lit_config.load_config(config, '@CMAKE_CURRENT_BINARY_DIR@/cmake-bridge.cfg')
 
diff --git a/libcxx/test/configs/llvm-libc++-static-mingw.cfg.in b/libcxx/test/configs/llvm-libc++-static-mingw.cfg.in
deleted file mode 100644
index fb2f9065898a54..00000000000000
--- a/libcxx/test/configs/llvm-libc++-static-mingw.cfg.in
+++ /dev/null
@@ -1,25 +0,0 @@
-# This testing configuration handles running the test suite against LLVM's libc++
-# using a static library with MinGW/Clang on Windows.
-
-lit_config.load_config(config, '@CMAKE_CURRENT_BINARY_DIR@/cmake-bridge.cfg')
-
-config.substitutions.append(('%{flags}', ''))
-config.substitutions.append(('%{compile_flags}',
-    '-nostdinc++ -I %{target-include-dir} -I %{include-dir} -I %{libcxx-dir}/test/support'
-))
-config.substitutions.append(('%{link_flags}',
-    '-nostdlib++ -L %{lib-dir} -lc++'
-))
-config.substitutions.append(('%{exec}',
-    '%{executor} --execdir %T --prepend_env PATH=%{lib-dir} -- '
-))
-
-import os, site
-site.addsitedir(os.path.join('@LIBCXX_SOURCE_DIR@', 'utils'))
-import libcxx.test.params, libcxx.test.config
-libcxx.test.config.configure(
-    libcxx.test.params.DEFAULT_PARAMETERS,
-    libcxx.test.features.DEFAULT_FEATURES,
-    config,
-    lit_config
-)

Copy link
Member

@ldionne ldionne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for the simplification. I'm not certain why I ended up duplicating it, I guess I didn't know both could work with the same config. I'd swear this was in reaction to a CI failure, but I'm probably mistaken if this patch passes CI.

@mstorsjo
Copy link
Member Author

mstorsjo commented Oct 9, 2024

IIRC, the shared case required changing the path (but as the static case doesn’t use that path, it didn’t break and require changing), so you probably, understandably, thought it needed to stay as it was.

I’ll merge once we have a green enough CI run of it :-)

@mstorsjo mstorsjo merged commit 9fb2378 into llvm:main Oct 10, 2024
66 checks passed
@mstorsjo mstorsjo deleted the libcxx-merge-mingw-configs branch October 10, 2024 06:13
DanielCChen pushed a commit to DanielCChen/llvm-project that referenced this pull request Oct 16, 2024
…#111759)

These were split in 0e8208e, with the
only functional difference between them at the time being `--prepend_env
PATH=%{lib-dir}` in the static config and `--prepend_env
PATH=%{install-prefix}/bin` in the shared library config.

However this difference is unnecessary - the static library config
doesn't need any `--prepend_env` argument at all. Before
0e8208e, both configurations used the
same config file, where the `--prepend_env` argument was unnecessary but
benign in the static case.

Reduce the unnecessary config duplication in this case, and return these
configs to using one single config file for both setups.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants