bug-parted
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

more test fixes; some failures still remaining


From: Jim Meyering
Subject: more test fixes; some failures still remaining
Date: Mon, 22 Nov 2010 12:17:57 +0100

I've run the tests on a different system, and some of the root-only ones
were still failing.  I've included a few fixes below:

Note, if you want to run these yourself, here's how:
  - build as usual: ./configure ... && make && make check
  - cd tests && sudo make check VERBOSE=yes

Some tests are still skipped when it seems they should not be.
Also, I still see this failure on 2.6.32-19.el6.s390x:

    FAIL: t9020-alignment.sh (exit: 1)
    --- out 2010-11-22 11:17:04.000000000 +0000
    +++ exp 2010-11-22 11:17:04.000000000 +0000
    @@ -1,3 +1,3 @@
    -Error: Can't have a partition outside the disk!

I'll investigate later.

>From d5bb7441dd6c454fab208401f6b2d37f630d15fd Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Mon, 22 Nov 2010 10:50:24 +0100
Subject: [PATCH 1/3] tests: avoid spurious failure

* tests/t6000-dm.sh: Sanitize directory name, to avoid spurious
failure due to e.g., mount-related differences.
---
 tests/t6000-dm.sh |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/tests/t6000-dm.sh b/tests/t6000-dm.sh
index 23a70c3..b20f4cd 100755
--- a/tests/t6000-dm.sh
+++ b/tests/t6000-dm.sh
@@ -72,11 +72,12 @@ for type in linear ; do
   compare out /dev/null || fail=1

   parted -s "$dev" print > out 2>&1 || fail=1
+  sed 's/^Disk .*: /Disk DEV: /' out > k; mv k out

   # Create expected output file.
   cat <<EOF >> exp || fail=1
 Model: Linux device-mapper ($type) (dm)
-Disk $dev: 524kB
+Disk DEV: 524kB
 Sector size (logical/physical): 512B/512B
 Partition Table: msdos

--
1.7.3.2.765.g642a8


>From dc005d63c1fee47c88fec0962d751b692736dc37 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Mon, 22 Nov 2010 11:53:17 +0100
Subject: [PATCH 2/3] tests: remove vestiges of test-lib.sh

* tests/t-lib-helpers.sh (require_mdadm_): Remove vestiges of
test-lib.sh (aka uses of the "say" and "test_done" functions).
(require_xfs_): Likewise.
---
 tests/t-lib-helpers.sh |   14 ++------------
 1 files changed, 2 insertions(+), 12 deletions(-)

diff --git a/tests/t-lib-helpers.sh b/tests/t-lib-helpers.sh
index 9411870..d56a111 100644
--- a/tests/t-lib-helpers.sh
+++ b/tests/t-lib-helpers.sh
@@ -312,12 +312,7 @@ emit_superuser_warning()

 require_mdadm_()
 {
-  ( mdadm --version ) > /dev/null 2>&1 ||
-    {
-      say "skipping $0: could not find mdadm executable"
-      test_done
-      exit
-    }
+  mdadm --version || skip_ "find mdadm executable"
 }

 # Will look for an md number that is not in use and create a md device with
@@ -358,12 +353,7 @@ normalize_part_diag_()

 require_xfs_()
 {
-  ( mkfs.xfs -V ) >/dev/null 2>&1 ||
-    {
-      say "skipping $0: this test requires XFS support"
-      test_done
-      exit
-    }
+  mkfs.xfs -V || skip_ "this test requires XFS support"
 }

 require_dvhtool_()
--
1.7.3.2.765.g642a8


>From a7c7a29fc4df09e546357793fe79b46b08061ed4 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Mon, 22 Nov 2010 11:56:45 +0100
Subject: [PATCH 3/3] tests: don't rely on "lockfile" program

* tests/t-local.sh (scsi_debug_acquire_lock_): Use mkdir, rather
that lockfile.  The latter is not always available.
(scsi_debug_lock_dir_): Rename, now that it's a dir.
(scsi_debug_cleanup_): Remove it with rm -rf.
Fix typo in diag: s/rrmod/rmmod/
---
 tests/t-local.sh |   24 ++++++++++++++++++------
 1 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/tests/t-local.sh b/tests/t-local.sh
index 6b73fb7..3a4d398 100644
--- a/tests/t-local.sh
+++ b/tests/t-local.sh
@@ -2,7 +2,7 @@
 # This file is sourced from the testing framework.
 sector_size_=${PARTED_SECTOR_SIZE:-512}

-scsi_debug_lock_file_="$abs_srcdir/scsi_debug.lock"
+scsi_debug_lock_dir_="$abs_srcdir/scsi_debug.lock"

 require_scsi_debug_module_()
 {
@@ -26,11 +26,11 @@ scsi_debug_cleanup_()
     # "Module scsi_debug is in use".
     for i in 1 2 3; do
       rmmod scsi_debug \
-       && { test $VERBOSE = yes && warn_ $ME_ rrmod scsi_debug...; break; }
+       && { test $VERBOSE = yes && warn_ $ME_ rmmod scsi_debug...; break; }
       sleep .2 || sleep 1
     done
   fi
-  rm -f $scsi_debug_lock_file_
+  rm -fr $scsi_debug_lock_dir_
 }

 # Helper function: wait 2s (via .1s increments) for FILE to appear.
@@ -53,9 +53,21 @@ wait_for_dev_to_appear_()
 scsi_debug_acquire_lock_()
 {
   local retries=20
-  local lock_timeout_seconds=120
-  lockfile -1 -r $retries -l $lock_timeout_seconds $scsi_debug_lock_file_ \
-    || warn_ "$ME_: failed to acquire lock: $scsi_debug_lock_file_"
+  local lock_timeout_stale_seconds=120
+
+  # If it was created more than $lock_timeout_stale_seconds ago, remove it.
+  # FIXME: implement this
+
+  local i=0
+  local incr=1
+  while :; do
+    mkdir "$scsi_debug_lock_dir_" && return 0
+    sleep .1 2>/dev/null || { sleep 1; incr=10; }
+    i=$(expr $i + $incr); test $i = $(expr $retries \* 10) && break
+  done
+
+  warn_ "$ME_: failed to acquire lock: $scsi_debug_lock_dir_"
+  return 1
 }

 print_sd_names_() { (cd /sys/block && printf '%s\n' sd*); }
--
1.7.3.2.765.g642a8



reply via email to

[Prev in Thread] Current Thread [Next in Thread]