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

Jim Meyering meyering at alioth.debian.org
Thu Apr 14 10:49:18 UTC 2011


 doc/parted-pt_BR.texi         |    2 +-
 libparted/filesys.c           |    2 +-
 libparted/tests/Makefile.am   |   15 ++++++---------
 tests/init.cfg                |    4 ++--
 tests/t-local.sh              |   30 ++++++++++++++++++------------
 tests/t1101-busy-partition.sh |    4 ++--
 6 files changed, 30 insertions(+), 27 deletions(-)

New commits:
commit 8d59f5b29a5fc80e0992f2c3417b0d5b7bc3317f
Author: Jim Meyering <meyering at redhat.com>
Date:   Thu Apr 14 12:46:03 2011 +0200

    maint: s/can not/cannot/ in a comment and documentation
    
    Without this, a new "make syntax-check" rule would fail.
    * libparted/filesys.c: s/can not/cannot/
    * doc/parted-pt_BR.texi (BIOSes and Firmware): Likewise.

diff --git a/doc/parted-pt_BR.texi b/doc/parted-pt_BR.texi
index d3b2667..9005781 100644
--- a/doc/parted-pt_BR.texi
+++ b/doc/parted-pt_BR.texi
@@ -1380,7 +1380,7 @@ none           /dev/pts     devpts  gid=5,mode=620  0 0
 thing.  However, on PC and PC98 based computers, the word BIOS is more
 common.  On Apple Macintosh and Sun computers, the word ``firmware'' is
 more common.  The BIOS or firmware program is built into a ROM chip
-inside your computer, that does memory checks, etc.  You can not
+inside your computer, that does memory checks, etc.  You cannot
 (easily) change this program.  Since BIOSes today are generally
 compatible with BIOSes in use 20 years ago, these programs tend to have
 an antiquated design.  Features have been added in counter-intuitive
diff --git a/libparted/filesys.c b/libparted/filesys.c
index c3be2e1..bf458e5 100644
--- a/libparted/filesys.c
+++ b/libparted/filesys.c
@@ -812,7 +812,7 @@ ped_file_system_get_create_constraint (const PedFileSystemType* fs_type,
  * the filesystem \p fs and the capabilities of the resize algorithm.
  * Hints:
  * -# if constraint->start_align->grain_size == 0, or
- *    constraint->start_geom->length == 1, then the start can not be moved
+ *    constraint->start_geom->length == 1, then the start cannot be moved
  * -# constraint->min_size is the minimum size you can resize the partition
  *    to.  You might want to tell the user this ;-).
  *

commit 69bf2b05c5d2c6c6a3e2e314c3026e9c21e335fe
Author: Jim Meyering <meyering at redhat.com>
Date:   Sat Apr 9 22:22:49 2011 +0200

    tests: remove now-unused Makefile rule
    
    * libparted/tests/Makefile.am (old-init.sh): Remove obsolete rule.

diff --git a/libparted/tests/Makefile.am b/libparted/tests/Makefile.am
index c967ef8..71ba0a7 100644
--- a/libparted/tests/Makefile.am
+++ b/libparted/tests/Makefile.am
@@ -24,16 +24,6 @@ symlink_SOURCES = common.h common.c symlink.c
 
 MAINTAINERCLEANFILES = Makefile.in
 
-CLEANFILES = old-init.sh
-all: old-init.sh
-old-init.sh: Makefile.in
-	rm -f $@-t $@
-	echo 'PARTED_USABLE_TEST_DIR="$(PARTED_USABLE_TEST_DIR)"' > $@-t
-	echo 'abs_top_srcdir="$(abs_top_srcdir)"' >> $@-t
-	echo 'PATH="$(abs_builddir)$(PATH_SEPARATOR)$$PATH"; export PATH' >> $@-t
-	chmod a-w $@-t
-	mv $@-t $@
-
 # Arrange to symlink to tests/init.sh.
 CLEANFILES = init.sh
 .PHONY: prereq

commit 0cffa2258968dc2a5992676fbcaddc2c26c85eae
Author: Jim Meyering <meyering at redhat.com>
Date:   Sat Apr 9 22:21:50 2011 +0200

    tests: improve t1101-busy-partition.sh
    
    * tests/t1101-busy-partition.sh: Fail hard upon timeout while
    waiting for device to appear.

diff --git a/tests/t1101-busy-partition.sh b/tests/t1101-busy-partition.sh
index e9e0953..b8dab44 100755
--- a/tests/t1101-busy-partition.sh
+++ b/tests/t1101-busy-partition.sh
@@ -41,10 +41,10 @@ parted -s "$dev" mkpartfs primary fat32 1 40 > out 2>&1 || fail=1
 compare out /dev/null || fail=1
 
 parted -s "$dev" mkpartfs primary fat32 40 80 > out 2>&1 || fail=1
+compare out /dev/null || fail=1
 
 # wait for new partition device to appear
-wait_for_dev_to_appear_ ${dev}2
-compare out /dev/null || fail=1
+wait_for_dev_to_appear_ ${dev}2 || fail_ ${dev}2 did not appear
 
 # be sure to unmount upon interrupt, failure, etc.
 cleanup_fn_() { umount "${dev}2" > /dev/null 2>&1; }

