From patchwork Wed Jan 20 15:06:19 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Campbell X-Patchwork-Id: 8072471 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 609E89F818 for ; Wed, 20 Jan 2016 15:09:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C2625204AF for ; Wed, 20 Jan 2016 15:09:07 +0000 (UTC) Received: from lists.xen.org (lists.xenproject.org [50.57.142.19]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9E1D6204AE for ; Wed, 20 Jan 2016 15:09:01 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aLuL8-0002sL-Dj; Wed, 20 Jan 2016 15:06:30 +0000 Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aLuL6-0002rq-Jh for xen-devel@lists.xen.org; Wed, 20 Jan 2016 15:06:28 +0000 Received: from [85.158.143.35] by server-3.bemta-4.messagelabs.com id 32/C6-31122-372AF965; Wed, 20 Jan 2016 15:06:27 +0000 X-Env-Sender: prvs=820a2b0fb=Ian.Campbell@citrix.com X-Msg-Ref: server-9.tower-21.messagelabs.com!1453302383!11149871!1 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 7.35.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 60776 invoked from network); 20 Jan 2016 15:06:26 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-9.tower-21.messagelabs.com with RC4-SHA encrypted SMTP; 20 Jan 2016 15:06:26 -0000 X-IronPort-AV: E=Sophos;i="5.22,321,1449532800"; d="scan'208";a="332727358" From: Ian Campbell To: , Date: Wed, 20 Jan 2016 15:06:19 +0000 Message-ID: <1453302381-28692-1-git-send-email-ian.campbell@citrix.com> X-Mailer: git-send-email 2.6.1 In-Reply-To: <1453302359.26343.133.camel@citrix.com> References: <1453302359.26343.133.camel@citrix.com> MIME-Version: 1.0 X-DLP: MIA2 Cc: Ian Campbell Subject: [Xen-devel] [PATCH OSSTEST 1/3] Debian: erase-other-disks: add a log() helper X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Writing it out each time is too verbose. At the same time log the set of devices present before and after each batch of erasing, with a udev settle before the second to ensure any changes to /dev have happened. Signed-off-by: Ian Campbell Acked-by: Ian Jackson --- Osstest/Debian.pm | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/Osstest/Debian.pm b/Osstest/Debian.pm index 76171c0..cf3486b 100644 --- a/Osstest/Debian.pm +++ b/Osstest/Debian.pm @@ -1033,22 +1033,29 @@ if test -f \$stamp; then exit 0 fi >\$stamp -logger -t osstest-erase-other-disks-\$\$ "Running..." + +log () { + logger -t osstest-erase-other-disks-\$\$ "\$\@" +} + +log "Running..." + zero () { if test -b \$dev; then - logger -t osstest-erase-other-disks-\$\$ "Erasing \$dev" + log "Erasing \$dev" dd if=/dev/zero of=\$dev count=64 ||: if ! test -b \$dev; then - logger -t osstest-erase-other-disks-\$\$ "\$dev is no longer a block device!" + log "\$dev is no longer a block device!" exit 1 fi else - logger -t osstest-erase-other-disks-\$\$ "\$dev does not exist or is not a block device." + log "\$dev does not exist or is not a block device." fi } udevadm settle for sd in sd hd; do + log "\${sd} devices present before: `echo /dev/\${sd}*`" for b in a b c d e f; do dev=/dev/\${sd}\${b} zero @@ -1056,6 +1063,8 @@ for sd in sd hd; do for dev in /dev/\${sd}a[0-9]; do zero done + udevadm settle + log "\${sd} devices present after: `echo /dev/\${sd}*`" done for dev in ${disk}*; do zero