[libcxx-commits] [libcxx] e1ce3da - [libc++] Fix some tests that were broken in the single-threaded configuration
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Nov 19 11:24:25 PST 2021
Author: Louis Dionne
Date: 2021-11-19T14:24:15-05:00
New Revision: e1ce3dabf0c70d30a24f0586ddf2a965d730d30a
URL: https://github.com/llvm/llvm-project/commit/e1ce3dabf0c70d30a24f0586ddf2a965d730d30a
DIFF: https://github.com/llvm/llvm-project/commit/e1ce3dabf0c70d30a24f0586ddf2a965d730d30a.diff
LOG: [libc++] Fix some tests that were broken in the single-threaded configuration
We never noticed it because our CI doesn't actually build against a C
library that doesn't have threading functionality, however building
against a truly thread-free platform surfaces these issues.
Differential Revision: https://reviews.llvm.org/D114242
Added:
Modified:
libcxx/test/libcxx/thread/thread.mutex/version.pass.cpp
libcxx/test/std/concepts/concepts.compare/concept.equalitycomparable/equality_comparable.compile.pass.cpp
libcxx/test/std/concepts/concepts.compare/concept.equalitycomparable/equality_comparable_with.compile.pass.cpp
libcxx/test/std/concepts/concepts.lang/concept.assignable/assignable_from.compile.pass.cpp
libcxx/test/std/concepts/concepts.object/movable.compile.pass.cpp
libcxx/test/std/language.support/support.limits/support.limits.general/mutex.version.pass.cpp
libcxx/test/std/thread/thread.mutex/thread.once/thread.once.callonce/call_once.pass.cpp
libcxx/test/std/thread/thread.mutex/thread.once/thread.once.callonce/race.pass.cpp
libcxx/test/std/thread/thread.mutex/thread.once/thread.once.onceflag/assign.compile.fail.cpp
libcxx/test/std/thread/thread.mutex/thread.once/thread.once.onceflag/copy.compile.fail.cpp
libcxx/test/std/thread/thread.mutex/thread.once/thread.once.onceflag/default.pass.cpp
libcxx/utils/generate_feature_test_macro_components.py
libcxx/utils/generate_header_inclusion_tests.py
Removed:
################################################################################
diff --git a/libcxx/test/libcxx/thread/thread.mutex/version.pass.cpp b/libcxx/test/libcxx/thread/thread.mutex/version.pass.cpp
index 9a18ec72f7cfa..bf565318a1a7b 100644
--- a/libcxx/test/libcxx/thread/thread.mutex/version.pass.cpp
+++ b/libcxx/test/libcxx/thread/thread.mutex/version.pass.cpp
@@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: libcpp-has-no-threads
+
// <mutex>
#include <mutex>
diff --git a/libcxx/test/std/concepts/concepts.compare/concept.equalitycomparable/equality_comparable.compile.pass.cpp b/libcxx/test/std/concepts/concepts.compare/concept.equalitycomparable/equality_comparable.compile.pass.cpp
index 5290e06dc8280..59bab226e5f38 100644
--- a/libcxx/test/std/concepts/concepts.compare/concept.equalitycomparable/equality_comparable.compile.pass.cpp
+++ b/libcxx/test/std/concepts/concepts.compare/concept.equalitycomparable/equality_comparable.compile.pass.cpp
@@ -20,13 +20,16 @@
#include <list>
#include <map>
#include <memory>
-#include <mutex>
#include <optional>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <vector>
+#ifndef _LIBCPP_HAS_NO_THREADS
+# include <mutex>
+#endif
+
#include "compare_types.h"
namespace fundamentals {
diff --git a/libcxx/test/std/concepts/concepts.compare/concept.equalitycomparable/equality_comparable_with.compile.pass.cpp b/libcxx/test/std/concepts/concepts.compare/concept.equalitycomparable/equality_comparable_with.compile.pass.cpp
index a9caf8dc6e9bf..1f82b8a0d6b01 100644
--- a/libcxx/test/std/concepts/concepts.compare/concept.equalitycomparable/equality_comparable_with.compile.pass.cpp
+++ b/libcxx/test/std/concepts/concepts.compare/concept.equalitycomparable/equality_comparable_with.compile.pass.cpp
@@ -20,13 +20,16 @@
#include <list>
#include <map>
#include <memory>
-#include <mutex>
#include <optional>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <vector>
+#ifndef _LIBCPP_HAS_NO_THREADS
+# include <mutex>
+#endif
+
#include "compare_types.h"
template <class T, class U>
diff --git a/libcxx/test/std/concepts/concepts.lang/concept.assignable/assignable_from.compile.pass.cpp b/libcxx/test/std/concepts/concepts.lang/concept.assignable/assignable_from.compile.pass.cpp
index 1278f84c10b53..e38e4c6ac9350 100644
--- a/libcxx/test/std/concepts/concepts.lang/concept.assignable/assignable_from.compile.pass.cpp
+++ b/libcxx/test/std/concepts/concepts.lang/concept.assignable/assignable_from.compile.pass.cpp
@@ -19,13 +19,16 @@
#include <list>
#include <map>
#include <memory>
-#include <mutex>
#include <optional>
#include <string>
#include <string_view>
#include <unordered_map>
#include <vector>
+#ifndef _LIBCPP_HAS_NO_THREADS
+# include <mutex>
+#endif
+
#include "../support/allocators.h"
// Note: is_lvalue_reference is checked in all ModelsAssignableFrom calls.
diff --git a/libcxx/test/std/concepts/concepts.object/movable.compile.pass.cpp b/libcxx/test/std/concepts/concepts.object/movable.compile.pass.cpp
index 5459dcd1940da..fff78cfda3f83 100644
--- a/libcxx/test/std/concepts/concepts.object/movable.compile.pass.cpp
+++ b/libcxx/test/std/concepts/concepts.object/movable.compile.pass.cpp
@@ -18,11 +18,14 @@
#include <forward_list>
#include <list>
#include <map>
-#include <mutex>
#include <optional>
#include <unordered_map>
#include <vector>
+#ifndef _LIBCPP_HAS_NO_THREADS
+# include <mutex>
+#endif
+
#include "type_classification/moveconstructible.h"
#include "type_classification/movable.h"
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/mutex.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/mutex.version.pass.cpp
index 9e76cfb757459..dae5a1be20a01 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/mutex.version.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/mutex.version.pass.cpp
@@ -11,6 +11,8 @@
//
// clang-format off
+// UNSUPPORTED: libcpp-has-no-threads
+
// <mutex>
// Test the feature test macros defined by <mutex>
diff --git a/libcxx/test/std/thread/thread.mutex/thread.once/thread.once.callonce/call_once.pass.cpp b/libcxx/test/std/thread/thread.mutex/thread.once/thread.once.callonce/call_once.pass.cpp
index c63cda345c1ab..4748c6866aeba 100644
--- a/libcxx/test/std/thread/thread.mutex/thread.once/thread.once.callonce/call_once.pass.cpp
+++ b/libcxx/test/std/thread/thread.mutex/thread.once/thread.once.callonce/call_once.pass.cpp
@@ -5,7 +5,7 @@
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
-//
+
// UNSUPPORTED: libcpp-has-no-threads
// <mutex>
diff --git a/libcxx/test/std/thread/thread.mutex/thread.once/thread.once.callonce/race.pass.cpp b/libcxx/test/std/thread/thread.mutex/thread.once/thread.once.callonce/race.pass.cpp
index 54d29aec3a938..0084f0c1a5cd2 100644
--- a/libcxx/test/std/thread/thread.mutex/thread.once/thread.once.callonce/race.pass.cpp
+++ b/libcxx/test/std/thread/thread.mutex/thread.once/thread.once.callonce/race.pass.cpp
@@ -5,7 +5,7 @@
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
-//
+
// UNSUPPORTED: libcpp-has-no-threads
// <mutex>
diff --git a/libcxx/test/std/thread/thread.mutex/thread.once/thread.once.onceflag/assign.compile.fail.cpp b/libcxx/test/std/thread/thread.mutex/thread.once/thread.once.onceflag/assign.compile.fail.cpp
index 40d408d54ce33..c5da06c36c9fd 100644
--- a/libcxx/test/std/thread/thread.mutex/thread.once/thread.once.onceflag/assign.compile.fail.cpp
+++ b/libcxx/test/std/thread/thread.mutex/thread.once/thread.once.onceflag/assign.compile.fail.cpp
@@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: libcpp-has-no-threads
+
// <mutex>
// struct once_flag;
diff --git a/libcxx/test/std/thread/thread.mutex/thread.once/thread.once.onceflag/copy.compile.fail.cpp b/libcxx/test/std/thread/thread.mutex/thread.once/thread.once.onceflag/copy.compile.fail.cpp
index 9b7c19a96720d..70b145aee0192 100644
--- a/libcxx/test/std/thread/thread.mutex/thread.once/thread.once.onceflag/copy.compile.fail.cpp
+++ b/libcxx/test/std/thread/thread.mutex/thread.once/thread.once.onceflag/copy.compile.fail.cpp
@@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: libcpp-has-no-threads
+
// <mutex>
// struct once_flag;
diff --git a/libcxx/test/std/thread/thread.mutex/thread.once/thread.once.onceflag/default.pass.cpp b/libcxx/test/std/thread/thread.mutex/thread.once/thread.once.onceflag/default.pass.cpp
index 28d93dc7f383f..c6b48f373a00a 100644
--- a/libcxx/test/std/thread/thread.mutex/thread.once/thread.once.onceflag/default.pass.cpp
+++ b/libcxx/test/std/thread/thread.mutex/thread.once/thread.once.onceflag/default.pass.cpp
@@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: libcpp-has-no-threads
+
// <mutex>
// struct once_flag;
diff --git a/libcxx/utils/generate_feature_test_macro_components.py b/libcxx/utils/generate_feature_test_macro_components.py
index 5ff83304bc5e7..2e858935b4af8 100755
--- a/libcxx/utils/generate_feature_test_macro_components.py
+++ b/libcxx/utils/generate_feature_test_macro_components.py
@@ -653,23 +653,26 @@ def add_version_header(tc):
# Map from each header to the Lit annotations that should be used for
# tests that include that header.
#
-# For example, when threads are not supported, any feature-test-macro test
-# that includes <thread> should be marked as UNSUPPORTED, because including
-# <thread> is a hard error in that case.
+# For example, when threads are not supported, any test that includes
+# <thread> should be marked as UNSUPPORTED, because including <thread>
+# is a hard error in that case.
lit_markup = {
"barrier": ["UNSUPPORTED: libcpp-has-no-threads"],
"filesystem": ["UNSUPPORTED: libcpp-has-no-filesystem-library"],
"format": ["UNSUPPORTED: libcpp-has-no-incomplete-format"],
"iomanip": ["UNSUPPORTED: libcpp-has-no-localization"],
+ "ios": ["UNSUPPORTED: libcpp-has-no-localization"],
+ "iostream": ["UNSUPPORTED: libcpp-has-no-localization"],
"istream": ["UNSUPPORTED: libcpp-has-no-localization"],
"latch": ["UNSUPPORTED: libcpp-has-no-threads"],
"locale": ["UNSUPPORTED: libcpp-has-no-localization"],
+ "mutex": ["UNSUPPORTED: libcpp-has-no-threads"],
"ostream": ["UNSUPPORTED: libcpp-has-no-localization"],
"ranges": ["UNSUPPORTED: libcpp-has-no-incomplete-ranges"],
"regex": ["UNSUPPORTED: libcpp-has-no-localization"],
"semaphore": ["UNSUPPORTED: libcpp-has-no-threads"],
"shared_mutex": ["UNSUPPORTED: libcpp-has-no-threads"],
- "thread": ["UNSUPPORTED: libcpp-has-no-threads"],
+ "thread": ["UNSUPPORTED: libcpp-has-no-threads"]
}
def get_std_dialects():
diff --git a/libcxx/utils/generate_header_inclusion_tests.py b/libcxx/utils/generate_header_inclusion_tests.py
index 7d48094a8f5ec..00f6b0aa87653 100755
--- a/libcxx/utils/generate_header_inclusion_tests.py
+++ b/libcxx/utils/generate_header_inclusion_tests.py
@@ -86,9 +86,9 @@ def get_libcxx_paths():
# Map from each header to the Lit annotations that should be used for
# tests that include that header.
#
-# For example, when threads are not supported, any test
-# that includes <thread> should be marked as UNSUPPORTED, because including
-# <thread> is a hard error in that case.
+# For example, when threads are not supported, any test that includes
+# <thread> should be marked as UNSUPPORTED, because including <thread>
+# is a hard error in that case.
lit_markup = {
"barrier": ["UNSUPPORTED: libcpp-has-no-threads"],
"filesystem": ["UNSUPPORTED: libcpp-has-no-filesystem-library"],
@@ -99,12 +99,13 @@ def get_libcxx_paths():
"istream": ["UNSUPPORTED: libcpp-has-no-localization"],
"latch": ["UNSUPPORTED: libcpp-has-no-threads"],
"locale": ["UNSUPPORTED: libcpp-has-no-localization"],
+ "mutex": ["UNSUPPORTED: libcpp-has-no-threads"],
"ostream": ["UNSUPPORTED: libcpp-has-no-localization"],
"ranges": ["UNSUPPORTED: libcpp-has-no-incomplete-ranges"],
"regex": ["UNSUPPORTED: libcpp-has-no-localization"],
"semaphore": ["UNSUPPORTED: libcpp-has-no-threads"],
"shared_mutex": ["UNSUPPORTED: libcpp-has-no-threads"],
- "thread": ["UNSUPPORTED: libcpp-has-no-threads"],
+ "thread": ["UNSUPPORTED: libcpp-has-no-threads"]
}
More information about the libcxx-commits
mailing list