Skip to content

Commit 4e2c5a8

Browse files
committed
Merge: redhat/spec: Install all selftests in a single step
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-10/-/merge_requests/286 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> Approved-by: Felix Maurer <fmaurer@redhat.com> Approved-by: Hangbin Liu <haliu@redhat.com> Approved-by: Herton R. Krzesinski <herton@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: Jan Stancek <jstancek@redhat.com>
2 parents 752965f + 929f055 commit 4e2c5a8

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
@@ -3222,7 +3222,8 @@ pushd tools/testing/selftests
32223222
%undefine _fortify_level
32233223
export CFLAGS="%{build_cflags}"
32243224

3225-
%{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
3225+
TARGETS="bpf cgroup mm net net/forwarding net/mptcp netfilter tc-testing memfd drivers/net/bonding iommu cachestat"
3226+
%{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}"
32263227

32273228
# Restore the original level of source fortification
32283229
%define _fortify_level %{_fortify_level_bak}
@@ -3232,9 +3233,13 @@ export CFLAGS="%{build_cflags}"
32323233
# kernel livepatching selftest test_modules will build against
32333234
# /lib/modules/$(shell uname -r)/build tree unless KDIR is set
32343235
export KDIR=$(realpath $(pwd)/../../..)
3235-
%{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
3236+
%{make} %{?_smp_mflags} ARCH=$Arch V=1 TARGETS="livepatch" SKIP_TARGETS="" $force_targets VMLINUX_H="${RPM_VMLINUX_H}" && TARGETS="${TARGETS} livepatch" || true
32363237
%endif
32373238

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

0 commit comments

Comments
 (0)