[libc-commits] [PATCH] D156940: [libc] Use ASSERT_DEATH for EXPECT_DEATH under Fuchsia zxtest

Roland McGrath via Phabricator via libc-commits libc-commits at lists.llvm.org
Wed Aug 2 17:58:17 PDT 2023


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGcd328c10ad50: [libc] Use ASSERT_DEATH for EXPECT_DEATH under Fuchsia zxtest (authored by mcgrathr).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D156940/new/

https://reviews.llvm.org/D156940

Files:
  libc/test/UnitTest/FuchsiaTest.h


Index: libc/test/UnitTest/FuchsiaTest.h
===================================================================
--- libc/test/UnitTest/FuchsiaTest.h
+++ libc/test/UnitTest/FuchsiaTest.h
@@ -13,6 +13,13 @@
 
 #define WITH_SIGNAL(X) #X
 
+#ifndef EXPECT_DEATH
+// Since zxtest has ASSERT_DEATH but not EXPECT_DEATH, wrap calling it
+// in a lambda returning void to swallow any early returns so that this
+// can be used in a function that itself returns non-void.
+#define EXPECT_DEATH(FUNC, SIG) ([&] { ASSERT_DEATH(FUNC, SIG); }())
+#endif
+
 namespace __llvm_libc::testing {
 using Test = ::zxtest::Test;
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D156940.546660.patch
Type: text/x-patch
Size: 606 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230803/80e2b0db/attachment.bin>


More information about the libc-commits mailing list