From: Petr Vorel <pvorel@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] lsmod01.sh: retry test couple times to lower false positives
Date: Wed, 23 Oct 2019 14:19:03 +0200 [thread overview]
Message-ID: <20191023121901.GA25868@dell5510> (raw)
In-Reply-To: <c8843f2f4a325e820d030d9c7c36d7624f1baa82.1571393044.git.jstancek@redhat.com>
Hi Jan,
...
> -lsmod_test()
> +lsmod_matches_proc_modules()
> {
> lsmod_output=$(lsmod | awk '!/Module/{print $1, $2, $3}' | sort)
> if [ -z "$lsmod_output" ]; then
> - tst_res TFAIL "Failed to parse the output from lsmod"
> - return
> + tst_brk TBROK "Failed to parse the output from lsmod"
> fi
> - modules_output=$(awk '{print $1, $2, $3}' /proc/modules | sort)
> + modules_output=$(awk '{print $1, $2, $3} 1' /proc/modules | sort)
> if [ -z "$modules_output" ]; then
> - tst_res TFAIL "Failed to parse /proc/modules"
> - return
> + tst_brk TBROK "Failed to parse /proc/modules"
> fi
> if [ "$lsmod_output" != "$modules_output" ]; then
> - tst_res TFAIL "lsmod output different from /proc/modules."
> + tst_res TINFO "lsmod output different from /proc/modules."
> echo "$lsmod_output" > temp1
> echo "$modules_output" > temp2
> diff temp1 temp2
> - return
> + return 1
> fi
> + return 0
> +}
> - tst_res TPASS "'lsmod' passed."
> +lsmod_test()
> +{
> + for i in $(seq 1 5); do
> + if lsmod_matches_proc_modules; then
> + tst_res TPASS "'lsmod' passed."
> + return
> + fi
> + tst_res TINFO "Trying again"
> + sleep 1
> + done
This is similar pattern to TST_RETRY_FUNC()/TST_RETRY_FN_EXP_BACKOFF()
(for both shell and C). I wonder if we also have use for TPASS/TFAIL
instead of just TBROK and specifying number of tries instead of time to be
setup.
C and shell usage is a bit different, so maybe
TST_RETRY_FUNC()/TST_RETRY_FN_EXP_BACKOFF() doesn't make much sense for shell
(actually nothing uses them in shell) and I don't see much usage for my proposal
in C.
> + tst_res TFAIL "'lsmod' doesn't match /proc/modules output"
+ we forget to use local (for lsmod_outputa and i), but that's not that
important.
Kind regards,
Petr
next prev parent reply other threads:[~2019-10-23 12:19 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-18 10:05 [LTP] [PATCH] lsmod01.sh: retry test couple times to lower false positives Jan Stancek
2019-10-18 13:23 ` Petr Vorel
2019-10-18 13:27 ` Jan Stancek
2019-10-18 13:45 ` Petr Vorel
2019-10-22 7:10 ` Jan Stancek
2019-10-23 12:19 ` Petr Vorel [this message]
2019-10-23 13:28 ` Jan Stancek
2019-10-23 18:28 ` Petr Vorel
2019-10-24 4:47 ` Li Wang
2019-10-24 7:49 ` Petr Vorel
2019-10-24 7:12 ` Jan Stancek
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=20191023121901.GA25868@dell5510 \
--to=pvorel@suse.cz \
--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