From patchwork Tue Jun 2 19:18:40 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Snow X-Patchwork-Id: 479677 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id CC27B140290 for ; Wed, 3 Jun 2015 05:19:37 +1000 (AEST) Received: from localhost ([::1]:60531 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yzrip-0005e2-U3 for incoming@patchwork.ozlabs.org; Tue, 02 Jun 2015 15:19:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48589) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YzriN-0004nP-On for qemu-devel@nongnu.org; Tue, 02 Jun 2015 15:19:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YzriL-0000VP-R3 for qemu-devel@nongnu.org; Tue, 02 Jun 2015 15:19:07 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35528) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YzriL-0000VH-KT for qemu-devel@nongnu.org; Tue, 02 Jun 2015 15:19:05 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id 56A35A0CD8 for ; Tue, 2 Jun 2015 19:19:05 +0000 (UTC) Received: from scv.usersys.redhat.com (vpn-58-11.rdu2.redhat.com [10.10.58.11]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t52JInNR031887; Tue, 2 Jun 2015 15:19:02 -0400 From: John Snow To: qemu-devel@nongnu.org Date: Tue, 2 Jun 2015 15:18:40 -0400 Message-Id: <1433272721-24871-4-git-send-email-jsnow@redhat.com> In-Reply-To: <1433272721-24871-1-git-send-email-jsnow@redhat.com> References: <1433272721-24871-1-git-send-email-jsnow@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: kwolf@redhat.com, famz@redhat.com, John Snow Subject: [Qemu-devel] [PATCH v3 3/4] iotests: add timestamp skip feature X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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. Reviewed-by: Fam Zheng Signed-off-by: John Snow --- 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 1fa6319..800c7b0 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 +_hasdep() +{ + grep -q "^${1}.*${2}" "${source_iotests}/group" +} + +# _skippable +_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" >$tmp.time fi else diff --git a/tests/qemu-iotests/common b/tests/qemu-iotests/common index 84b6f16..395c28c 100644 --- a/tests/qemu-iotests/common +++ b/tests/qemu-iotests/common @@ -163,6 +163,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 @@ -321,6 +323,10 @@ testlist options xpand=false ;; + -ts) + ts_skip=true + xpand=false + ;; -v) verbose=true xpand=false