diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-14 19:33:32 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-14 19:33:32 +0000 |
commit | 8bb05ac73a5b448b339ce0bc8d396c82c459b47f (patch) | |
tree | 1fdda006866bca20d41cb206767ea5241e36852f /tests/ts/lsfd/lsfd-functions.bash | |
parent | Adding debian version 2.39.3-11. (diff) | |
download | util-linux-8bb05ac73a5b448b339ce0bc8d396c82c459b47f.tar.xz util-linux-8bb05ac73a5b448b339ce0bc8d396c82c459b47f.zip |
Merging upstream version 2.40.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ts/lsfd/lsfd-functions.bash')
-rw-r--r-- | tests/ts/lsfd/lsfd-functions.bash | 44 |
1 files changed, 40 insertions, 4 deletions
diff --git a/tests/ts/lsfd/lsfd-functions.bash b/tests/ts/lsfd/lsfd-functions.bash index d9a3595..3a3f58f 100644 --- a/tests/ts/lsfd/lsfd-functions.bash +++ b/tests/ts/lsfd/lsfd-functions.bash @@ -16,11 +16,11 @@ # # The exit-status used in a test target. -readonly ENOSYS=17 readonly EPERM=18 readonly ENOPROTOOPT=19 readonly EPROTONOSUPPORT=20 -readonly EACCESS=21 +readonly EACCES=21 +readonly ENOENT=22 function lsfd_wait_for_pausing { ts_check_prog "sleep" @@ -59,7 +59,7 @@ function lsfd_compare_dev { fi } -lsfd_strip_type_stream() +function lsfd_strip_type_stream { # lsfd changes the output of NAME column for a unix stream socket # whether the kernel reports it is a "UNIX-STREAM" socket or a @@ -68,7 +68,7 @@ lsfd_strip_type_stream() sed -e 's/ type=stream//' } -lsfd_make_state_connected() +function lsfd_make_state_connected { # Newer kernels report the states of unix dgram sockets created by # sockerpair(2) are "connected" via /proc/net/unix though Older @@ -83,3 +83,39 @@ lsfd_make_state_connected() # to that on newer kernels. sed -e 's/state=unconnected/state=connected/' } + +function lsfd_check_mkfds_factory +{ + local FACTORY=$1 + + ts_check_test_command "$TS_HELPER_MKFDS" + if ! "$TS_HELPER_MKFDS" --is-available "$FACTORY"; then + ts_skip "test_mkfds has no factory for $FACTORY" + fi +} + +function lsfd_check_sockdiag +{ + local family=$1 + + ts_check_test_command "$TS_HELPER_MKFDS" + + local msg + local err + + msg=$("$TS_HELPER_MKFDS" -c sockdiag 9 family=$family 2>&1) + err=$? + + case $err in + 0) + return;; + $EPROTONOSUPPORT) + ts_skip "NETLINK_SOCK_DIAG protocol is not supported in socket(2)";; + $EACCES) + ts_skip "sending a msg via a sockdiag netlink socket is not permitted";; + $ENOENT) + ts_skip "sockdiag netlink socket is not available";; + *) + ts_failed "failed to create a sockdiag netlink socket $family ($err): $msg";; + esac +} |