bug-parted
[Top][All Lists]
Advanced

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

misc test fixes/cleanup


From: Jim Meyering
Subject: misc test fixes/cleanup
Date: Thu, 14 Apr 2011 12:45:05 +0200

There were minor problems with the root-only tests in libparted/tests,
there was room for improvement in t1101,
and there was an unused rule in libparted/tests/Makefile.am:

From 785bdf1cad7c2a8b242f9bc514f670f13e214378 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Sat, 9 Apr 2011 22:20:08 +0200
Subject: [PATCH 1/3] 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.
---
 libparted/tests/Makefile.am |    7 +++++++
 tests/init.cfg              |    4 ++--
 tests/t-local.sh            |    2 +-
 3 files changed, 10 insertions(+), 3 deletions(-)

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 address@hidden
        mv address@hidden $@

+# 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"
--
1.7.5.rc1.228.g86d60b


From 0cffa2258968dc2a5992676fbcaddc2c26c85eae Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Sat, 9 Apr 2011 22:21:50 +0200
Subject: [PATCH 2/3] tests: improve t1101-busy-partition.sh

* tests/t1101-busy-partition.sh: Fail hard upon timeout while
waiting for device to appear.
---
 tests/t1101-busy-partition.sh |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

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; }
--
1.7.5.rc1.228.g86d60b


From 69bf2b05c5d2c6c6a3e2e314c3026e9c21e335fe Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Sat, 9 Apr 2011 22:22:49 +0200
Subject: [PATCH 3/3] tests: remove now-unused Makefile rule

* libparted/tests/Makefile.am (old-init.sh): Remove obsolete rule.
---
 libparted/tests/Makefile.am |   10 ----------
 1 files changed, 0 insertions(+), 10 deletions(-)

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 address@hidden $@
-       echo 'PARTED_USABLE_TEST_DIR="$(PARTED_USABLE_TEST_DIR)"' > 
address@hidden
-       echo 'abs_top_srcdir="$(abs_top_srcdir)"' >> address@hidden
-       echo 'PATH="$(abs_builddir)$(PATH_SEPARATOR)$$PATH"; export PATH' >> 
address@hidden
-       chmod a-w address@hidden
-       mv address@hidden $@
-
 # Arrange to symlink to tests/init.sh.
 CLEANFILES = init.sh
 .PHONY: prereq
--
1.7.5.rc1.228.g86d60b



reply via email to

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