From da74e6e5c826597f1b7dcee19c01af52b44bcf9b Mon Sep 17 00:00:00 2001 From: Masatake YAMATO Date: Sun, 26 Feb 2023 01:33:17 +0900 Subject: [PATCH] tests: (lsfd) skip if the platform doesn't attach a buffer to a packet socket Signed-off-by: Masatake YAMATO --- tests/helpers/test_mkfds.c | 3 ++- tests/ts/lsfd/mkfds-mapped-packet-socket | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/helpers/test_mkfds.c b/tests/helpers/test_mkfds.c index 6903b9e725..694c51693e 100644 --- a/tests/helpers/test_mkfds.c +++ b/tests/helpers/test_mkfds.c @@ -692,7 +692,8 @@ static void *make_mmapped_packet_socket(const struct factory *factory, struct fd int e = errno; close(sd); errno = e; - err(EXIT_FAILURE, "failed to specify a buffer spec to a packet socket"); + err((errno == ENOPROTOOPT? EXIT_ENOPROTOOPT: EXIT_FAILURE), + "failed to specify a buffer spec to a packet socket"); } munmap_data = malloc(sizeof (*munmap_data)); diff --git a/tests/ts/lsfd/mkfds-mapped-packet-socket b/tests/ts/lsfd/mkfds-mapped-packet-socket index 1f705aecb4..1ee61d5d97 100755 --- a/tests/ts/lsfd/mkfds-mapped-packet-socket +++ b/tests/ts/lsfd/mkfds-mapped-packet-socket @@ -20,7 +20,6 @@ TS_DESC="mmap'ed AF_PACKET socket" . "$TS_TOPDIR"/functions.sh ts_init "$*" ts_skip_nonroot -ts_skip_qemu_user . "$TS_SELF"/lsfd-functions.bash @@ -47,4 +46,8 @@ INTERFACE=lo wait ${MKFDS_PID} } > $TS_OUTPUT 2>&1 +if [[ $? == "$ENOPROTOOPT" ]]; then + ts_skip "packet socket doesn't support attaching a buffer on this platform" +fi + ts_finalize -- 2.47.3