From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] commans/sar: Add new testcases for sar
Date: Mon, 26 Oct 2015 17:08:52 +0100 [thread overview]
Message-ID: <20151026160852.GC6772@rei> (raw)
In-Reply-To: <1445562528-228220-1-git-send-email-cuibixuan@huawei.com>
Hi!
> +TCID=sar01
> +TST_TOTAL=19
> +. test.sh
> +
> +setup()
> +{
> + tst_check_cmds sar
> +
> + tst_tmpdir
> +}
> +
> +cleanup()
> +{
> + tst_rmdir
> +}
> +
> +sar_test()
> +{
> + $1 >${TCID}.temp 2>&1
Since we call tst_tmpdir() in setup we are guaranteed to be executed in
unique temorary directory. So we can just do:
$1 >temp 2>&1
And we do not need to worry about some other test rewriting our file.
> + if [ $? -ne 0 ]; then
> + tst_resm TFAIL "'$1' failed."
> + return
> + fi
> +
> + grep $2 ${TCID}.temp >/dev/null
Grep has -q (quiet) switch.
> + if [ $? -eq 0 ]; then
> + tst_resm TPASS "'$1' passed."
> + else
> + tst_resm TFAIL "'$1' failed."
> + fi
Grepping one word is pretty loose criteria for pass/fail for a program
that actually prints several pages of statistics.
A few things that can be done here are:
* Number of cpus is detected correctly
* The CPU load sums to 100%
More complicated tests can also do:
* Run a program with bussy loop on a background and check that
it consumes CPU cycles (load at least 100/NCPU over all cpus)
* Run a program that reads and writes files on background
and check that corresponding I/O statistics are reasonable
* ...
Getting this right would require substantial amount of effort, but
as this test is now it's not much useful as it would pass even if sar
was broken really badly.
--
Cyril Hrubis
chrubis@suse.cz
next prev parent reply other threads:[~2015-10-26 16:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-23 1:08 [LTP] [PATCH] commans/sar: Add new testcases for sar Cui Bixuan
2015-10-26 16:08 ` Cyril Hrubis [this message]
2015-10-28 3:56 ` Cui Bixuan
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=20151026160852.GC6772@rei \
--to=chrubis@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.