-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[libc++][hardening] Clean up some legacy debug mode tests: #71016
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
var-const
merged 3 commits into
llvm:main
from
var-const:varconst/reenable-legacy-debug-mode-tests-1
Nov 2, 2023
Merged
[libc++][hardening] Clean up some legacy debug mode tests: #71016
var-const
merged 3 commits into
llvm:main
from
var-const:varconst/reenable-legacy-debug-mode-tests-1
Nov 2, 2023
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Member
var-const
commented
Nov 2, 2023
- reenable a few tests that still pass under the new debug mode;
- delete a placeholder test;
- delete a test that is no longer relevant.
- reenable a few tests that still pass under the new debug mode; - delete a placeholder test; - delete a test that is no longer relevant.
@llvm/pr-subscribers-libcxx Author: Konstantin Varlamov (var-const) Changes
Full diff: https://github.com/llvm/llvm-project/pull/71016.diff 6 Files Affected:
diff --git a/libcxx/test/libcxx/algorithms/debug_less.inconsistent.pass.cpp b/libcxx/test/libcxx/algorithms/debug_less.inconsistent.pass.cpp
index f58250a2c855fba..701edd1335afa84 100644
--- a/libcxx/test/libcxx/algorithms/debug_less.inconsistent.pass.cpp
+++ b/libcxx/test/libcxx/algorithms/debug_less.inconsistent.pass.cpp
@@ -12,8 +12,8 @@
// Make sure __debug_less asserts when the comparator is not consistent.
-// REQUIRES: has-unix-headers
-// UNSUPPORTED: !libcpp-has-legacy-debug-mode, c++03
+// REQUIRES: has-unix-headers, libcpp-hardening-mode=debug
+// UNSUPPORTED: c++03
#include <algorithm>
#include <iterator>
diff --git a/libcxx/test/libcxx/algorithms/debug_less.pass.cpp b/libcxx/test/libcxx/algorithms/debug_less.pass.cpp
index d05cbfac4b8f6a2..4889f94d170a16d 100644
--- a/libcxx/test/libcxx/algorithms/debug_less.pass.cpp
+++ b/libcxx/test/libcxx/algorithms/debug_less.pass.cpp
@@ -12,8 +12,8 @@
// __debug_less checks that a comparator actually provides a strict-weak ordering.
-// REQUIRES: has-unix-headers
-// UNSUPPORTED: !libcpp-has-legacy-debug-mode, c++03
+// REQUIRES: has-unix-headers, libcpp-hardening-mode=debug
+// UNSUPPORTED: c++03
#include <algorithm>
#include <cassert>
diff --git a/libcxx/test/libcxx/algorithms/debug_three_way_comp.inconsistent.pass.cpp b/libcxx/test/libcxx/algorithms/debug_three_way_comp.inconsistent.pass.cpp
index 8a9943693d8a30a..b9bb1c9136f65ce 100644
--- a/libcxx/test/libcxx/algorithms/debug_three_way_comp.inconsistent.pass.cpp
+++ b/libcxx/test/libcxx/algorithms/debug_three_way_comp.inconsistent.pass.cpp
@@ -12,7 +12,8 @@
// Make sure __debug_three_way_comp asserts when the comparator is not consistent.
-// UNSUPPORTED: !libcpp-has-legacy-debug-mode, c++03, c++11, c++14, c++17
+// REQUIRES: libcpp-hardening-mode=debug
+// UNSUPPORTED: c++03, c++11, c++14, c++17
#include <algorithm>
#include <iterator>
diff --git a/libcxx/test/libcxx/debug/containers/associative_containers.pass.cpp b/libcxx/test/libcxx/debug/containers/associative_containers.pass.cpp
deleted file mode 100644
index 449e0244b272495..000000000000000
--- a/libcxx/test/libcxx/debug/containers/associative_containers.pass.cpp
+++ /dev/null
@@ -1,60 +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
-//
-//===----------------------------------------------------------------------===//
-
-// REQUIRES: has-unix-headers
-// UNSUPPORTED: !libcpp-has-legacy-debug-mode, c++03, c++11, c++14
-
-// test container debugging
-
-#include <map>
-#include <set>
-#include <utility>
-#include <cassert>
-#include "check_assertion.h"
-#include "container_debug_tests.h"
-#include "test_macros.h"
-
-using namespace IteratorDebugChecks;
-
-template <class Container, ContainerType CT>
-struct AssociativeContainerChecks : BasicContainerChecks<Container, CT> {
- using Base = BasicContainerChecks<Container, CT>;
- using value_type = typename Container::value_type;
- using iterator = typename Container::iterator;
- using const_iterator = typename Container::const_iterator;
- using traits = std::iterator_traits<iterator>;
- using category = typename traits::iterator_category;
-
- using Base::makeContainer;
-public:
- static void run() {
- Base::run();
- }
-
-private:
- // FIXME Add tests here
-};
-
-int main(int, char**)
-{
- using SetAlloc = test_allocator<int>;
- using MapAlloc = test_allocator<std::pair<const int, int>>;
- // FIXME: Add debug mode to these containers
- if ((false)) {
- AssociativeContainerChecks<
- std::set<int, std::less<int>, SetAlloc>, CT_Set>::run();
- AssociativeContainerChecks<
- std::multiset<int, std::less<int>, SetAlloc>, CT_MultiSet>::run();
- AssociativeContainerChecks<
- std::map<int, int, std::less<int>, MapAlloc>, CT_Map>::run();
- AssociativeContainerChecks<
- std::multimap<int, int, std::less<int>, MapAlloc>, CT_MultiMap>::run();
- }
-
- return 0;
-}
diff --git a/libcxx/test/libcxx/debug/extern-templates.sh.cpp b/libcxx/test/libcxx/debug/extern-templates.sh.cpp
deleted file mode 100644
index 88c009337055c22..000000000000000
--- a/libcxx/test/libcxx/debug/extern-templates.sh.cpp
+++ /dev/null
@@ -1,52 +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 checks that we retain extern template instantiation declarations
-// for members of <locale> even when the debug mode is enabled, which is
-// necessary for correctness. See https://llvm.org/D94718 for details.
-
-// UNSUPPORTED: !libcpp-has-legacy-debug-mode
-// UNSUPPORTED: no-localization
-// UNSUPPORTED: cant-build-shared-library
-
-// This test relies on linking a shared library and then passing that shared
-// library as input when linking an executable; this is generally not supported
-// on Windows (GNU ld supports it, but MS link.exe and LLD don't) - one has to
-// use an import library instead. (Additionally, the test uses the -fPIC
-// option which clang doesn't accept on Windows.)
-// UNSUPPORTED: windows
-
-// RUN: %{cxx} %{flags} %{compile_flags} %s %{link_flags} -fPIC -DTU1 -fvisibility=hidden -shared -o %t.lib
-// RUN: cd %T && %{cxx} %{flags} %{compile_flags} %s ./%basename_t.tmp.lib %{link_flags} -DTU2 -fvisibility=hidden -o %t.exe
-// RUN: %{exec} %t.exe
-
-#include <cassert>
-#include <cstdio>
-#include <sstream>
-#include <string>
-
-std::string __attribute__((visibility("default"))) numToString(int x);
-
-#if defined(TU1)
-
-std::string numToString(int x) {
- std::stringstream ss;
- ss << x;
- return ss.str();
-}
-
-#elif defined(TU2)
-
-int main(int, char**) {
- std::string s = numToString(42);
- assert(s == "42");
-
- return 0;
-}
-
-#endif
diff --git a/libcxx/test/libcxx/utilities/utility/mem.res/mem.poly.allocator.class/mem.poly.allocator.mem/debug.deallocate.pass.cpp b/libcxx/test/libcxx/utilities/utility/mem.res/mem.poly.allocator.class/mem.poly.allocator.mem/debug.deallocate.pass.cpp
index 6e70d171cb3ef15..305b06295bc44ae 100644
--- a/libcxx/test/libcxx/utilities/utility/mem.res/mem.poly.allocator.class/mem.poly.allocator.mem/debug.deallocate.pass.cpp
+++ b/libcxx/test/libcxx/utilities/utility/mem.res/mem.poly.allocator.class/mem.poly.allocator.mem/debug.deallocate.pass.cpp
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-// UNSUPPORTED: !libcpp-has-legacy-debug-mode, c++03, c++11, c++14
-// REQUIRES: has-unix-headers
+// UNSUPPORTED: c++03, c++11, c++14
+// REQUIRES: has-unix-headers, libcpp-hardening-mode=debug
// <memory_resource>
|
ldionne
approved these changes
Nov 2, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with a comment! It looks like the CI is passing, the Windows issue is unrelated.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.