Skip to content

Commit 929f055

Browse files
committed
redhat/spec: Install all selftests in a single step
JIRA: https://issues.redhat.com/browse/RHEL-70889 Upstream status: RHEL-only The `make install` command for selftests emits all (sub)test names to kselftest-list.txt. The problem is that each invocation of the command overrides the file so running `make install` multiple times (which we do as we build livepatch selftests separately) will result in an incomplete kselftest-list.txt. To fix this, separate the build stage from the install stage and make sure that the install target is called only once for all the previously built selftest targets. Signed-off-by: Viktor Malik <vmalik@redhat.com>
1 parent 35e8b26 commit 929f055

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

redhat/kernel.spec.template

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3162,7 +3162,8 @@ pushd tools/testing/selftests
31623162
%undefine _fortify_level
31633163
export CFLAGS="%{build_cflags}"
31643164

3165-
%{make} %{?_smp_mflags} EXTRA_CFLAGS="${RPM_OPT_FLAGS}" EXTRA_CXXFLAGS="${RPM_OPT_FLAGS}" EXTRA_LDFLAGS="%{__global_ldflags}" ARCH=$Arch V=1 TARGETS="bpf cgroup mm net net/forwarding net/mptcp netfilter tc-testing memfd drivers/net/bonding iommu cachestat" SKIP_TARGETS="" $force_targets INSTALL_PATH=%{buildroot}%{_libexecdir}/kselftests VMLINUX_H="${RPM_VMLINUX_H}" install
3165+
TARGETS="bpf cgroup mm net net/forwarding net/mptcp netfilter tc-testing memfd drivers/net/bonding iommu cachestat"
3166+
%{make} %{?_smp_mflags} EXTRA_CFLAGS="${RPM_OPT_FLAGS}" EXTRA_CXXFLAGS="${RPM_OPT_FLAGS}" EXTRA_LDFLAGS="%{__global_ldflags}" ARCH=$Arch V=1 TARGETS="$TARGETS" SKIP_TARGETS="" $force_targets VMLINUX_H="${RPM_VMLINUX_H}"
31663167

31673168
# Restore the original level of source fortification
31683169
%define _fortify_level %{_fortify_level_bak}
@@ -3172,9 +3173,13 @@ export CFLAGS="%{build_cflags}"
31723173
# kernel livepatching selftest test_modules will build against
31733174
# /lib/modules/$(shell uname -r)/build tree unless KDIR is set
31743175
export KDIR=$(realpath $(pwd)/../../..)
3175-
%{make} %{?_smp_mflags} ARCH=$Arch V=1 TARGETS="livepatch" SKIP_TARGETS="" $force_targets INSTALL_PATH=%{buildroot}%{_libexecdir}/kselftests VMLINUX_H="${RPM_VMLINUX_H}" install || true
3176+
%{make} %{?_smp_mflags} ARCH=$Arch V=1 TARGETS="livepatch" SKIP_TARGETS="" $force_targets VMLINUX_H="${RPM_VMLINUX_H}" && TARGETS="${TARGETS} livepatch" || true
31763177
%endif
31773178

3179+
# We must install all the targets in a single step as each `make install`
3180+
# command overrides the kselftest-list.txt file.
3181+
%{make} ARCH=$Arch TARGETS="${TARGETS}" SKIP_TARGETS="" $force_targets INSTALL_PATH=%{buildroot}%{_libexecdir}/kselftests install
3182+
31783183
# 'make install' for bpf is broken and upstream refuses to fix it.
31793184
# Install the needed files manually.
31803185
%{log_msg "install selftests"}

0 commit comments

Comments
 (0)