Blame SOURCES/0025-tests-Use-mkfs.xfs-to-create-files-1036152.patch

9cc286
From e6e0f1db4535179f25ebf8f6f0a59eb430d377ff Mon Sep 17 00:00:00 2001
9cc286
From: "Brian C. Lane" <bcl@redhat.com>
9cc286
Date: Thu, 23 Jan 2014 10:09:36 -0800
9cc286
Subject: [PATCH] tests: Use mkfs.xfs to create files (#1036152)
9cc286
9cc286
On s390 there is a bug with mkfs.xfs and pre-existing files. Work around
9cc286
it by creating the file directly with mkfs.xfs. This also works on other
9cc286
arches.
9cc286
9cc286
* tests/t1700-probe-fs.sh: Check for xfs and use direct file creation
9cc286
* tests/t4100-dvh-partition-limits.sh: Use mkfs.xfs -dfile
9cc286
* tests/t4100-msdos-partition-limits.sh: Use mkfs.xfs -dfile
9cc286
---
9cc286
 tests/t1700-probe-fs.sh               | 9 +++++++--
9cc286
 tests/t4100-dvh-partition-limits.sh   | 3 +--
9cc286
 tests/t4100-msdos-partition-limits.sh | 3 +--
9cc286
 3 files changed, 9 insertions(+), 6 deletions(-)
9cc286
9cc286
diff --git a/tests/t1700-probe-fs.sh b/tests/t1700-probe-fs.sh
9cc286
index 36e7cdf..575ca24 100755
9cc286
--- a/tests/t1700-probe-fs.sh
9cc286
+++ b/tests/t1700-probe-fs.sh
9cc286
@@ -31,8 +31,13 @@ for type in ext2 ext3 ext4 btrfs xfs nilfs2; do
9cc286
       *) n_sectors=$((257*1024)) force=;; esac
9cc286
 
9cc286
   # create an $type file system
9cc286
-  dd if=/dev/zero of=$dev bs=$ss count=$n_sectors >/dev/null || fail=1
9cc286
-  mkfs.$type $force $dev || { warn_ $ME: mkfs.$type failed; fail=1; continue; }
9cc286
+  if [ "$type" == "xfs" ]; then
9cc286
+      # Work around a problem with s390
9cc286
+      mkfs.xfs -ssize=$ss -dfile,name=$dev,size=${n_sectors}s || fail=1
9cc286
+  else
9cc286
+      dd if=/dev/zero of=$dev bs=$ss count=$n_sectors >/dev/null || fail=1
9cc286
+      mkfs.$type $force $dev || { warn_ $ME: mkfs.$type failed; fail=1; continue; }
9cc286
+  fi
9cc286
 
9cc286
   # probe the $type file system
9cc286
   parted -m -s $dev u s print >out 2>&1 || fail=1
9cc286
diff --git a/tests/t4100-dvh-partition-limits.sh b/tests/t4100-dvh-partition-limits.sh
9cc286
index ec6981d..88e452d 100755
9cc286
--- a/tests/t4100-dvh-partition-limits.sh
9cc286
+++ b/tests/t4100-dvh-partition-limits.sh
9cc286
@@ -37,8 +37,7 @@ mp=`pwd`/mount-point
9cc286
 n=4096
9cc286
 
9cc286
 # create an XFS file system
9cc286
-dd if=/dev/zero of=$fs bs=1MB count=2 seek=100 || fail=1
9cc286
-mkfs.xfs -f -q $fs || fail=1
9cc286
+mkfs.xfs -dfile,name=$fs,size=100m || fail=1
9cc286
 mkdir "$mp" || fail=1
9cc286
 
9cc286
 # Unmount upon interrupt, failure, etc., as well as upon normal completion.
9cc286
diff --git a/tests/t4100-msdos-partition-limits.sh b/tests/t4100-msdos-partition-limits.sh
9cc286
index f03a85e..9350441 100755
9cc286
--- a/tests/t4100-msdos-partition-limits.sh
9cc286
+++ b/tests/t4100-msdos-partition-limits.sh
9cc286
@@ -37,8 +37,7 @@ mp=`pwd`/mount-point
9cc286
 n=4096
9cc286
 
9cc286
 # create an XFS file system
9cc286
-dd if=/dev/zero of=$fs bs=1MB count=2 seek=100 || fail=1
9cc286
-mkfs.xfs -f -q $fs || fail=1
9cc286
+mkfs.xfs -dfile,name=$fs,size=100m || fail=1
9cc286
 mkdir "$mp" || fail=1
9cc286
 
9cc286
 # Unmount upon interrupt, failure, etc., as well as upon normal completion.
9cc286
-- 
9cc286
1.8.4.2
9cc286