From 439b01551fdf038d5ae550eb53cf95adeed1235b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Thomas=20Wei=C3=9Fschuh?= Date: Sun, 16 Apr 2023 10:16:33 +0200 Subject: [PATCH] fadvise: (tests) add helper to create files MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Thomas Weißschuh --- tests/ts/fadvise/drop | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/tests/ts/fadvise/drop b/tests/ts/fadvise/drop index e8c0071915..142fbf028b 100755 --- a/tests/ts/fadvise/drop +++ b/tests/ts/fadvise/drop @@ -18,33 +18,37 @@ FILE="ddtest" BS=4k COUNT=8 -{ +create_file() { dd if=/dev/zero of="$FILE" bs=$BS count=$COUNT >& /dev/null +} + +{ + create_file "$TS_CMD_FINCORE" "$FILE" echo - dd if=/dev/zero of="$FILE" bs=$BS count=$COUNT >& /dev/null + create_file echo "whole file" "$TS_CMD_FADVISE" "$FILE" echo status: $? "$TS_CMD_FINCORE" "$FILE" echo - dd if=/dev/zero of="$FILE" bs=$BS count=$COUNT >& /dev/null + create_file echo "offset: 8192" "$TS_CMD_FADVISE" -o 8192 "$FILE" echo status: $? "$TS_CMD_FINCORE" "$FILE" echo - dd if=/dev/zero of="$FILE" bs=$BS count=$COUNT >& /dev/null + create_file echo "length: 16384" "$TS_CMD_FADVISE" -l 16384 "$FILE" echo status: $? "$TS_CMD_FINCORE" "$FILE" echo - dd if=/dev/zero of="$FILE" bs=$BS count=$COUNT >& /dev/null + create_file echo "offset: 8192, length: 16384 fd: 42" "$TS_CMD_FADVISE" -o 8192 -l 16384 --fd 42 42<"$FILE" echo status: $? -- 2.47.2