diff mbox series

[hurd,commited] stdio-common: Fix %m sprintf test output for GNU/Hurd

Message ID 20211227202327.2980613-1-samuel.thibault@ens-lyon.org
State New
Headers show
Series [hurd,commited] stdio-common: Fix %m sprintf test output for GNU/Hurd | expand

Commit Message

Samuel Thibault Dec. 27, 2021, 8:23 p.m. UTC
GNU/Hurd has slightly different error messages for undefined numbers,
due to the notion of error subsystems.
---
 stdio-common/tst-sprintf-errno.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
diff mbox series

Patch

diff --git a/stdio-common/tst-sprintf-errno.c b/stdio-common/tst-sprintf-errno.c
index 7622fdbc48..f5b587f0fe 100644
--- a/stdio-common/tst-sprintf-errno.c
+++ b/stdio-common/tst-sprintf-errno.c
@@ -48,16 +48,26 @@  do_test (void)
   TEST_COMPARE_STRING (buf, "0");
 
   errno = -1;
+#ifdef __GNU__
+  TEST_COMPARE (sprintf (buf, "%m"), 35);
+  TEST_COMPARE_STRING (buf, "Error in unknown error system: : -1");
+#else
   TEST_COMPARE (sprintf (buf, "%m"), 16);
   TEST_COMPARE_STRING (buf, "Unknown error -1");
+#endif
 
   errno = -1;
   TEST_COMPARE (sprintf (buf, "%#m"), 2);
   TEST_COMPARE_STRING (buf, "-1");
 
   errno = 1002003;
+#ifdef __GNU__
+  TEST_COMPARE (sprintf (buf, "%m"), 42);
+  TEST_COMPARE_STRING (buf, "(system kern) error with unknown subsystem");
+#else
   TEST_COMPARE (sprintf (buf, "%m"), 21);
   TEST_COMPARE_STRING (buf, "Unknown error 1002003");
+#endif
 
   errno = 1002003;
   TEST_COMPARE (sprintf (buf, "%#m"), 7);