[libc-commits] [libc] [libc][NFC] Use specific EXPECT/ASSERT macros to test errno (PR #79573)
Guillaume Chatelet via libc-commits
libc-commits at lists.llvm.org
Fri Jan 26 06:02:24 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)
----------------
gchatelet wrote:
I've added another variant with `ASSERT_ERRNO_EQ`, `ASSERT_ERRNO_FAILURE` and `ASSERT_ERRNO_SUCCESS`.
https://github.com/llvm/llvm-project/pull/79573
More information about the libc-commits
mailing list