[Parted-commits] GNU Parted Official Repository: Changes to 'master'

Jim Meyering meyering at alioth.debian.org
Mon Nov 22 11:18:14 UTC 2010


 libparted/arch/linux.c |   22 +++++++++-------------
 tests/t-lib-helpers.sh |   14 ++------------
 tests/t-local.sh       |   24 ++++++++++++++++++------
 tests/t6000-dm.sh      |    3 ++-
 4 files changed, 31 insertions(+), 32 deletions(-)

New commits:
commit a7c7a29fc4df09e546357793fe79b46b08061ed4
Author: Jim Meyering <meyering at redhat.com>
Date:   Mon Nov 22 11:56:45 2010 +0100

    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/

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*); }

commit dc005d63c1fee47c88fec0962d751b692736dc37
Author: Jim Meyering <meyering at redhat.com>
Date:   Mon Nov 22 11:53:17 2010 +0100

    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.

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_()

commit d5bb7441dd6c454fab208401f6b2d37f630d15fd
Author: Jim Meyering <meyering at redhat.com>
Date:   Mon Nov 22 10:50:24 2010 +0100

    tests: avoid spurious failure
    
    * tests/t6000-dm.sh: Sanitize directory name, to avoid spurious
    failure due to e.g., mount-related differences.

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
 

commit 9fa0e1800db5b9f094ae481fd95a51da03f19e95
Author: Brian C. Lane <bcl at redhat.com>
Date:   Mon Nov 22 10:01:56 2010 +0100

    linux: remove DASD restriction on _disk_sync_part_table
    
    * libparted/arch/linux.c: Include <assert.h>.
    (linux_disk_commit): Assert that _have_blkpg returns true
    and don't skip _disk_sync_part_table for DASD devices.
    Otherwise, when creating a partition on a DASD device,
    new /dev/*[12...] device files would not be created.
    Also, remove obsolete comment about DevFS.
    For details, see http://bugzilla.redhat.com/651478
    and http://thread.gmane.org/gmane.comp.gnu.parted.bugs/10191

diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
index a5ae10c..4e61bfe 100644
--- a/libparted/arch/linux.c
+++ b/libparted/arch/linux.c
@@ -40,6 +40,7 @@
 #include <sys/types.h>
 #include <sys/utsname.h>        /* for uname() */
 #include <scsi/scsi.h>
+#include <assert.h>
 #ifdef ENABLE_DEVICE_MAPPER
 #include <libdevmapper.h>
 #endif
@@ -2824,20 +2825,15 @@ linux_disk_commit (PedDisk* disk)
                 return _dm_reread_part_table (disk);
 #endif
         if (disk->dev->type != PED_DEVICE_FILE) {
-                /* The ioctl() command BLKPG_ADD_PARTITION does not notify
-                 * the devfs system; consequently, /proc/partitions will not
-                 * be up to date, and the proper links in /dev are not
-                 * created.  Therefore, if using DevFS, we must get the kernel
-                 * to re-read and grok the partition table.
-                 */
-                /* Work around kernel dasd problem so we really do BLKRRPART */
-		int ok = 1;
-		if (disk->dev->type != PED_DEVICE_DASD && _have_blkpg ()) {
-			if (!_disk_sync_part_table (disk))
-			  ok = 0;
-		}
 
-                return ok;
+		/* We now require BLKPG support.  If this assertion fails,
+		   please write to the mailing list describing your system.
+		   Assuming it's never triggered, ...
+		   FIXME: remove this assertion in 2012.  */
+		assert (_have_blkpg ());
+
+		if (!_disk_sync_part_table (disk))
+			return 0;
         }
 
         return 1;



More information about the Parted-commits mailing list