diff options
Diffstat (limited to 'tests/ts')
-rwxr-xr-x | tests/ts/findmnt/df-options | 62 | ||||
-rwxr-xr-x | tests/ts/lsfd/mkfds-multiplexing | 16 | ||||
-rwxr-xr-x | tests/ts/lslocks/lslocks | 11 | ||||
-rwxr-xr-x | tests/ts/lsns/ioctl_ns | 6 |
4 files changed, 82 insertions, 13 deletions
diff --git a/tests/ts/findmnt/df-options b/tests/ts/findmnt/df-options new file mode 100755 index 0000000..58208b9 --- /dev/null +++ b/tests/ts/findmnt/df-options @@ -0,0 +1,62 @@ +#!/bin/bash + +# This file is part of util-linux. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +TS_TOPDIR="${0%/*}/../.." +TS_DESC="the columns enabled with -D and -I options" + +. "$TS_TOPDIR"/functions.sh +ts_init "$*" + +ts_check_test_command "$TS_CMD_FINDMNT" +ts_check_prog "head" + +ts_cd "$TS_OUTDIR" + +D_expectation="SOURCE FSTYPE SIZE USED AVAIL USE% TARGET" +I_expectation="SOURCE FSTYPE INO.TOTAL INO.USED INO.AVAIL INO.USE% TARGET" +{ + if [[ $($TS_CMD_FINDMNT --raw -D | head -1) == "$D_expectation" ]]; then + echo "-D: OK" + else + echo "-D: ERROR" + $TS_CMD_FINDMNT --raw -D + echo $? + fi + + if [[ $($TS_CMD_FINDMNT --raw -I | head -1) == "$I_expectation" ]]; then + echo "-I: OK" + else + echo "-I: ERROR" + $TS_CMD_FINDMNT --raw -I + echo $? + fi + + if [[ $($TS_CMD_FINDMNT --raw --df | head -1) == "$D_expectation" ]]; then + echo "--df: OK" + else + echo "--df: ERROR" + $TS_CMD_FINDMNT --raw --df + echo $? + fi + + if [[ $($TS_CMD_FINDMNT --raw --dfi | head -1) == "$I_expectation" ]]; then + echo "--dfi: OK" + else + echo "--dfi: ERROR" + $TS_CMD_FINDMNT --raw --dfi + echo $? + fi +} >> "$TS_OUTPUT" 2>> "$TS_ERRLOG" + +ts_finalize diff --git a/tests/ts/lsfd/mkfds-multiplexing b/tests/ts/lsfd/mkfds-multiplexing index 8cc7f31..a53f6eb 100755 --- a/tests/ts/lsfd/mkfds-multiplexing +++ b/tests/ts/lsfd/mkfds-multiplexing @@ -26,6 +26,8 @@ ts_check_test_command "$TS_HELPER_MKFDS" # /proc/${PID}/syscall is rendered in the host side byteorder. ts_skip_qemu_user +ts_check_prog "cat" +ts_check_prog "cut" ts_check_prog "grep" ts_cd "$TS_OUTDIR" @@ -44,12 +46,24 @@ for multiplexer in pselect6 select poll ppoll; do } > "$TS_OUTPUT" 2>&1 if read -r -u "${MKFDS[0]}" PID; then - if ! cat /proc/"${PID}"/syscall > /dev/null 2>&1; then + syscall_line=$(cat /proc/"${PID}"/syscall 2>> "$TS_OUTPUT") + syscall_status=$? + if [[ "$syscall_status" != 0 ]]; then kill -CONT "${PID}" wait "${MKFDS_PID}" ts_skip_subtest "cannot open /proc/${PID}/syscall" continue fi + syscall_n=$(cut -f1 -d' ' <<< "$syscall_line") + # We assume the syscall number for the $multiplexer is not zero + # on any platforms. + if [[ "$syscall_n" == 0 ]]; then + kill -CONT "${PID}" + wait "${MKFDS_PID}" + ts_skip_subtest "incorrect syscall number in /proc/${PID}/syscall" + continue + fi + { "${TS_CMD_LSFD}" -n -o ASSOC,XMODE -p "${PID}" -Q '(FD >= 10) && (FD <= 22)' echo "[$multiplexer] ASSOC,XMODE: $?" diff --git a/tests/ts/lslocks/lslocks b/tests/ts/lslocks/lslocks index 912fac8..a9ef69a 100755 --- a/tests/ts/lslocks/lslocks +++ b/tests/ts/lslocks/lslocks @@ -53,14 +53,6 @@ OFD_METHODS=( lease-w ) -SLEEP() -{ - # It appears that there is a time lag between locking and its - # visibility in /proc/locks. See the unstbale results of errors I - # observed in https://github.com/util-linux/util-linux/pull/2629. - sleep 1 -} - DFD=18 COLS_WITH_HOLDERS=COMMAND,TYPE,SIZE,MODE,START,END,HOLDERS run_lslocks() @@ -71,8 +63,6 @@ run_lslocks() rm -f "${FILE}" coproc MKFDS { "$TS_HELPER_MKFDS" make-regular-file $FD file="$FILE" lock=$m; } if read -r -u "${MKFDS[0]}" PID; then - SLEEP - "$TS_CMD_LSLOCKS" ${OPTS} --pid "${PID}" -o "${COLS}" echo "# $m + ${COLS} + ${OPTS}": $? "$TS_CMD_LSLOCKS" ${OPTS} --pid "${PID}" -o PATH | sed -e 's#.*\('"$FILE0"'\)--[0-9]\+ *$#\1#' @@ -91,7 +81,6 @@ run_lslocks_with_co_holders() { rm -f "${FILE}" coproc MKFDS { "$TS_HELPER_MKFDS" make-regular-file $FD file="$FILE" lock=$m dupfd=$DFD; } - SLEEP if read -r -u "${MKFDS[0]}" PID; then "$TS_CMD_LSLOCKS" ${OPTS} --pid "${PID}" -o "${COLS_WITH_HOLDERS}" | sed -e "s/${PID},/1,/g" echo "# $m + ${COLS_WITH_HOLDERS} + ${OPTS}": ${PIPESTATUS[0]} diff --git a/tests/ts/lsns/ioctl_ns b/tests/ts/lsns/ioctl_ns index 6f306d5..7ab192b 100755 --- a/tests/ts/lsns/ioctl_ns +++ b/tests/ts/lsns/ioctl_ns @@ -80,6 +80,8 @@ init echo echo userns expected: "$expected" echo userns actual: "$actual" + echo "$TS_CMD_LSNS": + LSNS_DEBUG=all "$TS_CMD_LSNS" cleanup exit $RESULT fi @@ -92,10 +94,12 @@ init echo echo pidns expected: "$expected" echo pidns actual: "$actual" + echo "$TS_CMD_LSNS": + LSNS_DEBUG=all "$TS_CMD_LSNS" cleanup fi exit $RESULT -) & +) >> $TS_ERRLOG 2>&1 & mainpid=$! ( exec 4< $FIFO_WAIT |