public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Peter Rajnoha <prajnoha@redhat.com>
To: git-commits@fedoraproject.org
Subject: [rpms/mdadm] rawhide: Add mdadm-testsuite subpackage.
Date: Fri, 13 Nov 2026 10:59:45 GMT	[thread overview]
Message-ID: <179456758551.1.17588594502475931204.rpms-mdadm-e5d461f834b0@fedoraproject.org> (raw)

A new commit has been pushed.

Repo   : rpms/mdadm
Branch : rawhide
Commit : e5d461f834b041281b0eab8d9c449bfdf5ffbe2a
Author : Peter Rajnoha <prajnoha@redhat.com>
Date   : 2026-11-13T10:28:08+01:00
Stats  : +160/-1 in 3 file(s)
URL    : https://src.fedoraproject.org/rpms/mdadm/c/e5d461f834b041281b0eab8d9c449bfdf5ffbe2a?branch=rawhide

Log:
Add mdadm-testsuite subpackage.

---
diff --git a/0001-Makefile-add-install-testsuite-target.patch b/0001-Makefile-add-install-testsuite-target.patch
new file mode 100644
index 0000000..1ce9ac0
--- /dev/null
+++ b/0001-Makefile-add-install-testsuite-target.patch
@@ -0,0 +1,89 @@
+From a41df97e284e1fd66791a37c63e00ffd1ca7a30d Mon Sep 17 00:00:00 2001
+From: Peter Rajnoha <prajnoha@redhat.com>
+Date: Wed, 11 Nov 2026 09:33:29 +0100
+Subject: [PATCH 1/2] Makefile: add install-testsuite target
+
+Add a dedicated target that installs the mdadm test suite:
+
+- add misc/mdadm-testsuite, the runner template; it is installed as
+  mdadm-testsuite in BINDIR
+- the test scripts and the test driver are installed to
+  MISCDIR/testsuite (/usr/share/mdadm/testsuite by default)
+- the swap_super and raid6check helpers are installed to
+  LIB_DIR/testsuite (/usr/libexec/mdadm/testsuite by default), with a
+  symlink to raid6check in the data directory so that the tests can call
+  ./raid6check unchanged
+
+The runner changes into the test directory and exports dir so that
+helpers are found. uninstall removes the new files.
+
+Signed-off-by: Peter Rajnoha <prajnoha@redhat.com>
+---
+ Makefile             | 18 ++++++++++++++++++
+ misc/mdadm-testsuite | 11 +++++++++++
+ 2 files changed, 29 insertions(+)
+ create mode 100644 misc/mdadm-testsuite
+
+diff --git a/Makefile b/Makefile
+index 40fb3b9c..e9b820e8 100644
+--- a/Makefile
++++ b/Makefile
+@@ -121,6 +121,8 @@ MDMON_DIR = $(RUN_DIR)
+ FAILED_SLOTS_DIR = $(RUN_DIR)/failed-slots
+ SYSTEMD_DIR=/lib/systemd/system
+ LIB_DIR=/usr/libexec/mdadm
++TESTSDIR = $(MISCDIR)/testsuite
++TESTSEXECDIR = $(LIB_DIR)/testsuite
+ 
+ COROSYNC:=$(shell $(PKG_CONFIG) --exists corosync || echo -DNO_COROSYNC)
+ DLM:=$(shell $(PKG_CONFIG) --exists libdlm || echo -DNO_DLM)
+@@ -328,6 +330,20 @@ install-bin: mdadm mdmon
+ 	$(INSTALL) -D $(STRIP) -m 755 mdadm $(DESTDIR)$(BINDIR)/mdadm
+ 	$(INSTALL) -D $(STRIP) -m 755 mdmon $(DESTDIR)$(BINDIR)/mdmon
+ 
++install-testsuite: swap_super raid6check
++	$(INSTALL) -d $(DESTDIR)$(TESTSDIR) $(DESTDIR)$(TESTSEXECDIR)
++	@for file in $$(find tests -type f | sort); do \
++	   $(ECHO) $(INSTALL) -D -m 644 $$file $(DESTDIR)$(TESTSDIR)/$$file ; \
++	   $(INSTALL) -D -m 644 $$file $(DESTDIR)$(TESTSDIR)/$$file ; \
++	done
++	$(INSTALL) -D -m 755 test $(DESTDIR)$(TESTSDIR)/test
++	$(INSTALL) -D -m 755 swap_super $(DESTDIR)$(TESTSEXECDIR)/swap_super
++	$(INSTALL) -D -m 755 raid6check $(DESTDIR)$(TESTSEXECDIR)/raid6check
++	ln -sfr $(DESTDIR)$(TESTSEXECDIR)/raid6check $(DESTDIR)$(TESTSDIR)/raid6check
++	@sed -e 's,@TESTSDIR@,$(TESTSDIR),g;s,@TESTSEXECDIR@,$(TESTSEXECDIR),g' misc/mdadm-testsuite > .install.tmp.6
++	$(INSTALL) -D -m 755 .install.tmp.6 $(DESTDIR)$(BINDIR)/mdadm-testsuite
++	@rm -f .install.tmp.6
++
+ uninstall:
+ 	rm -f $(DESTDIR)$(BINDIR)/mdadm $(DESTDIR)$(BINDIR)/mdmon
+ 	rm -f $(DESTDIR)$(MAN8DIR)/mdadm.8 $(DESTDIR)$(MAN8DIR)/mdmon.8 $(DESTDIR)$(MAN4DIR)/md.4 $(DESTDIR)$(MAN5DIR)/mdadm.conf.5
+@@ -335,6 +351,8 @@ uninstall:
+ 	rm -f $(SYSTEMD_UNITS:%=$(DESTDIR)$(SYSTEMD_DIR)/%)
+ 	rm -f $(DESTDIR)$(SYSTEMD_DIR)-shutdown/mdadm.shutdown
+ 	rm -f $(DESTDIR)$(MISCDIR)/mdcheck
++	rm -f $(DESTDIR)$(BINDIR)/mdadm-testsuite
++	rm -rf $(DESTDIR)$(TESTSDIR) $(DESTDIR)$(TESTSEXECDIR)
+ 
+ test: mdadm mdmon test_stripe swap_super raid6check
+ 	@echo "Please run './test' as root"
+diff --git a/misc/mdadm-testsuite b/misc/mdadm-testsuite
+new file mode 100644
+index 00000000..72733bbc
+--- /dev/null
++++ b/misc/mdadm-testsuite
+@@ -0,0 +1,11 @@
++#!/bin/bash
++#
++# Run the installed mdadm test suite.
++# Arguments are passed to the test runner, see "mdadm-testsuite --help".
++#
++# Test cases are looked up relative to the test suite directory, so the
++# runner is started from there.
++
++cd @TESTSDIR@ || exit 1
++export dir=${dir:-@TESTSEXECDIR@}
++exec ./test "$@"
+-- 
+2.56.1
+

