[OS-BUILD PATCHv5 1/18] redhat: kernel.spec: selftests: abort on build failure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Prarit Bhargava <prarit@xxxxxxxxxx>

redhat: kernel.spec: selftests: abort on build failure

When a selftest does not compile, abort the whole build. We want to know
that we broke selftests by a backport.

This commit is forward ported from RHEL 8. It could not have been forward
ported to ARK: with rebases to the upstream the bpf selftests break all the
time. Now it's the first opportunity when we can take it.

Signed-off-by: Jiri Benc <jbenc@xxxxxxxxxx>
Signed-off-by: Prarit Bhargava <prarit@xxxxxxxxxx>

diff --git a/redhat/Makefile.variables b/redhat/Makefile.variables
index blahblah..blahblah 100644
--- a/redhat/Makefile.variables
+++ b/redhat/Makefile.variables
@@ -124,3 +124,7 @@ RHSELFTESTDATA ?=
 # This variable is used by the redhat/self-tests.  It should not be
 # considered stable and my be changed or removed without warning.
 RHDISTDATADIR ?=
+
+# If set to 1, this variable will cause the kernel package build to fail if
+# the selftests fail to build.
+SPECSELFTESTS_MUST_BUILD ?= 0
diff --git a/redhat/genspec.sh b/redhat/genspec.sh
index blahblah..blahblah 100755
--- a/redhat/genspec.sh
+++ b/redhat/genspec.sh
@@ -65,7 +65,8 @@ test -f "$SOURCES/$SPECFILE" &&
 	s/%%SPECPATCHLIST_CHANGELOG%%/$SPECPATCHLIST_CHANGELOG/
 	s/%%SPECVERSION%%/$SPECVERSION/
 	s/%%SPECKABIVERSION%%/$SPECKABIVERSION/
-	s/%%SPECTARFILE_RELEASE%%/$SPECTARFILE_RELEASE/" "$SOURCES/$SPECFILE"
+	s/%%SPECTARFILE_RELEASE%%/$SPECTARFILE_RELEASE/
+	s/%%SPECSELFTESTS_MUST_BUILD%%/$SPECSELFTESTS_MUST_BUILD/" "$SOURCES/$SPECFILE"
 test -n "$RHSELFTESTDATA" && test -f "$SOURCES/$SPECFILE" && sed -i -e "
 	/%%SPECCHANGELOG%%/r $SOURCES/$SPECCHANGELOG
 	/%%SPECCHANGELOG%%/d" "$SOURCES/$SPECFILE"
diff --git a/redhat/kernel.spec.template b/redhat/kernel.spec.template
index blahblah..blahblah 100755
--- a/redhat/kernel.spec.template
+++ b/redhat/kernel.spec.template
@@ -134,6 +134,10 @@ Summary: The Linux kernel
 # This defines the kabi tarball version
 %define kabiversion %%SPECKABIVERSION%%
 
+# If this variable is set to 1, a bpf selftests build failure will cause a
+# fatal kernel package build error
+%define selftests_must_build %%SPECSELFTESTS_MUST_BUILD%%
+
 #
 # End of genspec.sh variables
 #
@@ -2351,7 +2355,8 @@ export BPFTOOL=$(pwd)/tools/bpf/bpftool/bpftool
 pushd tools/testing/selftests
 # We need to install here because we need to call make with ARCH set which
 # doesn't seem possible to do in the install section.
-%{make} %{?_smp_mflags} ARCH=$Arch V=1 TARGETS="bpf vm livepatch net net/forwarding net/mptcp netfilter tc-testing" SKIP_TARGETS="" INSTALL_PATH=%{buildroot}%{_libexecdir}/kselftests VMLINUX_H="${RPM_VMLINUX_H}" install
+
+%{make} %{?_smp_mflags} ARCH=$Arch V=1 TARGETS="bpf vm livepatch net net/forwarding net/mptcp netfilter tc-testing" SKIP_TARGETS="" FORCE_TARGETS=%{selftests_must_build} INSTALL_PATH=%{buildroot}%{_libexecdir}/kselftests VMLINUX_H="${RPM_VMLINUX_H}" install
 
 # 'make install' for bpf is broken and upstream refuses to fix it.
 # Install the needed files manually.
diff --git a/redhat/self-test/data/centos-2585cf9dfaad.el7 b/redhat/self-test/data/centos-2585cf9dfaad.el7
index blahblah..blahblah 100644
--- a/redhat/self-test/data/centos-2585cf9dfaad.el7
+++ b/redhat/self-test/data/centos-2585cf9dfaad.el7
@@ -68,6 +68,7 @@ SPECKPATCHLEVEL=16
 SPECKSUBLEVEL=0 
 SPECKVERSION=5 
 SPECRELEASED_KERNEL=0 
