[libcxx-commits] [libcxx] [libc++] tests with picolibc: Fix expected error message (PR #74452)
Dominik Wójt via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Dec 5 03:32:40 PST 2023
https://github.com/domin144 created https://github.com/llvm/llvm-project/pull/74452
Newlib's strerror function returns an empty string for unknown errnum values as described in [1].
[1] https://sourceware.org/git/?p=newlib-cygwin.git;a=blob;f=newlib/libc/string/strerror.c;hb=HEAD
>From 70bc35fcfdce235b7bde78abc342a38f40b0175b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dominik=20W=C3=B3jt?= <dominik.wojt at arm.com>
Date: Wed, 25 Oct 2023 12:27:18 +0200
Subject: [PATCH] [libc++] tests with picolibc: Fix expected error message
Newlib's strerror function returns an empty string for unknown errnum
values as described in [1].
[1] https://sourceware.org/git/?p=newlib-cygwin.git;a=blob;f=newlib/libc/string/strerror.c;hb=HEAD
---
.../syserr.errcat.objects/generic_category.pass.cpp | 3 ++-
.../syserr.errcat.objects/system_category.pass.cpp | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/libcxx/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/generic_category.pass.cpp b/libcxx/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/generic_category.pass.cpp
index 3f49c36f8ba2e..068202c6e4150 100644
--- a/libcxx/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/generic_category.pass.cpp
+++ b/libcxx/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/generic_category.pass.cpp
@@ -7,7 +7,6 @@
//===----------------------------------------------------------------------===//
// XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx10.{{9|10|11|12}}
-// XFAIL: LIBCXX-PICOLIBC-FIXME
// <system_error>
@@ -48,6 +47,8 @@ int main(int, char**)
// Exact message format varies by platform.
#if defined(_AIX)
LIBCPP_ASSERT(msg.rfind("Error -1 occurred", 0) == 0);
+#elif defined(_NEWLIB_VERSION)
+ LIBCPP_ASSERT(msg.empty());
#else
LIBCPP_ASSERT(msg.rfind("Unknown error", 0) == 0);
#endif
diff --git a/libcxx/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/system_category.pass.cpp b/libcxx/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/system_category.pass.cpp
index 4a29e1baa808a..7c98a42b52010 100644
--- a/libcxx/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/system_category.pass.cpp
+++ b/libcxx/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/system_category.pass.cpp
@@ -13,7 +13,6 @@
// const error_category& system_category();
// XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx10.{{9|10|11|12}}
-// XFAIL: LIBCXX-PICOLIBC-FIXME
#include <system_error>
#include <cassert>
@@ -52,6 +51,8 @@ int main(int, char**)
// Exact message format varies by platform.
#if defined(_AIX)
LIBCPP_ASSERT(msg.rfind("Error -1 occurred", 0) == 0);
+#elif defined(_NEWLIB_VERSION)
+ LIBCPP_ASSERT(msg.empty());
#else
LIBCPP_ASSERT(msg.rfind("Unknown error", 0) == 0);
#endif
More information about the libcxx-commits
mailing list