commit 785bdf1cad7c2a8b242f9bc514f670f13e214378
Author: Jim Meyering <meyering at redhat.com>
Date:   Sat Apr 9 22:20:08 2011 +0200

    tests: make the tests in libparted/tests work properly once again
    
    Since switching to init.sh, the root-only tests did not clean up.
    * libparted/tests/Makefile.am (prereq): Always create a symlink
    to tests/init.sh.
    * tests/init.cfg: Source $abs_top_srcdir/tests-relative names,
    not $srcdir-relative names.  This way, it works also when run
    from libparted/tests/.
    * tests/t-local.sh: Likewise.

diff --git a/libparted/tests/Makefile.am b/libparted/tests/Makefile.am
index f83264c..c967ef8 100644
--- a/libparted/tests/Makefile.am
+++ b/libparted/tests/Makefile.am
@@ -34,6 +34,13 @@ old-init.sh: Makefile.in
 	chmod a-w $@-t
 	mv $@-t $@
 
+# Arrange to symlink to tests/init.sh.
+CLEANFILES = init.sh
+.PHONY: prereq
+prereq:
+	$(AM_V_GEN)ln -sf $(abs_top_srcdir)/tests/init.sh .
+$(TEST_LOGS): prereq
+
 TESTS_ENVIRONMENT = \
   top_srcdir='$(top_srcdir)' \
   abs_top_srcdir='$(abs_top_srcdir)' \
diff --git a/tests/init.cfg b/tests/init.cfg
index f3682b1..08ebd0c 100644
--- a/tests/init.cfg
+++ b/tests/init.cfg
@@ -66,5 +66,5 @@ require_erasable_()
   $df | grep "^$dev_[0-9]" && fail_ "a partition of $dev_ is already mounted"
 }
 
-. $srcdir/t-lib-helpers.sh
-. $srcdir/t-local.sh
+. "$abs_top_srcdir/tests/t-lib-helpers.sh"
+. "$abs_top_srcdir/tests/t-local.sh"
diff --git a/tests/t-local.sh b/tests/t-local.sh
index 135563a..8e2ef07 100644
--- a/tests/t-local.sh
+++ b/tests/t-local.sh
@@ -184,4 +184,4 @@ gpt_restore_primary_table_()
   poke_ $dev $(gpt1_pte_name_offset_ $ss) "$orig_byte" || return 1
 }
 
-. $srcdir/t-lvm.sh
+. "$abs_top_srcdir/tests/t-lvm.sh"

commit bbe50a93b9fdffe35a1ee5bcb2320d746156914a
Author: Jim Meyering <meyering at redhat.com>
Date:   Fri Apr 8 18:30:40 2011 +0200

    tests: avoid a race condition in the scsi_debug-using tests
    
    * tests/t-local.sh (new_sdX_): New function.
    (scsi_debug_setup_): Use new_sdX_ to find the just-created device name,
    rather relying on the list of file names in /sys/block/sd* changing.
    Sometimes the list would not change, which would lead to tests failing
    with I/O errors when run in parallel.  Thanks to Brian Lane for the
    tip that /sys/block/sd*/device/model contains "scsi_debug" if there
    is a device created by our "modprobe scsi_debug" command.

diff --git a/tests/t-local.sh b/tests/t-local.sh
index 3a4d398..135563a 100644
--- a/tests/t-local.sh
+++ b/tests/t-local.sh
@@ -70,7 +70,18 @@ scsi_debug_acquire_lock_()
   return 1
 }
 
-print_sd_names_() { (cd /sys/block && printf '%s\n' sd*); }
+# If there is a scsi_debug device, print the corresponding "sdN" and return 0.
+# Otherwise, return 1.
+new_sdX_()
+{
+  local m=$(grep -lw scsi_debug /sys/block/sd*/device/model) || return 1
+
+  # Remove the /sys/block/ prefix, and then the /device/model suffix.
+  m=${m#/sys/block/}
+  m=${m%/device/model}
+  echo "$m"
+  return 0
+}
 
 # Create a device using the scsi_debug module with the options passed to
 # this function as arguments.  Upon success, print the name of the new device.
@@ -80,8 +91,8 @@ scsi_debug_setup_()
 
   # It is not trivial to determine the name of the device we're creating.
   # Record the names of all /sys/block/sd* devices *before* probing:
-  print_sd_names_ > before
-  modprobe scsi_debug "$@" || { rm -f before; return 1; }
+  touch stamp
+  modprobe scsi_debug "$@" || { rm -f stamp; return 1; }
   scsi_debug_modprobe_succeeded_=1
   test $VERBOSE = yes \
     && warn_ $ME_ modprobe scsi_debug succeeded
@@ -92,18 +103,13 @@ scsi_debug_setup_()
   # FIXME-portability: using "cmp - ..." probably requires GNU cmp.
   local incr=1
   local i=0
-  while print_sd_names_ | cmp -s - before; do
+  local new_dev
+  while :; do
+    new_dev=$(new_sdX_) && break
     sleep .1 2>/dev/null || { sleep 1; incr=10; }
     i=$(expr $i + $incr); test $i = 20 && break
   done
 
-  # Record the names of all /sys/block/sd* devices *after* probe+wait.
-  print_sd_names_ > after
-
-  # Determine which device names (if any) are new.
-  # There could be more than one new device, and there have been a removal.
-  local new_dev=$(comm -13 before after)
-  rm -f before after
   case $new_dev in
     sd[a-z]) ;;
     sd[a-z][a-z]) ;;



More information about the Parted-commits mailing list