[libcxx-commits] [libcxx] 0c0628c - [libc++] Remove ad-hoc modules tests that are now unnecessary

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jun 23 06:43:01 PDT 2021


Author: Louis Dionne
Date: 2021-06-23T09:42:56-04:00
New Revision: 0c0628c92c0d3638f5739ecb28ba554347feccdf

URL: https://github.com/llvm/llvm-project/commit/0c0628c92c0d3638f5739ecb28ba554347feccdf
DIFF: https://github.com/llvm/llvm-project/commit/0c0628c92c0d3638f5739ecb28ba554347feccdf.diff

LOG: [libc++] Remove ad-hoc modules tests that are now unnecessary

Since we now have modules-enabled CI, it is now redundant to have ad-hoc
tests that check arbitrary things about our modules support. Instead,
the whole test suite should pass with modules enabled, period.

This patch also removes the module cache path workaround: one would
expect that modules work properly without that workaround. If that
isn't the case and we do run into flaky test failures, we can re-enable
the workaround temporarily (but that would be very vexing and we should
fix Clang ASAP if that's the case).

Differential Revision: https://reviews.llvm.org/D104746

Added: 
    

Modified: 
    libcxx/utils/libcxx/test/features.py

Removed: 
    libcxx/test/libcxx/modules/cinttypes_exports.compile.pass.cpp
    libcxx/test/libcxx/modules/clocale_exports.compile.pass.cpp
    libcxx/test/libcxx/modules/cstdint_exports.compile.pass.cpp
    libcxx/test/libcxx/modules/inttypes_h_exports.compile.pass.cpp
    libcxx/test/libcxx/modules/stdint_h_exports.compile.pass.cpp
    libcxx/test/libcxx/modules/stds_include.sh.cpp


################################################################################
diff  --git a/libcxx/test/libcxx/modules/cinttypes_exports.compile.pass.cpp b/libcxx/test/libcxx/modules/cinttypes_exports.compile.pass.cpp
deleted file mode 100644
index aa3ae7f97a21e..0000000000000
--- a/libcxx/test/libcxx/modules/cinttypes_exports.compile.pass.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// This test fails on Windows because the underlying libc headers on Windows
-// are not modular
-// XFAIL: LIBCXX-WINDOWS-FIXME
-
-// Some headers are not available when these features are disabled, but they
-// still get built as part of the 'std' module, which breaks the build.
-// UNSUPPORTED: libcpp-has-no-threads
-// UNSUPPORTED: libcpp-has-no-localization
-// UNSUPPORTED: libcpp-has-no-filesystem-library
-
-// REQUIRES: modules-support
-// ADDITIONAL_COMPILE_FLAGS: -fmodules
-
-// Test that <cinttypes> re-exports <cstdint>
-
-#include <cinttypes>
-
-int main(int, char**) {
-  int8_t x; (void)x;
-  std::int8_t y; (void)y;
-
-  return 0;
-}

diff  --git a/libcxx/test/libcxx/modules/clocale_exports.compile.pass.cpp b/libcxx/test/libcxx/modules/clocale_exports.compile.pass.cpp
deleted file mode 100644
index 92c50e24a0cbe..0000000000000
--- a/libcxx/test/libcxx/modules/clocale_exports.compile.pass.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// This test fails on Windows because the underlying libc headers on Windows
-// are not modular
-// XFAIL: LIBCXX-WINDOWS-FIXME
-
-// Some headers are not available when these features are disabled, but they
-// still get built as part of the 'std' module, which breaks the build.
-// UNSUPPORTED: libcpp-has-no-threads
-// UNSUPPORTED: libcpp-has-no-localization
-// UNSUPPORTED: libcpp-has-no-filesystem-library
-
-// UNSUPPORTED: c++03
-
-// REQUIRES: modules-support
-// ADDITIONAL_COMPILE_FLAGS: -fmodules
-
-#include <clocale>
-
-int main(int, char**) {
-  std::lconv l; (void)l;
-  using T = decltype(std::setlocale(0, ""));
-  using U = decltype(std::localeconv());
-
-  return 0;
-}

diff  --git a/libcxx/test/libcxx/modules/cstdint_exports.compile.pass.cpp b/libcxx/test/libcxx/modules/cstdint_exports.compile.pass.cpp
deleted file mode 100644
index b83e4da374717..0000000000000
--- a/libcxx/test/libcxx/modules/cstdint_exports.compile.pass.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// This test fails on Windows because the underlying libc headers on Windows
-// are not modular
-// XFAIL: LIBCXX-WINDOWS-FIXME
-
-// Some headers are not available when these features are disabled, but they
-// still get built as part of the 'std' module, which breaks the build.
-// UNSUPPORTED: libcpp-has-no-threads
-// UNSUPPORTED: libcpp-has-no-localization
-// UNSUPPORTED: libcpp-has-no-filesystem-library
-
-// Test that <cstdint> re-exports <stdint.h>
-
-// REQUIRES: modules-support
-// ADDITIONAL_COMPILE_FLAGS: -fmodules
-
-#include <cstdint>
-
-int main(int, char**) {
-  int8_t x; (void)x;
-  std::int8_t y; (void)y;
-
-  return 0;
-}

diff  --git a/libcxx/test/libcxx/modules/inttypes_h_exports.compile.pass.cpp b/libcxx/test/libcxx/modules/inttypes_h_exports.compile.pass.cpp
deleted file mode 100644
index ffc6a6296b180..0000000000000
--- a/libcxx/test/libcxx/modules/inttypes_h_exports.compile.pass.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// This test fails on Windows because the underlying libc headers on Windows
-// are not modular
-// XFAIL: LIBCXX-WINDOWS-FIXME
-
-// Some headers are not available when these features are disabled, but they
-// still get built as part of the 'std' module, which breaks the build.
-// UNSUPPORTED: libcpp-has-no-threads
-// UNSUPPORTED: libcpp-has-no-localization
-// UNSUPPORTED: libcpp-has-no-filesystem-library
-
-// Test that intypes.h re-exports stdint.h
-
-// REQUIRES: modules-support
-// ADDITIONAL_COMPILE_FLAGS: -fmodules
-
-#include <inttypes.h>
-
-int main(int, char**) {
-  int8_t x; (void)x;
-
-  return 0;
-}

diff  --git a/libcxx/test/libcxx/modules/stdint_h_exports.compile.pass.cpp b/libcxx/test/libcxx/modules/stdint_h_exports.compile.pass.cpp
deleted file mode 100644
index ad59b3ce82cd7..0000000000000
--- a/libcxx/test/libcxx/modules/stdint_h_exports.compile.pass.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// Some headers are not available when these features are disabled, but they
-// still get built as part of the 'std' module, which breaks the build.
-// UNSUPPORTED: libcpp-has-no-threads
-// UNSUPPORTED: libcpp-has-no-localization
-// UNSUPPORTED: libcpp-has-no-filesystem-library
-
-// Test that int8_t and the like are exported from stdint.h, not inttypes.h
-
-// REQUIRES: modules-support
-// ADDITIONAL_COMPILE_FLAGS: -fmodules
-
-// XFAIL: LIBCXX-WINDOWS-FIXME
-
-#include <stdint.h>
-
-int main(int, char**) {
-  int8_t x; (void)x;
-
-  return 0;
-}

diff  --git a/libcxx/test/libcxx/modules/stds_include.sh.cpp b/libcxx/test/libcxx/modules/stds_include.sh.cpp
deleted file mode 100644
index 715ab44d5b278..0000000000000
--- a/libcxx/test/libcxx/modules/stds_include.sh.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// Test that we can include libc++ headers when building with modules
-// enabled in various Standard modes. This is a common source of breakage
-// since the 'std' module will include all headers, so if something in a
-// header fails under a standard mode, importing anything will fail.
-
-// This test fails on Windows because the underlying libc headers on Windows
-// are not modular
-// XFAIL: LIBCXX-WINDOWS-FIXME
-
-// Some headers are not available when these features are disabled, but they
-// still get built as part of the 'std' module, which breaks the build.
-// UNSUPPORTED: libcpp-has-no-threads
-// UNSUPPORTED: libcpp-has-no-localization
-// UNSUPPORTED: libcpp-has-no-filesystem-library
-
-// REQUIRES: modules-support
-
-// NOTE: The -std=XXX flag is present in %{flags}, so we overwrite it by passing it after %{flags}.
-// FIXME: Remove the `-DINVALIDATE_CACHE_FOO` macros. Their purpose is to workaround a bug in older Clang versions
-//        the same modules caches were reused across standard dialects.
-// RUN: %{cxx} %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -std=c++03 -DINVALIDATE_CACHE_CXX03 %s
-// RUN: %{cxx} %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -std=c++11 -DINVALIDATE_CACHE_CXX11 %s
-// RUN: %{cxx} %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -std=c++14 -DINVALIDATE_CACHE_CXX14 %s
-// RUN: %{cxx} %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -std=c++17 -DINVALIDATE_CACHE_CXX17 %s
-// RUN: %{cxx} %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -std=c++2a -DINVALIDATE_CACHE_CXX20 %s
-
-#include <vector>
-
-int main(int, char**) {
-  return 0;
-}

diff  --git a/libcxx/utils/libcxx/test/features.py b/libcxx/utils/libcxx/test/features.py
index 85955cd4c3b6a..43c9e4abf1cd3 100644
--- a/libcxx/utils/libcxx/test/features.py
+++ b/libcxx/utils/libcxx/test/features.py
@@ -43,15 +43,6 @@
                                                                  sys.platform.lower().strip() == 'darwin'), # TODO: this doesn't handle cross-compiling to Apple platforms.
   Feature(name='objective-c++',                 when=lambda cfg: hasCompileFlag(cfg, '-xobjective-c++ -fobjc-arc')),
 
-  # Note: We use a custom modules cache path to make sure that we don't reuse
-  #       the default one, which can be shared across builds. This is important
-  #       because we define macros in headers files, and a change in these macros
-  #       doesn't seem to invalidate modules cache entries, which means we could
-  #       build against now-invalid cached headers from a previous build.
-  Feature(name='modules-support',
-          when=lambda cfg: hasCompileFlag(cfg, '-fmodules'),
-          actions=lambda cfg: [AddCompileFlag('-fmodules-cache-path=%t/ModuleCache')]),
-
   Feature(name='non-lockfree-atomics',
           when=lambda cfg: sourceBuilds(cfg, """
             #include <atomic>


        


More information about the libcxx-commits mailing list