diff options
author | Florian Schmaus <flow@gentoo.org> | 2023-02-14 10:31:45 +0100 |
---|---|---|
committer | Florian Schmaus <flow@gentoo.org> | 2023-02-14 10:43:02 +0100 |
commit | a64761335b231d170720819e773fee9199f8044b (patch) | |
tree | 75914317bd25edce38d0386e1e689f7459843e03 /sys-libs/liburing | |
parent | www-client/vivaldi-snapshot: Drop old 5.7.2921.29 (diff) | |
download | gentoo-a64761335b231d170720819e773fee9199f8044b.tar.gz gentoo-a64761335b231d170720819e773fee9199f8044b.tar.bz2 gentoo-a64761335b231d170720819e773fee9199f8044b.zip |
sys-libs/liburing: backport musl patch, enable tests
Bug: https://bugs.gentoo.org/888956
Signed-off-by: Florian Schmaus <flow@gentoo.org>
Diffstat (limited to 'sys-libs/liburing')
-rw-r--r-- | sys-libs/liburing/files/liburing-2.3-remove-error-from-error_h-for-portability.patch | 140 | ||||
-rw-r--r-- | sys-libs/liburing/liburing-2.3-r3.ebuild (renamed from sys-libs/liburing/liburing-2.3-r2.ebuild) | 20 |
2 files changed, 158 insertions, 2 deletions
diff --git a/sys-libs/liburing/files/liburing-2.3-remove-error-from-error_h-for-portability.patch b/sys-libs/liburing/files/liburing-2.3-remove-error-from-error_h-for-portability.patch new file mode 100644 index 000000000000..6af48d08aab0 --- /dev/null +++ b/sys-libs/liburing/files/liburing-2.3-remove-error-from-error_h-for-portability.patch @@ -0,0 +1,140 @@ +From 11dc64a71558948aef16730cb363e7e5da773a5b Mon Sep 17 00:00:00 2001 +From: Steffen <steffen.winter@proton.me> +Date: Mon, 13 Feb 2023 17:32:16 +0100 +Subject: [PATCH 1/3] Add custom error function for tests. + +On musl systems, liburing cannot build examples and tests due to +it's usage of error.h. t_error calls fprintf(stderr, ...) and +exits. + +Closes: #786 + +Signed-off-by: Steffen Winter <steffen.winter@proton.me> +--- 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> +@@ -300,3 +301,20 @@ unsigned __io_uring_flush_sq(struct io_uring *ring) + */ + return tail - *sq->khead; + } ++ ++/* ++ * 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); ++} +--- a/test/helpers.h ++++ b/test/helpers.h +@@ -89,6 +89,8 @@ unsigned __io_uring_flush_sq(struct io_uring *ring); + + #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) + ++void t_error(int status, int errnum, const char *format, ...); ++ + #ifdef __cplusplus + } + #endif + +From 3b0b4976d7da2e4616fe860fb7a8e52d88d4523b Mon Sep 17 00:00:00 2001 +From: Steffen <steffen.winter@proton.me> +Date: Mon, 13 Feb 2023 17:56:03 +0100 +Subject: [PATCH 2/3] test: Use t_error instead of glibc's error. + +On musl systems, liburing cannot build examples and tests due to +it's usage of error.h. Replacing calls to error() with t_error(). + +Closes: #786 + +Signed-off-by: Steffen Winter <steffen.winter@proton.me> +--- a/test/defer-taskrun.c ++++ b/test/defer-taskrun.c +@@ -4,7 +4,6 @@ + #include <unistd.h> + #include <stdlib.h> + #include <string.h> +-#include <error.h> + #include <sys/eventfd.h> + #include <signal.h> + #include <poll.h> +--- a/test/single-issuer.c ++++ b/test/single-issuer.c +@@ -5,7 +5,6 @@ + #include <stdlib.h> + #include <string.h> + #include <fcntl.h> +-#include <error.h> + #include <sys/types.h> + #include <sys/wait.h> + +@@ -56,13 +55,13 @@ static int try_submit(struct io_uring *ring) + return ret; + + if (ret != 1) +- error(1, ret, "submit %i", ret); ++ t_error(1, ret, "submit %i", ret); + ret = io_uring_wait_cqe(ring, &cqe); + if (ret) +- error(1, ret, "wait fail %i", ret); ++ t_error(1, ret, "wait fail %i", ret); + + if (cqe->res || cqe->user_data != 42) +- error(1, ret, "invalid cqe"); ++ t_error(1, ret, "invalid cqe"); + + io_uring_cqe_seen(ring, cqe); + return 0; +@@ -105,7 +104,7 @@ int main(int argc, char *argv[]) + ret = io_uring_queue_init(8, &ring, IORING_SETUP_SINGLE_ISSUER | + IORING_SETUP_R_DISABLED); + if (ret) +- error(1, ret, "ring init (2) %i", ret); ++ t_error(1, ret, "ring init (2) %i", ret); + + if (!fork_t()) { + io_uring_enable_rings(&ring); +@@ -121,7 +120,7 @@ int main(int argc, char *argv[]) + ret = io_uring_queue_init(8, &ring, IORING_SETUP_SINGLE_ISSUER | + IORING_SETUP_R_DISABLED); + if (ret) +- error(1, ret, "ring init (3) %i", ret); ++ t_error(1, ret, "ring init (3) %i", ret); + + io_uring_enable_rings(&ring); + if (!fork_t()) { +@@ -136,7 +135,7 @@ int main(int argc, char *argv[]) + /* test that anyone can submit to a SQPOLL|SINGLE_ISSUER ring */ + ret = io_uring_queue_init(8, &ring, IORING_SETUP_SINGLE_ISSUER|IORING_SETUP_SQPOLL); + if (ret) +- error(1, ret, "ring init (4) %i", ret); ++ t_error(1, ret, "ring init (4) %i", ret); + + ret = try_submit(&ring); + if (ret) { +@@ -156,7 +155,7 @@ int main(int argc, char *argv[]) + /* test that IORING_ENTER_REGISTERED_RING doesn't break anything */ + ret = io_uring_queue_init(8, &ring, IORING_SETUP_SINGLE_ISSUER); + if (ret) +- error(1, ret, "ring init (5) %i", ret); ++ t_error(1, ret, "ring init (5) %i", ret); + + if (!fork_t()) { + ret = try_submit(&ring); + diff --git a/sys-libs/liburing/liburing-2.3-r2.ebuild b/sys-libs/liburing/liburing-2.3-r3.ebuild index 2140c9daaf91..f599513579c9 100644 --- a/sys-libs/liburing/liburing-2.3-r2.ebuild +++ b/sys-libs/liburing/liburing-2.3-r3.ebuild @@ -19,7 +19,7 @@ SLOT="0/2" # liburing.so major version IUSE="examples static-libs test" # fsync test hangs forever -RESTRICT="test !test? ( test )" +RESTRICT="!test? ( test )" # At least installed headers need <linux/*>, bug #802516 DEPEND=">=sys-kernel/linux-headers-5.1" @@ -28,6 +28,8 @@ RDEPEND="${DEPEND}" PATCHES=( # https://bugs.gentoo.org/891633 "${FILESDIR}/${PN}-2.3-liburing.map-Export-io_uring_-enable_rings-register_.patch" + # https://github.com/axboe/liburing/pull/787 + "${FILESDIR}/${PN}-2.3-remove-error-from-error_h-for-portability.patch" ) src_prepare() { @@ -75,5 +77,19 @@ multilib_src_install_all() { } multilib_src_test() { - emake V=1 runtests + local disabled_tests=( + accept.c + fpos.c + io_uring_register.c + link-timeout.c + read-before-exit.c + recv-msgall-stream.c + ) + local disabled_test + for disabled_test in "${disabled_tests[@]}"; do + sed -i "/\s*${disabled_test}/d" test/Makefile \ + || die "Failed to remove ${disabled_test}" + done + + emake -C test V=1 runtests } |