From: Fam Zheng <famz@redhat.com>
To: John Snow <jsnow@redhat.com>
Cc: kwolf@redhat.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 3/4] iotests: add timestamp skip feature
Date: Thu, 28 May 2015 11:30:11 +0800 [thread overview]
Message-ID: <20150528033011.GB6975@dhcp-14-238.nay.redhat.com> (raw)
In-Reply-To: <1432325832-12887-4-git-send-email-jsnow@redhat.com>
On Fri, 05/22 16:17, John Snow wrote:
> Like a makefile, try to skip tests if we know they have already been
> executed using the current set of external dependencies.
>
> If a user passes the -ts option to ./check, if a test or its output
> or its dependencies (qemu, qemu-nbd, qemu-io, qemu-img,
> socket-scm-helper) have been modified, the test will be skipped.
>
> This is primarily to speed up running bisectability tests for larger
> series where each interim patch may or may not change all of the
> dependencies, so some tests can be skipped.
>
> Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
> ---
> tests/qemu-iotests/check | 56 ++++++++++++++++++++++++++++++++++++++++++++++-
> tests/qemu-iotests/common | 6 +++++
> 2 files changed, 61 insertions(+), 1 deletion(-)
>
> diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check
> index baeae80..0db40e2 100755
> --- a/tests/qemu-iotests/check
> +++ b/tests/qemu-iotests/check
> @@ -141,6 +141,51 @@ _timestamp()
> echo -n " [$now]"
> }
>
> +_okfile()
> +{
> + echo "ts/${IMGPROTO}/${IMGFMT}/${1}.ok"
> +}
> +
> +# _hasdep <seq> <dep>
> +_hasdep()
> +{
> + grep -q "^${1}.*${2}" "${source_iotests}/group"
> +}
> +
> +# _skippable <seq>
> +_skippable()
> +{
> + tsfile=$(_okfile "${1}")
> + deps=(${QEMU_IMG} \
> + ${QEMU_IO} \
> + "${source_iotests}/${1}" \
> + "${source_iotests}/${1}.out" \
> + "${source_iotests}/common" \
> + "${source_iotests}/common.rc" \
> + "${source_iotests}/common.env" \
> + "${source_iotests}/common.config")
> +
> + if _hasdep "${1}" "scm"; then
> + deps+=("${SOCKET_SCM_HELPER}")
> + fi
> +
> + if _hasdep "${1}" "nbd" || [ "$IMGPROTO" = "nbd" ]; then
> + deps+=("${QEMU_NBD}")
> + fi
> +
> + if _hasdep "${1}" "qemu"; then
> + deps+=("${QEMU}")
> + fi
> +
> + if [ ! -e "${tsfile}" ]; then return 1; fi
> + for dep in "${deps[@]}"; do
> + if [ "${tsfile}" -ot "${dep}" ]; then return 1; fi
> + done
> +
> + # Looks skippable, .ok file is newer than all external dependencies.
> + return 0
> +}
> +
> _wrapup()
> {
> # for hangcheck ...
> @@ -268,6 +313,10 @@ do
> echo " - expunged"
> rm -f $seq.out.bad
> echo "/^$seq\$/d" >>$tmp.expunged
> +
> + elif [ "${ts_skip}" == "true" ] && _skippable "${seq}"; then
> + echo " [skip] (Results are recent)"
> +
> elif [ ! -f "$source_iotests/$seq" ]
> then
> echo " - no such test?"
> @@ -275,7 +324,8 @@ do
> else
> # really going to try and run this one
> #
> - rm -f $seq.out.bad
> + tsfile="$(_okfile ${seq})"
> + rm -f $seq.out.bad "${tsfile}"
> lasttime=`sed -n -e "/^$seq /s/.* //p" <check.time`
> if [ "X$lasttime" != X ]; then
> echo -n " ${lasttime}s ..."
> @@ -340,6 +390,10 @@ do
> then
> :
> else
> + if [ ! -d "$(dirname ${tsfile})" ]; then
> + mkdir -p "$(dirname ${tsfile})"
> + fi
> + touch "${tsfile}"
> echo "$seq `expr $stop - $start`" >>$tmp.time
> fi
> else
> diff --git a/tests/qemu-iotests/common b/tests/qemu-iotests/common
> index c4d0742..b3d869e 100644
> --- a/tests/qemu-iotests/common
> +++ b/tests/qemu-iotests/common
> @@ -161,6 +161,8 @@ check options
> -T output timestamps
> -r randomize test order
> -c mode cache mode
> + -ts timestamp skip: skip tests when already ran and
> + no dependencies have changed on disk.
>
> testlist options
> -g group[,group...] include tests from these groups
> @@ -319,6 +321,10 @@ testlist options
> xpand=false
> ;;
>
> + -ts)
> + ts_skip=true
> + xpand=false
> + ;;
> -v)
> verbose=true
> xpand=false
> --
> 2.1.0
>
next prev parent reply other threads:[~2015-05-28 3:30 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-22 20:17 [Qemu-devel] [PATCH 0/4] iotests: skip tests with unchanged dependencies John Snow
2015-05-22 20:17 ` [Qemu-devel] [PATCH 1/4] iotests: fix exclusion option John Snow
2015-05-22 20:31 ` Eric Blake
2015-05-22 20:32 ` John Snow
2015-05-22 22:48 ` John Snow
2015-05-22 20:17 ` [Qemu-devel] [PATCH 2/4] iotests: Add dependency info to groups list John Snow
2015-05-28 3:34 ` Fam Zheng
2015-05-28 16:21 ` John Snow
2015-05-22 20:17 ` [Qemu-devel] [PATCH 3/4] iotests: add timestamp skip feature John Snow
2015-05-28 3:30 ` Fam Zheng [this message]
2015-05-22 20:17 ` [Qemu-devel] [PATCH 4/4] iotests: clarify help text John Snow
2015-05-28 3:22 ` Fam Zheng
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=20150528033011.GB6975@dhcp-14-238.nay.redhat.com \
--to=famz@redhat.com \
--cc=jsnow@redhat.com \
--cc=kwolf@redhat.com \
--cc=qemu-devel@nongnu.org \
/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).