diff --git a/0002-tests-don-t-stop-running-arrays-when-check_env-refus.patch b/0002-tests-don-t-stop-running-arrays-when-check_env-refus.patch
new file mode 100644
index 0000000..9867cbc
--- /dev/null
+++ b/0002-tests-don-t-stop-running-arrays-when-check_env-refus.patch
@@ -0,0 +1,40 @@
+From 9acc99f67f4422aeed1fb92a37f9eb8c343c2a80 Mon Sep 17 00:00:00 2001
+From: Peter Rajnoha <prajnoha@redhat.com>
+Date: Thu, 12 Nov 2026 14:10:50 +0100
+Subject: [PATCH 2/2] tests: don't stop running arrays when check_env refuses
+ to run
+
+do_setup() installed the cleanup EXIT trap before calling check_env.
+When check_env detected MD arrays that were already set up on the
+system before the tests were started, and then exited, the trap ran
+"mdadm -Ssq", stopping those existing arrays, and removed the IMSM
+systemd environment variables.
+
+Call check_env before installing the traps so that an early refusal
+leaves the pre-existing arrays and the system untouched.
+
+Signed-off-by: Peter Rajnoha <prajnoha@redhat.com>
+---
+ tests/func.sh | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/tests/func.sh b/tests/func.sh
+index 8c444543..2971d456 100644
+--- a/tests/func.sh
++++ b/tests/func.sh
+@@ -258,10 +258,11 @@ clean_systemd_env() {
+ }
+ 
+ do_setup() {
++	check_env
++
+ 	trap cleanup 0 1 3 15
+ 	trap ctrl_c 2
+ 
+-	check_env
+ 	setup_systemd_env
+ 	[ -d $logdir ] || mkdir -p $logdir
+ 
+-- 
+2.56.1
+

diff --git a/mdadm.spec b/mdadm.spec
index 4285a1d..71a6b92 100644
--- a/mdadm.spec
+++ b/mdadm.spec
@@ -1,8 +1,9 @@
 %bcond abrt %{undefined rhel}
+%global enable_testsuite 1
 
 Name:        mdadm
 Version:     4.6
-Release:     2%{?dist}
+Release:     3%{?dist}
 Summary:     The mdadm program controls Linux md devices (software RAID arrays)
 URL:         http://www.kernel.org/pub/linux/utils/raid/mdadm/
 License:     GPL-2.0-or-later
@@ -22,6 +23,8 @@ Source11:    https://git.kernel.org/pub/scm/docs/kernel/pgpkeys.git/plain/keys/9
 # Fedora customization patches
 Patch:       mdadm-udev.patch
 Patch:       mdadm-2.5.2-static.patch
+Patch:       0001-Makefile-add-install-testsuite-target.patch
+Patch:       0002-tests-don-t-stop-running-arrays-when-check_env-refus.patch
 
 BuildRequires:    make
 BuildRequires:    systemd-rpm-macros
@@ -56,10 +59,16 @@ file can be used to help with some common tasks.
 %build
 # CXFLAGS is NOT a typo, it's baked into the makefile, not to be confused with CXXFLAGS
 %make_build CXFLAGS="%{optflags} -std=gnu17 -Wno-error=unterminated-string-initialization" LDFLAGS="$RPM_LD_FLAGS" SYSCONFDIR="%{_sysconfdir}" mdadm mdmon raid6check raid6check.man
+%if %{enable_testsuite}
+%make_build CXFLAGS="%{optflags} -std=gnu17 -Wno-error=unterminated-string-initialization" LDFLAGS="$RPM_LD_FLAGS" SYSCONFDIR="%{_sysconfdir}" swap_super
+%endif
 
 
 %install
 %make_install MANDIR=%{_mandir} BINDIR=%{_sbindir} SYSTEMD_DIR=%{_unitdir} UDEVDIR=%{_prefix}/lib/udev/ install install-systemd
+%if %{enable_testsuite}
+%{__make} install-testsuite DESTDIR=%{buildroot} INSTALL="/usr/bin/install -p" BINDIR=%{_sbindir} TESTSEXECDIR=%{_sbindir} TESTSDIR=%{_datadir}/%{name}-testsuite
+%endif
 install -Dp -m 755 %{SOURCE1} %{buildroot}%{_sbindir}/raid-check
 install -Dp -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/sysconfig/raid-check
 mkdir -p -m 710 %{buildroot}/run/%{name}
@@ -123,7 +132,28 @@ install -Dm644 raid6check.man %{buildroot}/%{_mandir}/man8/raid6check.man
 %{_datadir}/%{name}/
 
 
+%if %{enable_testsuite}
+%package testsuite
+Summary:        Functional testsuite for mdadm
+License:        GPL-2.0-or-later
+Requires:       %{name} = %{version}-%{release}
+
+%description testsuite
+An extensive functional testsuite for mdadm. Run it with mdadm-testsuite
+as root on a machine where md arrays can be created.
+
+%files testsuite
+%license COPYING
+%{_sbindir}/mdadm-testsuite
+%{_sbindir}/swap_super
+%{_datadir}/%{name}-testsuite/
+%endif
+
+
 %changelog
+* Fri Nov 13 2026 Peter Rajnoha <prajnoha@redhat.com> - 4.6-3
+- Add mdadm-testsuite subpackage.
+
 * Thu Jul 16 2026 Fedora Release Engineering <releng@fedoraproject.org> - 4.6-2
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_45_Mass_Rebuild
 

                 reply	other threads:[~2026-11-13 10:59 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179456758551.1.17588594502475931204.rpms-mdadm-e5d461f834b0@fedoraproject.org \
    --to=prajnoha@redhat.com \
    --cc=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox