Something went wrong. Try again.
What happens if I push all of nixpkgs
Something went wrong. Try again.
1.6 kB · 66 lines
at litex
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667From d4714fd7aac9c5f499c406703bc437dc6cf72ef3 Mon Sep 17 00:00:00 2001From: Steffen <steffen.winter@proton.me>Date: Mon, 13 Feb 2023 17:32:16 +0100Subject: [PATCH 1/3] Add custom error function for tests.
On musl systems, liburing cannot build examples and tests due toit's usage of error.h. t_error calls fprintf(stderr, ...) andexits.
Closes: #786
Signed-off-by: Steffen Winter <steffen.winter@proton.me>--- test/helpers.c | 18 ++++++++++++++++++ test/helpers.h | 2 ++ 2 files changed, 20 insertions(+)
diff --git a/test/helpers.c b/test/helpers.cindex 8fb32b8..caa887e 100644--- a/test/helpers.c+++ b/test/helpers.c@@ -8,6 +8,7 @@ #include <stdio.h> #include <fcntl.h> #include <unistd.h>+#include <stdarg.h> #include <sys/types.h> #include <arpa/inet.h>@@ -266,3 +267,20 @@ bool t_probe_defer_taskrun(void) io_uring_queue_exit(&ring); return true; }++/*+ * Implementation of error(3), prints an error message and exits.+ */+void t_error(int status, int errnum, const char *format, ...)+{+ va_list args;+ va_start(args, format);++ vfprintf(stderr, format, args);+ if (errnum)+ fprintf(stderr, ": %s", strerror(errnum));++ fprintf(stderr, "\n");+ va_end(args);+ exit(status);+}diff --git a/test/helpers.h b/test/helpers.hindex 4375a9e..33b82cf 100644--- a/test/helpers.h+++ b/test/helpers.h@@ -87,6 +87,8 @@ bool t_probe_defer_taskrun(void); #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) +void t_error(int status, int errnum, const char *format, ...);+ #ifdef __cplusplus } #endif-- 2.39.1