[PATCH] D94362: [scudo][standalone] Enable death tests on Fuchsia
Kostya Kortchinsky via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 22 11:47:29 PST 2021
cryptoad updated this revision to Diff 318597.
cryptoad added a comment.
Went through the death tests to ensure they were not messing with the
global state.
Ran `run fuchsia-pkg://fuchsia.com/libc-unittests-pkg#meta/libc-unittests-pkg.cmx`
multiple times on Fuchsia with the patch applied, it all passes.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D94362/new/
https://reviews.llvm.org/D94362
Files:
compiler-rt/lib/scudo/standalone/tests/scudo_unit_test.h
compiler-rt/lib/scudo/standalone/tests/wrappers_c_test.cpp
Index: compiler-rt/lib/scudo/standalone/tests/wrappers_c_test.cpp
===================================================================
--- compiler-rt/lib/scudo/standalone/tests/wrappers_c_test.cpp
+++ compiler-rt/lib/scudo/standalone/tests/wrappers_c_test.cpp
@@ -303,8 +303,10 @@
}
}
-// We expect heap operations within a disable/enable scope to deadlock.
+// Fuchsia doesn't have alarm, fork or malloc_info.
+#if !SCUDO_FUCHSIA
TEST(ScudoWrappersCTest, MallocDisableDeadlock) {
+ // We expect heap operations within a disable/enable scope to deadlock.
EXPECT_DEATH(
{
void *P = malloc(Size);
@@ -318,9 +320,6 @@
"");
}
-// Fuchsia doesn't have fork or malloc_info.
-#if !SCUDO_FUCHSIA
-
TEST(ScudoWrappersCTest, MallocInfo) {
// Use volatile so that the allocations don't get optimized away.
void *volatile P1 = malloc(1234);
Index: compiler-rt/lib/scudo/standalone/tests/scudo_unit_test.h
===================================================================
--- compiler-rt/lib/scudo/standalone/tests/scudo_unit_test.h
+++ compiler-rt/lib/scudo/standalone/tests/scudo_unit_test.h
@@ -16,10 +16,15 @@
// If EXPECT_DEATH isn't defined, make it a no-op.
#ifndef EXPECT_DEATH
+// If ASSERT_DEATH is defined, make EXPECT_DEATH a wrapper to it.
+#ifdef ASSERT_DEATH
+#define EXPECT_DEATH(X, Y) ASSERT_DEATH(([&] { X; }), "")
+#else
#define EXPECT_DEATH(X, Y) \
do { \
} while (0)
-#endif
+#endif // ASSERT_DEATH
+#endif // EXPECT_DEATH
// If EXPECT_STREQ isn't defined, define our own simple one.
#ifndef EXPECT_STREQ
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D94362.318597.patch
Type: text/x-patch
Size: 1698 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210122/f1f6c647/attachment-0001.bin>
More information about the llvm-commits
mailing list