tests: Don't use error.h because it's not portable
PATCH 1/1 tests: Don't use error.h because it's not portable
Sam reports that building liburing tests on Gentoo is broken due to '#include <error.h>':
```
x86_64-gentoo-linux-musl-gcc -D_GNU_SOURCE -D__SANE_USERSPACE_TYPES__ \
-I../src/include/ -include ../config-host.h -pipe -march=native \
-fno-diagnostics-color -O2 -Wno-unused-parameter -Wno-sign-compare \
-Wstringop-overflow=0 -Warray-bounds=0 -DLIBURING_BUILD_TEST -o \
single-issuer.t single-issuer.c helpers.o -Wl,-O1 -Wl,--as-needed \
-Wl,--defsym=__gentoo_check_ldflags__=0 -L../src/ -luring -lpthread
single-issuer.c:8:10: fatal error: error.h: No such file or directory
8 | #include <error.h>
| ^~~~~~~~~
```This header is a GNU extension for glibc. It doesn't exist in musl libc. Don't use error.h to make it portable.
Reported-by Sam James <[email protected]>
Signed-off-by Ammar Faizi <[email protected]>
--- test/defer-taskrun.c | 1 - test/poll.c | 7 ++++--- test/send-zerocopy.c | 1 - test/single-issuer.c | 43 ++++++++++++++++++++++++++++--------------- 4 files changed, 32 insertions(+), 20 deletions(-)
test/defer-taskrun.c +0 -1
@@ -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>
test/poll.c +4 -3
@@ -11,7 +11,6 @@#include <signal.h> #include <poll.h> #include <sys/wait.h> -#include <error.h> #include <assert.h> #include "helpers.h"
@@ -19,8 +18,10 @@static void do_setsockopt (int fd,int level,int optname,int val) { -if (setsockopt (fd, level, optname, &val,sizeof (val))) -error (1 , errno,"setsockopt %d.%d: %d" , level, optname, val); +if (setsockopt (fd, level, optname, &val,sizeof (val))) { +fprintf (stderr,"setsockopt %d.%d: %d\n" , level, optname, val); +exit (T_EXIT_FAIL ); + } }static bool check_cq_empty (struct io_uring *ring)
test/send-zerocopy.c +0 -1
@@ -4,7 +4,6 @@#include <stdint.h> #include <assert.h> #include <errno.h> -#include <error.h> #include <limits.h> #include <fcntl.h> #include <unistd.h>
test/single-issuer.c +28 -15
81 lines not on this page · raw message
base-commit: 7b09481f27fa86e8828f774ddca92ce14f14fafe
Signature · 1 line
Ammar Faizi