* [LTP] [PATCH] df01.sh: put output file to tmp dir
@ 2023-06-04 9:49 Murphy Zhou
2023-06-06 12:55 ` Murphy Zhou
0 siblings, 1 reply; 2+ messages in thread
From: Murphy Zhou @ 2023-06-04 9:49 UTC (permalink / raw)
To: ltp
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [LTP] [PATCH] df01.sh: put output file to tmp dir
2023-06-04 9:49 [LTP] [PATCH] df01.sh: put output file to tmp dir Murphy Zhou
@ 2023-06-06 12:55 ` Murphy Zhou
0 siblings, 0 replies; 2+ messages in thread
From: Murphy Zhou @ 2023-06-06 12:55 UTC (permalink / raw)
To: ltp
Please ignore this. I read it wrong.
On Sun, Jun 4, 2023 at 5:49 PM Murphy Zhou <jencce.kernel@gmail.com> wrote:
>
> 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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-06-06 12:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-04 9:49 [LTP] [PATCH] df01.sh: put output file to tmp dir Murphy Zhou
2023-06-06 12:55 ` Murphy Zhou
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).