[libc-commits] [libc] [libc][NFC] Use specific EXPECT/ASSERT macros to test errno (PR #79573)
via libc-commits
libc-commits at lists.llvm.org
Fri Jan 26 05:52:00 PST 2024
================
@@ -58,6 +65,15 @@
#define ASSERT_NE(val1, val2) \
__CHECK_NE(__FILE__, __LINE__, (val1), (val2), true)
+////////////////////////////////////////////////////////////////////////////////
+// Errno checks.
+
+#define EXPECT_ERRNO_EQ(VAL) EXPECT_EQ(VAL, static_cast<int>(libc_errno))
+#define ASSERT_ERRNO_EQ(VAL) ASSERT_EQ(VAL, static_cast<int>(libc_errno))
+
+#define EXPECT_ERRNO() EXPECT_NE(static_cast<int>(libc_errno), 0)
----------------
lntue wrote:
SGTM.
https://github.com/llvm/llvm-project/pull/79573
More information about the libc-commits
mailing list