+SPECSELFTESTS_MUST_BUILD=0 
 SPECTARFILE_RELEASE=5.16.0-0.rc5.6.test 
 SPECVERSION=5.16.0 
 SRPM=../redhat/rpm/SRPMS/kernel-5.16.0-0.rc5.6.test.el7.src.rpm 
diff --git a/redhat/self-test/data/centos-2585cf9dfaad.el7.spec b/redhat/self-test/data/centos-2585cf9dfaad.el7.spec
index blahblah..blahblah 100755
--- a/redhat/self-test/data/centos-2585cf9dfaad.el7.spec
+++ b/redhat/self-test/data/centos-2585cf9dfaad.el7.spec
@@ -11,4 +11,5 @@
 %define patchlevel 16
 %define specrelease 0.rc5.6%{?buildid}%{?dist}
 %define kabiversion 5.16.0-0.rc5.6.test
+%define selftests_must_build 0
 Mon Mar 28 2022 Fedora Kernel Team <kernel-team@xxxxxxxxxxxxxxxxx> [5.16.0-0.rc5.6.test]
diff --git a/redhat/self-test/data/centos-2585cf9dfaad.fc25 b/redhat/self-test/data/centos-2585cf9dfaad.fc25
index blahblah..blahblah 100644
--- a/redhat/self-test/data/centos-2585cf9dfaad.fc25
+++ b/redhat/self-test/data/centos-2585cf9dfaad.fc25
@@ -68,6 +68,7 @@ SPECKPATCHLEVEL=16
 SPECKSUBLEVEL=0 
 SPECKVERSION=5 
 SPECRELEASED_KERNEL=0 
+SPECSELFTESTS_MUST_BUILD=0 
 SPECTARFILE_RELEASE=5.16.0-0.rc5.6.test 
 SPECVERSION=5.16.0 
 SRPM=../redhat/rpm/SRPMS/kernel-5.16.0-0.rc5.6.test.fc25.src.rpm 
diff --git a/redhat/self-test/data/centos-2585cf9dfaad.fc25.spec b/redhat/self-test/data/centos-2585cf9dfaad.fc25.spec
index blahblah..blahblah 100755
--- a/redhat/self-test/data/centos-2585cf9dfaad.fc25.spec
+++ b/redhat/self-test/data/centos-2585cf9dfaad.fc25.spec
@@ -11,4 +11,5 @@
 %define patchlevel 16
 %define specrelease 0.rc5.6%{?buildid}%{?dist}
 %define kabiversion 5.16.0-0.rc5.6.test
+%define selftests_must_build 0
 Mon Mar 28 2022 Fedora Kernel Team <kernel-team@xxxxxxxxxxxxxxxxx> [5.16.0-0.rc5.6.test]
diff --git a/redhat/self-test/data/centos-78e36f3b0dae.el7 b/redhat/self-test/data/centos-78e36f3b0dae.el7
index blahblah..blahblah 100644
--- a/redhat/self-test/data/centos-78e36f3b0dae.el7
+++ b/redhat/self-test/data/centos-78e36f3b0dae.el7
@@ -68,6 +68,7 @@ SPECKPATCHLEVEL=17
 SPECKSUBLEVEL=0 
 SPECKVERSION=5 
 SPECRELEASED_KERNEL=0 
+SPECSELFTESTS_MUST_BUILD=0 
 SPECTARFILE_RELEASE=5.17.0-0.rc0.78e36f3b0dae.6.test 
 SPECVERSION=5.17.0 
 SRPM=../redhat/rpm/SRPMS/kernel-5.17.0-0.rc0.78e36f3b0dae.6.test.el7.src.rpm 
diff --git a/redhat/self-test/data/centos-78e36f3b0dae.el7.spec b/redhat/self-test/data/centos-78e36f3b0dae.el7.spec
index blahblah..blahblah 100755
--- a/redhat/self-test/data/centos-78e36f3b0dae.el7.spec
+++ b/redhat/self-test/data/centos-78e36f3b0dae.el7.spec
@@ -12,4 +12,5 @@
 %define patchlevel 17
 %define specrelease 0.rc0.78e36f3b0dae.6%{?buildid}%{?dist}
 %define kabiversion 5.17.0-0.rc0.78e36f3b0dae.6.test
+%define selftests_must_build 0
 Mon Mar 28 2022 Fedora Kernel Team <kernel-team@xxxxxxxxxxxxxxxxx> [5.17.0-0.rc0.78e36f3b0dae.6.test]
