From: Murphy Zhou <jencce.kernel@gmail.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] df01.sh: put output file to tmp dir
Date: Sun, 4 Jun 2023 17:49:36 +0800 [thread overview]
Message-ID: <20230604094936.3543223-1-jencce.kernel@gmail.com> (raw)
Because the output file itself will consume disk space.
This may affects the df numbers. The chance is higher
in large block size filesystems.
Signed-off-by: Murphy Zhou <jencce.kernel@gmail.com>
---
testcases/commands/df/df01.sh | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/testcases/commands/df/df01.sh b/testcases/commands/df/df01.sh
index 5af4f68e6..919df9818 100755
--- a/testcases/commands/df/df01.sh
+++ b/testcases/commands/df/df01.sh
@@ -12,6 +12,7 @@ TST_CNT=12
TST_SETUP=setup
TST_TESTFUNC=test
TST_NEEDS_ROOT=1
+OUTPUT=$(mktemp)
setup()
{
@@ -57,15 +58,15 @@ df_test()
df_verify()
{
- $@ >output 2>&1
+ $@ >$OUTPUT 2>&1
if [ $? -ne 0 ]; then
- grep -q -E "unrecognized option | invalid option" output
+ grep -q -E "unrecognized option | invalid option" $OUTPUT
if [ $? -eq 0 ]; then
tst_res TCONF "'$@' not supported."
return 32
else
tst_res TFAIL "'$@' failed."
- cat output
+ cat $OUTPUT
return 1
fi
fi
@@ -86,12 +87,12 @@ df_check()
used=$((($used * $bsize + 512) / 1024))
fi
- grep $TST_DEVICE output | grep -q "${total}.*${used}"
+ grep $TST_DEVICE $OUTPUT | grep -q "${total}.*${used}"
if [ $? -ne 0 ]; then
echo "total: ${total}, used: ${used}"
- echo "df saved output:"
- cat output
- echo "df output:"
+ echo "df saved $OUTPUT:"
+ cat $OUTPUT
+ echo "df $OUTPUT:"
$@
return 1
fi
@@ -175,7 +176,7 @@ test12()
return
fi
- grep $TST_DEVICE output | grep -q $TST_MNTPOINT
+ grep $TST_DEVICE $OUTPUT | grep -q $TST_MNTPOINT
if [ $? -ne 0 ]; then
tst_res TPASS "'$cmd' passed."
else
@@ -185,3 +186,4 @@ test12()
. tst_test.sh
tst_run
+rm -f $OUTPUT
--
2.31.1
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next reply other threads:[~2023-06-04 9:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-04 9:49 Murphy Zhou [this message]
2023-06-06 12:55 ` [LTP] [PATCH] df01.sh: put output file to tmp dir Murphy Zhou
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230604094936.3543223-1-jencce.kernel@gmail.com \
--to=jencce.kernel@gmail.com \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).