Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame^] | 1 | From 5b5675913e2dbe6c5acda935b5814a8991829ec5 Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Tue, 8 Nov 2022 13:31:34 -0800 |
| 4 | Subject: [PATCH 2/2] test-bus-error: strerror() is assumed to be GNU specific version mark it so |
| 5 | |
| 6 | Upstream-Status: Inappropriate [Upstream systemd only supports glibc] |
| 7 | |
| 8 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 9 | --- |
| 10 | src/libsystemd/sd-bus/test-bus-error.c | 2 ++ |
| 11 | 1 file changed, 2 insertions(+) |
| 12 | |
| 13 | --- a/src/libsystemd/sd-bus/test-bus-error.c |
| 14 | +++ b/src/libsystemd/sd-bus/test-bus-error.c |
| 15 | @@ -99,7 +99,9 @@ TEST(error) { |
| 16 | assert_se(!sd_bus_error_is_set(&error)); |
| 17 | assert_se(sd_bus_error_set_errno(&error, EBUSY) == -EBUSY); |
| 18 | assert_se(streq(error.name, "System.Error.EBUSY")); |
| 19 | +#ifdef __GLIBC__ |
| 20 | assert_se(streq(error.message, STRERROR(EBUSY))); |
| 21 | +#endif |
| 22 | assert_se(sd_bus_error_has_name(&error, "System.Error.EBUSY")); |
| 23 | assert_se(sd_bus_error_get_errno(&error) == EBUSY); |
| 24 | assert_se(sd_bus_error_is_set(&error)); |
| 25 | --- a/src/test/test-errno-util.c |
| 26 | +++ b/src/test/test-errno-util.c |
| 27 | @@ -4,7 +4,7 @@ |
| 28 | #include "stdio-util.h" |
| 29 | #include "string-util.h" |
| 30 | #include "tests.h" |
| 31 | - |
| 32 | +#ifdef __GLIBC__ |
| 33 | TEST(strerror_not_threadsafe) { |
| 34 | /* Just check that strerror really is not thread-safe. */ |
| 35 | log_info("strerror(%d) → %s", 200, strerror(200)); |
| 36 | @@ -46,5 +46,6 @@ TEST(STRERROR_OR_ELSE) { |
| 37 | log_info("STRERROR_OR_ELSE(EPERM, \"EOF\") → %s", STRERROR_OR_EOF(EPERM)); |
| 38 | log_info("STRERROR_OR_ELSE(-EPERM, \"EOF\") → %s", STRERROR_OR_EOF(-EPERM)); |
| 39 | } |
| 40 | +#endif /* __GLIBC__ */ |
| 41 | |
| 42 | DEFINE_TEST_MAIN(LOG_INFO); |