diff --git a/redhat/self-test/data/centos-78e36f3b0dae.fc25 b/redhat/self-test/data/centos-78e36f3b0dae.fc25
index blahblah..blahblah 100644
--- a/redhat/self-test/data/centos-78e36f3b0dae.fc25
+++ b/redhat/self-test/data/centos-78e36f3b0dae.fc25
@@ -68,6 +68,7 @@ SPECKPATCHLEVEL=17
 SPECKSUBLEVEL=0 
 SPECKVERSION=5 
 SPECRELEASED_KERNEL=0 
+SPECSELFTESTS_MUST_BUILD=0 
 SPECTARFILE_RELEASE=5.17.0-0.rc0.78e36f3b0dae.6.test 
 SPECVERSION=5.17.0 
 SRPM=../redhat/rpm/SRPMS/kernel-5.17.0-0.rc0.78e36f3b0dae.6.test.fc25.src.rpm 
diff --git a/redhat/self-test/data/centos-78e36f3b0dae.fc25.spec b/redhat/self-test/data/centos-78e36f3b0dae.fc25.spec
index blahblah..blahblah 100755
--- a/redhat/self-test/data/centos-78e36f3b0dae.fc25.spec
+++ b/redhat/self-test/data/centos-78e36f3b0dae.fc25.spec
@@ -12,4 +12,5 @@
 %define patchlevel 17
 %define specrelease 0.rc0.78e36f3b0dae.6%{?buildid}%{?dist}
 %define kabiversion 5.17.0-0.rc0.78e36f3b0dae.6.test
+%define selftests_must_build 0
 Mon Mar 28 2022 Fedora Kernel Team <kernel-team@xxxxxxxxxxxxxxxxx> [5.17.0-0.rc0.78e36f3b0dae.6.test]
diff --git a/redhat/self-test/data/centos-df0cc57e057f.el7 b/redhat/self-test/data/centos-df0cc57e057f.el7
index blahblah..blahblah 100644
--- a/redhat/self-test/data/centos-df0cc57e057f.el7
+++ b/redhat/self-test/data/centos-df0cc57e057f.el7
@@ -68,6 +68,7 @@ SPECKPATCHLEVEL=16
 SPECKSUBLEVEL=0 
 SPECKVERSION=5 
 SPECRELEASED_KERNEL=0 
+SPECSELFTESTS_MUST_BUILD=0 
 SPECTARFILE_RELEASE=5.16.0-6.test 
 SPECVERSION=5.16.0 
 SRPM=../redhat/rpm/SRPMS/kernel-5.16.0-6.test.el7.src.rpm 
diff --git a/redhat/self-test/data/centos-df0cc57e057f.el7.spec b/redhat/self-test/data/centos-df0cc57e057f.el7.spec
index blahblah..blahblah 100755
--- a/redhat/self-test/data/centos-df0cc57e057f.el7.spec
+++ b/redhat/self-test/data/centos-df0cc57e057f.el7.spec
@@ -11,4 +11,5 @@
 %define patchlevel 16
 %define specrelease 6%{?buildid}%{?dist}
 %define kabiversion 5.16.0-6.test
+%define selftests_must_build 0
 Mon Mar 28 2022 Fedora Kernel Team <kernel-team@xxxxxxxxxxxxxxxxx> [5.16.0-6.test]
diff --git a/redhat/self-test/data/centos-df0cc57e057f.fc25 b/redhat/self-test/data/centos-df0cc57e057f.fc25
index blahblah..blahblah 100644
--- a/redhat/self-test/data/centos-df0cc57e057f.fc25
+++ b/redhat/self-test/data/centos-df0cc57e057f.fc25
@@ -68,6 +68,7 @@ SPECKPATCHLEVEL=16
 SPECKSUBLEVEL=0 
 SPECKVERSION=5 
 SPECRELEASED_KERNEL=0 
+SPECSELFTESTS_MUST_BUILD=0 
 SPECTARFILE_RELEASE=5.16.0-6.test 
 SPECVERSION=5.16.0 
 SRPM=../redhat/rpm/SRPMS/kernel-5.16.0-6.test.fc25.src.rpm 
diff --git a/redhat/self-test/data/centos-df0cc57e057f.fc25.spec b/redhat/self-test/data/centos-df0cc57e057f.fc25.spec
index blahblah..blahblah 100755
--- a/redhat/self-test/data/centos-df0cc57e057f.fc25.spec
+++ b/redhat/self-test/data/centos-df0cc57e057f.fc25.spec
@@ -11,4 +11,5 @@
 %define patchlevel 16
 %define specrelease 6%{?buildid}%{?dist}
 %define kabiversion 5.16.0-6.test
+%define selftests_must_build 0
 Mon Mar 28 2022 Fedora Kernel Team <kernel-team@xxxxxxxxxxxxxxxxx> [5.16.0-6.test]
