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

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