dcavalca / rpms / mdadm

Forked from rpms/mdadm 3 years ago
Clone

Blame SOURCES/0003-tests-func.sh-Fix-some-total-breakage-in-the-test-sc.patch

d922d5
From 59416da78fc66084f721163b914913dc1da37b44 Mon Sep 17 00:00:00 2001
d922d5
From: Jes Sorensen <jsorensen@fb.com>
d922d5
Date: Wed, 11 Apr 2018 17:01:50 -0400
d922d5
Subject: [RHEL7.5 PATCH 03/26] tests/func.sh: Fix some total breakage in the
d922d5
 test scripts
d922d5
d922d5
We will never mandate an obsolete file system such as ext[2-4] for
d922d5
running the test suite, nor should the test version of mdadm be
d922d5
installed on the system for the tests to be run.
d922d5
d922d5
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
d922d5
Fixes: 20d10b4be873ba ("mdadm/test: Refactor and revamp 'test' script")
d922d5
---
d922d5
 test          |  2 +-
d922d5
 tests/func.sh | 22 +++-------------------
d922d5
 2 files changed, 4 insertions(+), 20 deletions(-)
d922d5
d922d5
diff --git a/test b/test
d922d5
index 111a2e7..711a3c7 100755
d922d5
--- a/test
d922d5
+++ b/test
d922d5
@@ -5,7 +5,7 @@ mdadm=$PWD/mdadm
d922d5
 targetdir="/var/tmp"
d922d5
 logdir="$targetdir"
d922d5
 config=/tmp/mdadm.conf
d922d5
-testdir=
d922d5
+testdir=$PWD/tests
d922d5
 devlist=
d922d5
 
d922d5
 savelogs=0
d922d5
diff --git a/tests/func.sh b/tests/func.sh
d922d5
index a6995f1..9710a53 100644
d922d5
--- a/tests/func.sh
d922d5
+++ b/tests/func.sh
d922d5
@@ -101,8 +101,8 @@ check_env() {
d922d5
 		echo "test: testing can only be done as 'root'."
d922d5
 		exit 1
d922d5
 	}
d922d5
-	[ -x "raid6check" -a -x $mdadm ] || {
d922d5
-		echo "test: please run 'make everything' before perform testing."
d922d5
+	[ \! -x $mdadm ] && {
d922d5
+		echo "test: please run make everything before perform testing."
d922d5
 		exit 1
d922d5
 	}
d922d5
 	cmds=(mdadm lsblk df udevadm losetup mkfs.ext3 fsck seq)
d922d5
@@ -113,23 +113,6 @@ check_env() {
d922d5
 			exit 1
d922d5
 		}
d922d5
 	done
d922d5
-	mdadm_src_ver="$($mdadm -V 2>&1)"
d922d5
-	mdadm_sbin_ver="$($(which mdadm) -V 2>&1)"
d922d5
-	if [ "$mdadm_src_ver" != "$mdadm_sbin_ver" ]
d922d5
-	then
d922d5
-		# it's nessesary to 'make install' mdadm to /SBIN/DIR,
d922d5
-		# such as systemd/mdadm-grow-continue@.service, would
d922d5
-		# run as an instance by systemd when reshape happens,
d922d5
-		# thus ensure that the correct mdadm is in testing.
d922d5
-		echo "test: please run 'make install' before testing."
d922d5
-		exit 1
d922d5
-	fi
d922d5
-	if ! $(df -T . | grep -iq ext)
d922d5
-	then
d922d5
-		# 'external file' bitmap only supports with ext[2-4] file system
d922d5
-		echo "test: please run test suite with ext[2-4] file system."
d922d5
-		exit 1
d922d5
-	fi
d922d5
 	if $(lsblk -a | grep -iq raid)
d922d5
 	then
d922d5
 		# donot run mdadm -Ss directly if there are RAIDs working.
d922d5
@@ -231,6 +214,7 @@ check() {
d922d5
 		if [ $? -eq 0 ]; then
d922d5
 			die "This command shouldn't run successfully"
d922d5
 		fi
d922d5
+	;;
d922d5
 	spares )
d922d5
 		spares=$(tr '] ' '\012\012' < /proc/mdstat | grep -c '(S)' || exit 0)
d922d5
 		[ $spares -ne $2 ] &&
d922d5
-- 
d922d5
2.7.4
d922d5