diff --git a/redhat/self-test/data/centos-fce15c45d3fb.el7 b/redhat/self-test/data/centos-fce15c45d3fb.el7
index blahblah..blahblah 100644
--- a/redhat/self-test/data/centos-fce15c45d3fb.el7
+++ b/redhat/self-test/data/centos-fce15c45d3fb.el7
@@ -68,6 +68,7 @@ SPECKPATCHLEVEL=16
 SPECKSUBLEVEL=0 
 SPECKVERSION=5 
 SPECRELEASED_KERNEL=0 
+SPECSELFTESTS_MUST_BUILD=0 
 SPECTARFILE_RELEASE=5.16.0-0.rc5.fce15c45d3fb.6.test 
 SPECVERSION=5.16.0 
 SRPM=../redhat/rpm/SRPMS/kernel-5.16.0-0.rc5.fce15c45d3fb.6.test.el7.src.rpm 
diff --git a/redhat/self-test/data/centos-fce15c45d3fb.el7.spec b/redhat/self-test/data/centos-fce15c45d3fb.el7.spec
index blahblah..blahblah 100755
--- a/redhat/self-test/data/centos-fce15c45d3fb.el7.spec
+++ b/redhat/self-test/data/centos-fce15c45d3fb.el7.spec
@@ -12,4 +12,5 @@
 %define patchlevel 16
 %define specrelease 0.rc5.fce15c45d3fb.6%{?buildid}%{?dist}
 %define kabiversion 5.16.0-0.rc5.fce15c45d3fb.6.test
+%define selftests_must_build 0
 Mon Mar 28 2022 Fedora Kernel Team <kernel-team@xxxxxxxxxxxxxxxxx> [5.16.0-0.rc5.fce15c45d3fb.6.test]
diff --git a/redhat/self-test/data/centos-fce15c45d3fb.fc25 b/redhat/self-test/data/centos-fce15c45d3fb.fc25
index blahblah..blahblah 100644
--- a/redhat/self-test/data/centos-fce15c45d3fb.fc25
+++ b/redhat/self-test/data/centos-fce15c45d3fb.fc25
@@ -68,6 +68,7 @@ SPECKPATCHLEVEL=16
 SPECKSUBLEVEL=0 
 SPECKVERSION=5 
 SPECRELEASED_KERNEL=0 
+SPECSELFTESTS_MUST_BUILD=0 
 SPECTARFILE_RELEASE=5.16.0-0.rc5.fce15c45d3fb.6.test 
 SPECVERSION=5.16.0 
 SRPM=../redhat/rpm/SRPMS/kernel-5.16.0-0.rc5.fce15c45d3fb.6.test.fc25.src.rpm 
diff --git a/redhat/self-test/data/centos-fce15c45d3fb.fc25.spec b/redhat/self-test/data/centos-fce15c45d3fb.fc25.spec
index blahblah..blahblah 100755
--- a/redhat/self-test/data/centos-fce15c45d3fb.fc25.spec
+++ b/redhat/self-test/data/centos-fce15c45d3fb.fc25.spec
@@ -12,4 +12,5 @@
 %define patchlevel 16
 %define specrelease 0.rc5.fce15c45d3fb.6%{?buildid}%{?dist}
 %define kabiversion 5.16.0-0.rc5.fce15c45d3fb.6.test
+%define selftests_must_build 0
 Mon Mar 28 2022 Fedora Kernel Team <kernel-team@xxxxxxxxxxxxxxxxx> [5.16.0-0.rc5.fce15c45d3fb.6.test]
diff --git a/redhat/self-test/data/fedora-2585cf9dfaad.el7 b/redhat/self-test/data/fedora-2585cf9dfaad.el7
index blahblah..blahblah 100644
--- a/redhat/self-test/data/fedora-2585cf9dfaad.el7
+++ b/redhat/self-test/data/fedora-2585cf9dfaad.el7
@@ -67,6 +67,7 @@ SPECKPATCHLEVEL=16
 SPECKSUBLEVEL=0 
 SPECKVERSION=5 
 SPECRELEASED_KERNEL=0 
+SPECSELFTESTS_MUST_BUILD=0 
 SPECTARFILE_RELEASE=5.16-rc5 
 SPECVERSION=5.16.0 
 SRPM=../redhat/rpm/SRPMS/kernel-5.16.0-0.rc5.6.test.el7.src.rpm 

--
https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2021
_______________________________________________
kernel mailing list -- kernel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to kernel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/kernel@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue




[Index of Archives]     [Fedora General Discussion]     [Older Fedora Users Archive]     [Fedora Advisory Board]     [Fedora Security]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Mentors]     [Fedora Package Announce]     [Fedora Package Review]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Coolkey]     [Yum Users]     [Tux]     [Yosemite News]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [USB]     [Asterisk PBX]

  Powered by Linux