Skip to content

Commit 0847c90

Browse files
committed
Revert "[libc++] Fix tests on musl (#85085)"
This reverts commit b61fb18. This commit landed with build failures in the pre-commit CI https://buildkite.com/llvm-project/libcxx-ci/builds/34153
1 parent c9325f8 commit 0847c90

File tree

3 files changed

+37
-52
lines changed

3 files changed

+37
-52
lines changed

libcxx/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/generic_category.pass.cpp

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,14 @@ int main(int, char**)
4444
errno = E2BIG; // something that message will never generate
4545
const std::error_category& e_cat1 = std::generic_category();
4646
const std::string msg = e_cat1.message(-1);
47-
// Exact message format varies by platform. We can't detect
48-
// some of these (Musl in particular) using the preprocessor,
49-
// so accept a few sensible messages. Newlib unfortunately
50-
// responds with an empty message, which we probably want to
51-
// treat as a failure code otherwise, but we can detect that
52-
// with the preprocessor.
53-
LIBCPP_ASSERT(msg.rfind("Error -1 occurred", 0) == 0 // AIX
54-
|| msg.rfind("No error information", 0) == 0 // Musl
55-
|| msg.rfind("Unknown error", 0) == 0 // Glibc
56-
#if defined(_NEWLIB_VERSION)
57-
|| msg.empty()
47+
// Exact message format varies by platform.
48+
#if defined(_AIX)
49+
LIBCPP_ASSERT(msg.rfind("Error -1 occurred", 0) == 0);
50+
#elif defined(_NEWLIB_VERSION)
51+
LIBCPP_ASSERT(msg.empty());
52+
#else
53+
LIBCPP_ASSERT(msg.rfind("Unknown error", 0) == 0);
5854
#endif
59-
);
6055
assert(errno == E2BIG);
6156
}
6257

libcxx/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/system_category.pass.cpp

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -50,19 +50,14 @@ int main(int, char**) {
5050
errno = E2BIG; // something that message will never generate
5151
const std::error_category& e_cat1 = std::system_category();
5252
const std::string msg = e_cat1.message(-1);
53-
// Exact message format varies by platform. We can't detect
54-
// some of these (Musl in particular) using the preprocessor,
55-
// so accept a few sensible messages. Newlib unfortunately
56-
// responds with an empty message, which we probably want to
57-
// treat as a failure code otherwise, but we can detect that
58-
// with the preprocessor.
59-
LIBCPP_ASSERT(msg.rfind("Error -1 occurred", 0) == 0 // AIX
60-
|| msg.rfind("No error information", 0) == 0 // Musl
61-
|| msg.rfind("Unknown error", 0) == 0 // Glibc
62-
#if defined(_NEWLIB_VERSION)
63-
|| msg.empty()
53+
// Exact message format varies by platform.
54+
#if defined(_AIX)
55+
LIBCPP_ASSERT(msg.rfind("Error -1 occurred", 0) == 0);
56+
#elif defined(_NEWLIB_VERSION)
57+
LIBCPP_ASSERT(msg.empty());
58+
#else
59+
LIBCPP_ASSERT(msg.rfind("Unknown error", 0) == 0);
6460
#endif
65-
);
6661
assert(errno == E2BIG);
6762
}
6863

libcxx/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long_double.pass.cpp

Lines changed: 23 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
#include <locale>
2323
#include <ios>
2424
#include <cassert>
25-
#include <cstdio>
2625
#include <streambuf>
2726
#include <cmath>
2827
#include "test_macros.h"
@@ -8935,12 +8934,11 @@ void test4()
89358934
char str[200];
89368935
std::locale lc = std::locale::classic();
89378936
std::locale lg(lc, new my_numpunct);
8938-
8939-
std::string inf;
8940-
8941-
// This should match the underlying C library
8942-
std::sprintf(str, "%f", INFINITY);
8943-
inf = str;
8937+
#ifdef _AIX
8938+
std::string inf = "INF";
8939+
#else
8940+
std::string inf = "inf";
8941+
#endif
89448942

89458943
const my_facet f(1);
89468944
{
@@ -10729,27 +10727,24 @@ void test5()
1072910727
std::locale lc = std::locale::classic();
1073010728
std::locale lg(lc, new my_numpunct);
1073110729
const my_facet f(1);
10732-
10733-
std::string nan;
10734-
std::string NaN;
10735-
std::string pnan_sign;
10736-
10737-
// The output here depends on the underlying C library, so work out what
10738-
// that does.
10739-
std::sprintf(str, "%f", std::nan(""));
10740-
nan = str;
10741-
10742-
std::sprintf(str, "%F", std::nan(""));
10743-
NaN = str;
10744-
10745-
std::sprintf(str, "%+f", std::nan(""));
10746-
if (str[0] == '+') {
10747-
pnan_sign = "+";
10748-
}
10749-
10750-
std::string nan_padding25 = std::string(25 - nan.length(), '*');
10751-
std::string pnan_padding25 = std::string(25 - nan.length() - pnan_sign.length(), '*');
10752-
10730+
#if defined(_AIX)
10731+
std::string nan= "NaNQ";
10732+
std::string NaN = "NaNQ";
10733+
std::string nan_padding25 = "*********************";
10734+
std::string pnan_sign = "+";
10735+
std::string pnan_padding25 = "********************";
10736+
#else
10737+
std::string nan= "nan";
10738+
std::string NaN = "NAN";
10739+
std::string nan_padding25 = "**********************";
10740+
#if defined(TEST_HAS_GLIBC) || defined(_WIN32)
10741+
std::string pnan_sign = "+";
10742+
std::string pnan_padding25 = "*********************";
10743+
#else
10744+
std::string pnan_sign = "";
10745+
std::string pnan_padding25 = "**********************";
10746+
#endif
10747+
#endif
1075310748
{
1075410749
long double v = std::nan("");
1075510750
std::ios ios(0);

0 commit comments

Comments
 (0)