]> git.ipfire.org Git - thirdparty/util-linux.git/blame - tests/ts/lsfd/column-ainodeclass
tests: (lsfd) skip if the platform doesn't provide pidfd_open(2)
[thirdparty/util-linux.git] / tests / ts / lsfd / column-ainodeclass
CommitLineData
4cd4ed18
MY
1#!/bin/bash
2#
3# Copyright (C) 2022 Masatake YAMATO <yamato@redhat.com>
4#
5# This file is part of util-linux.
6#
7# This file is free software; you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation; either version 2 of the License, or
10# (at your option) any later version.
11#
12# This file is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU General Public License for more details.
16#
17TS_TOPDIR="${0%/*}/../.."
18TS_DESC="ainodeclass column"
19
7e51ea86 20. "$TS_TOPDIR"/functions.sh
4cd4ed18
MY
21ts_init "$*"
22
3de730ad 23. "$TS_SELF/lsfd-functions.bash"
4cd4ed18
MY
24ts_check_test_command "$TS_CMD_LSFD"
25ts_check_test_command "$TS_HELPER_MKFDS"
26
27ts_cd "$TS_OUTDIR"
28
29PID=
30FD=3
31EXPR="(FD == 3)"
32
3de730ad
MY
33for C in pidfd inotify; do
34 ts_init_subtest $C
35 {
4cd4ed18 36 coproc MKFDS { "$TS_HELPER_MKFDS" $C $FD ; }
7e51ea86 37 if read -r -u "${MKFDS[0]}" PID; then
be019f66
MY
38 ${TS_CMD_LSFD} -n -o ASSOC,STTYPE,AINODECLASS -p "${PID}" -Q "${EXPR}"
39 echo "$C"':ASSOC,STTYPE,AINODECLASS': $?
4cd4ed18 40
7e51ea86 41 kill -CONT "${PID}"
4cd4ed18 42 fi
ffc7662e 43 wait "${MKFDS_PID}"
3de730ad
MY
44 } > "$TS_OUTPUT" 2>&1
45 if [ "$C-$?" == "pidfd-$ENOSYS" ]; then
46 ts_skip_subtest "pidfd_open(2) is not available"
47 continue
48 fi
49 ts_finalize_subtest
50done
4cd4ed18
MY
51
52ts_finalize