From cb233a3e03a113245aeb83147974485bff8fabf4 Mon Sep 17 00:00:00 2001 From: Masatake YAMATO Date: Sun, 18 Jun 2023 23:40:01 +0900 Subject: [PATCH] test: (lsfd) add a subcase for testing NAME column for a deleted file Signed-off-by: Masatake YAMATO --- tests/expected/lsfd/column-name-deleted-file | 2 ++ tests/ts/lsfd/column-name | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 tests/expected/lsfd/column-name-deleted-file diff --git a/tests/expected/lsfd/column-name-deleted-file b/tests/expected/lsfd/column-name-deleted-file new file mode 100644 index 0000000000..de33c8b167 --- /dev/null +++ b/tests/expected/lsfd/column-name-deleted-file @@ -0,0 +1,2 @@ +tmp-column-name +make-regular-file: DELETED,NAME: 0 diff --git a/tests/ts/lsfd/column-name b/tests/ts/lsfd/column-name index 5dc491ab3b..0cac74bdea 100755 --- a/tests/ts/lsfd/column-name +++ b/tests/ts/lsfd/column-name @@ -71,4 +71,20 @@ for C in ro-regular-file pidfd socketpair; do ts_finalize_subtest done +C=make-regular-file +ts_init_subtest deleted-file +{ + target=tmp-column-name + coproc MKFDS { "$TS_HELPER_MKFDS" $C $FD file=tmp-column-name delete=1; } + if read -r -u "${MKFDS[0]}" PID; then + ${TS_CMD_LSFD} -n -o DELETED,NAME -p "${PID}" -Q "${EXPR}" | + sed -e 's#.*/\([^/]\+\)#\1#' + echo "$C: DELETED,NAME: " ${PIPESTATUS[0]} + + kill -CONT "${PID}" + fi +} > "$TS_OUTPUT" 2>&1 +wait "${MKFDS_PID}" +ts_finalize_subtest + ts_finalize -- 2.47.3