[libc-commits] [libc] [fuchsia][libc] Include missing macro definitions (PR #79639)

Caslyn Tonelli via libc-commits libc-commits at lists.llvm.org
Fri Jan 26 11:19:47 PST 2024


https://github.com/Caslyn created https://github.com/llvm/llvm-project/pull/79639

PR 79573 introduced `ASSERT_ERRNO_*` macros for use in libc tests. Introduce these macro definitions to FuchsiaTest.h for string tests to compile on Fuchsia.

>From 4bd96efa543f0f1368dd37ad6c305c41a9563067 Mon Sep 17 00:00:00 2001
From: Caslyn Tonelli <caslyn at google.com>
Date: Fri, 26 Jan 2024 11:12:57 -0800
Subject: [PATCH] [fuchsia][libc] Include missing macro definitions

PR 79573 introduced `ASSERT_ERRNO_*` macros for use in libc tests.
Introduce these macro definitions to FuchsiaTest.h for string tests to
compile on Fuchsia.
---
 libc/test/UnitTest/FuchsiaTest.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libc/test/UnitTest/FuchsiaTest.h b/libc/test/UnitTest/FuchsiaTest.h
index 07a6e9b3f6bde5a..1b7537965813989 100644
--- a/libc/test/UnitTest/FuchsiaTest.h
+++ b/libc/test/UnitTest/FuchsiaTest.h
@@ -13,6 +13,11 @@
 
 #define WITH_SIGNAL(X) #X
 
+// These macros are used in string unittests.
+#define ASSERT_ERRNO_EQ(VAL) ASSERT_EQ(VAL, static_cast<int>(libc_errno))
+#define ASSERT_ERRNO_SUCCESS() ASSERT_EQ(0, static_cast<int>(libc_errno))
+#define ASSERT_ERRNO_FAILURE() ASSERT_NE(0, static_cast<int>(libc_errno))
+
 #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



More information about the libc-commits mailing list