diff mbox

[OSSTEST,1/3] Debian: erase-other-disks: add a log() helper

Message ID 1453302381-28692-1-git-send-email-ian.campbell@citrix.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ian Campbell Jan. 20, 2016, 3:06 p.m. UTC
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 <ian.campbell@citrix.com>
---
 Osstest/Debian.pm | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

Comments

Ian Jackson Jan. 20, 2016, 4:10 p.m. UTC | #1
Ian Campbell writes ("[PATCH OSSTEST 1/3] Debian: erase-other-disks: add a log() helper"):
> 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.

Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
diff mbox

Patch

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