Blob Blame History Raw
From 72ed2ef652be536c6752febf4f03cfc5d343e520 Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Mon, 29 Feb 2016 14:31:35 -0800
Subject: [PATCH] tests: Fix t1700 failing on a host with a 4k xfs filesystem
 (#1260664)

The problem is that mkfs.xfs won't work if the file it is trying to
create is on a filesystem with a sector size larger than the passed
-ssize value. So a host with 4k disks (eg. s390) and the xfs filesystem
will fail with the error message:
    illegal sector size 512; hw sector is 4096

Failures setting up the environment for the test aren't parted bugs.
This stops treating mkfs and dd errors as test failures, skipping the fs
and logging a warning.

Related: rhbz#1260664
---
 tests/t1700-probe-fs.sh | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/tests/t1700-probe-fs.sh b/tests/t1700-probe-fs.sh
index 83e6be4..2b59307 100755
--- a/tests/t1700-probe-fs.sh
+++ b/tests/t1700-probe-fs.sh
@@ -30,13 +30,13 @@ for type in ext2 ext3 ext4 btrfs xfs nilfs2; do
   case $type in ext*) n_sectors=8000 force=-F;;
       *) n_sectors=$((512*1024)) force=;; esac
 
-  # create an $type file system
-  if [ "$type" == "xfs" ]; then
-      # Work around a problem with s390
-      mkfs.xfs -ssize=$ss -dfile,name=$dev,size=${n_sectors}s || fail=1
+  # create an $type file system, creation failures are not parted bugs,
+  # skip the filesystem instead of failing the test.
+  if [ "$type" = "xfs" ]; then
+      mkfs.xfs -ssize=$ss -dfile,name=$dev,size=${n_sectors}s || { warn_ "$ME: mkfs.$type failed, skipping"; continue; }
   else
-      dd if=/dev/zero of=$dev bs=$ss count=$n_sectors >/dev/null || fail=1
-      mkfs.$type $force $dev || { warn_ $ME: mkfs.$type failed; fail=1; continue; }
+      dd if=/dev/null of=$dev bs=$ss seek=$n_sectors >/dev/null || { warn_ "$ME: dd failed, skipping $type"; continue; }
+      mkfs.$type $force $dev || { warn_ "$ME: mkfs.$type failed skipping"; continue; }
   fi
 
   # probe the $type file system
@@ -48,7 +48,7 @@ done
 # Some features should indicate ext4 by themselves.
 for feature in uninit_bg flex_bg; do
   # create an ext3 file system
-  dd if=/dev/zero of=$dev bs=1024 count=4096 >/dev/null || fail=1
+  dd if=/dev/null of=$dev bs=1024 seek=4096 >/dev/null || skip_ "dd failed"
   mkfs.ext3 -F $dev >/dev/null || skip_ "mkfs.ext3 failed"
 
   # set the feature
-- 
2.5.0