[PATCH 4/4] generic: inconsistent initial state for test_generic_punch

Dave Chinner david at fromorbit.com
Sun Feb 2 17:56:05 CST 2014


From: Dave Chinner <dchinner at redhat.com>

The first test may start with the file from the previous test, and
that is in an unknown state. Hence always remove the test file
before the first test so that it doesn't have extents inside the
test range as it is supposed to be testing into a hole.

Signed-off-by: Dave Chinner <dchinner at redhat.com>
---
 common/punch          | 7 ++++---
 tests/generic/255.out | 8 ++------
 tests/generic/316.out | 8 ++------
 tests/xfs/252.out     | 8 ++------
 4 files changed, 10 insertions(+), 21 deletions(-)

diff --git a/common/punch b/common/punch
index 4ed8406..49715a7 100644
--- a/common/punch
+++ b/common/punch
@@ -318,10 +318,11 @@ _test_generic_punch()
 	filter_cmd=$5
 	testfile=$6
 
+	# initial test state must be defined, otherwise the first test can fail
+	# due ot stale file state left from previous tests.
+	rm -f $testfile
+
 	echo "	1. into a hole"
-	if [ "$remove_testfile" ]; then
-		rm -f $testfile
-	fi
 	$XFS_IO_PROG -f -c "truncate 20k" \
 		-c "$zero_cmd 4k 8k" \
 		-c "$map_cmd -v" $testfile | $filter_cmd
diff --git a/tests/generic/255.out b/tests/generic/255.out
index cb9fdca..217ef3e 100644
--- a/tests/generic/255.out
+++ b/tests/generic/255.out
@@ -158,9 +158,7 @@ eecb7aa303d121835de05028751d301c
 0000400 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
 *
 	1. into a hole
-0: [0..7]: extent
-1: [8..39]: hole
-5a58e46082be047d0f13bee7974015b9
+daa100df6e6711906b61c9ab5aa16032
 	2. into allocated space
 0: [0..7]: extent
 1: [8..23]: hole
@@ -242,9 +240,7 @@ eecb7aa303d121835de05028751d301c
 0000400 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
 *
 	1. into a hole
-0: [0..7]: extent
-1: [8..39]: hole
-5a58e46082be047d0f13bee7974015b9
+daa100df6e6711906b61c9ab5aa16032
 	2. into allocated space
 0: [0..7]: extent
 1: [8..23]: hole
diff --git a/tests/generic/316.out b/tests/generic/316.out
index 222e601..383f0d1 100644
--- a/tests/generic/316.out
+++ b/tests/generic/316.out
@@ -86,9 +86,7 @@ eecb7aa303d121835de05028751d301c
 0000400 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
 *
 	1. into a hole
-0: [0..7]: extent
-1: [8..39]: hole
-5a58e46082be047d0f13bee7974015b9
+daa100df6e6711906b61c9ab5aa16032
 	2. into allocated space
 0: [0..7]: extent
 1: [8..23]: hole
@@ -135,9 +133,7 @@ eecb7aa303d121835de05028751d301c
 0000400 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
 *
 	1. into a hole
-0: [0..7]: extent
-1: [8..39]: hole
-5a58e46082be047d0f13bee7974015b9
+daa100df6e6711906b61c9ab5aa16032
 	2. into allocated space
 0: [0..7]: extent
 1: [8..23]: hole
diff --git a/tests/xfs/252.out b/tests/xfs/252.out
index 539c8a4..47d9a4c 100644
--- a/tests/xfs/252.out
+++ b/tests/xfs/252.out
@@ -158,9 +158,7 @@ eecb7aa303d121835de05028751d301c
 0000400 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
 *
 	1. into a hole
-0: [0..7]: data
-1: [8..39]: hole
-5a58e46082be047d0f13bee7974015b9
+daa100df6e6711906b61c9ab5aa16032
 	2. into allocated space
 0: [0..7]: data
 1: [8..23]: hole
@@ -242,9 +240,7 @@ eecb7aa303d121835de05028751d301c
 0000400 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
 *
 	1. into a hole
-0: [0..7]: data
-1: [8..39]: hole
-5a58e46082be047d0f13bee7974015b9
+daa100df6e6711906b61c9ab5aa16032
 	2. into allocated space
 0: [0..7]: data
 1: [8..23]: hole
-- 
1.8.4.rc3



More information about the xfs mailing list