File ltp-stable.spec of Package ltp-stable

#
# spec file for package ltp
#
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#

#!BuildIgnore: pesign-obs-integration

%define _lto_cflags %{nil}
%global __requires_exclude expect
%global flavor @BUILD_FLAVOR@%nil

Version:        20190517
Release:        0
%if "%{flavor}" != ""
Name:           ltp-stable%{?flavor:-}%{?flavor}
Provides:       ltp = %{version}-%{release}
%else
Name:           ltp-stable
%endif
Summary:        The Linux Test Project
License:        GPL-2.0-or-later
Group:          System/Benchmark
URL:            http://linux-test-project.github.io
Source:         ltp-%{version}.tar.xz
Source1:        ltp-stable-rpmlintrc
Source99:       baselibs.conf
Patch1:         add-fsstress.patch
Patch2:         fix-cpuctl-tests-output-dir.patch
Patch100: openposix-ulp-v11.patch
Patch101: ulp-multithread-test-v7.patch
Patch102: 0001-ioctl09-Use-proper-device-for-partitioning.patch
Patch103: 0002-correct_the_length_parameter_for_perf_munmap.patch
Patch104: 0003-ima_kexec_sh_Detect_kexec_reuse_cmdline_support.patch

BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  bison
BuildRequires:  flex
BuildRequires:  gcc-c++
%if 0%{?suse_version} >= 1500 || 0%{?is_opensuse}
%if "%{flavor}" != ""
BuildRequires:  kernel-%{flavor}-devel
%else
%ifnarch %{ix86} s390
BuildRequires:  kernel-default-devel
%endif
%endif
%endif
BuildRequires:  keyutils-devel
BuildRequires:  libacl-devel
BuildRequires:  libaio-devel
BuildRequires:  libattr-devel
BuildRequires:  libcap-devel

%if 0%{?is_opensuse}
BuildRequires:  libmnl-devel
%else
%ifnarch %{ix86}
BuildRequires:  libmnl-devel
%endif
%endif

BuildRequires:  libopenssl-devel
BuildRequires:  perl
BuildRequires:  perl-macros
BuildRequires:  pkgconfig
BuildRequires:  xfsprogs-devel
BuildRequires:  libtirpc-devel
BuildRequires:  xz
Recommends:     acl
Recommends:     apparmor-parser
Recommends:     apparmor-utils
Recommends:     attr
Recommends:     audit
Recommends:     bc
Recommends:     bind
Recommends:     binutils
Recommends:     dhcp-client
Recommends:     dhcp-server
Recommends:     dnsmasq
Recommends:     dosfstools
Recommends:     diffutils
Recommends:     e2fsprogs
Recommends:     ethtool
Recommends:     evmctl
Recommends:     exfat-utils
Recommends:     fuse-exfat
Recommends:     gcc
Recommends:     gdb
Recommends:     ibmtss
Recommends:     iptables
Recommends:     iputils
%if 0%{?suse_version} >= 1500 || 0%{?is_opensuse}
%if "%{flavor}" == ""
Recommends:     kernel-default-extra
%endif
%endif
Recommends:     ltrace
Recommends:     lvm2
Recommends:     make
Recommends:     net-tools
Recommends:     net-tools-deprecated
Recommends:     nfs-client
Recommends:     nfs-kernel-server
Recommends:     ntfsprogs
Recommends:     numactl
Recommends:     psmisc
Recommends:     quota
Recommends:     rpcbind
Recommends:     rsync
Recommends:     squashfs
Recommends:     sssd-tools
Recommends:     strace
Recommends:     sudo
Recommends:     sysstat
Recommends:     tcpdump
Recommends:     telnet
Recommends:     telnet-server
Recommends:     tpm-tools
Recommends:     traceroute
Recommends:     vsftpd
Recommends:     wget
Recommends:     wireguard-tools
Recommends:     xfsprogs
Recommends:     xinetd
Recommends:     expect
Recommends:     exfatprogs
Conflicts:      ltp
Conflicts:      qa_test_ltp
%{perl_requires}
%if 0%{?sle_version} >= 120500 || 0%{?is_opensuse}
BuildRequires:  libnuma-devel
%else
%ifnarch %{ix86} s390 s390x aarch64 armv7l
BuildRequires:  libnuma-devel
%endif
%endif

%if 0%{?suse_version} >= 1100 || 0%{?is_opensuse}
BuildRequires:  libuuid-devel
%endif

%if "%{flavor}" == "64kb"
ExclusiveArch:  aarch64
%endif

%if "%{flavor}" == "rt"
%if 0%{?is_opensuse}
ExclusiveArch: do_not_build
%else
%if 0%{?suse_version} < 1600
ExclusiveArch:  x86_64
%else
ExclusiveArch:  x86_64 aarch64
%endif
%endif
%endif

%if "%{flavor}" == "azure"
%if 0%{?is_opensuse} || 0%{?suse_version} >= 1600
ExclusiveArch: do_not_build
%else
%if 0%{?sle_version} >= 150400
ExclusiveArch:  x86_64 aarch64
%else
%if 0%{?sle_version} >= 150200
ExclusiveArch:  x86_64
%endif
%endif
%endif
%endif

%description
A collection of test suites to validate the reliability, robustness and
stability of Linux. It provides tools for testing the kernel and
related features.

%prep
%autosetup -p1 -n ltp-%{version}

%ifarch %{ix86}
%define prefix /opt/ltp-32
%else
%define prefix /opt/ltp
%endif

# override release VERSION with commit based version set by the OBS service
echo '%{version}' > VERSION

%build
make %{?_smp_mflags} autotools
%configure \
  --prefix=%{prefix} \
  --bindir=%{prefix}/bin \
  --exec-prefix=%{prefix}/usr \
  --with-realtime-testsuite \
  --with-open-posix-testsuite
make all %{?_smp_mflags}

%install
%make_install

# Deal with openposix test binaries and create runtest file
mkdir -p %{buildroot}%{prefix}/testcases/bin/openposix

cd testcases/open_posix_testsuite
# Exclude tests which are "build only"
for i in `find conformance/interfaces/ -name '*.run-test' -a ! -name '*-buildonly*'` ; do
 # create runtest openposix file
 echo `basename "$i" .run-test | sed s/-/_/` '${LTPROOT}/testcases/bin/openposix/'$i >> ../../runtest/openposix;
 # install binaries
 mkdir -p %{buildroot}%{prefix}/testcases/bin/openposix/`dirname $i`;
 cp $i %{buildroot}%{prefix}/testcases/bin/openposix/`dirname $i`;
done
cp ../../runtest/openposix %{buildroot}%{prefix}/runtest/
cd ../..

# Exclude tst_brkm
HARDLINKS1="tst_exit tst_fs_has_free tst_brk"
HARDLINKS2="tst_res tst_ncpus tst_ncpus_conf tst_ncpus_max tst_resm"
cd %{buildroot}%{prefix}/testcases/bin
for n in $HARDLINKS1 $HARDLINKS2; do
 ln -s -f tst_brkm $n
done

# remove common noarch files which we don't need and prevent installing 64bit
# and 32bit packages on the same system
rm -rfv %{buildroot}%{_bindir}/execltp %{buildroot}%{_mandir}

%files
%license COPYING
%if %rpm_vercmp %{version} 20240129 >= 0
%doc README.rst INSTALL
%else
%doc README.md INSTALL
%endif
%{prefix}

%changelog
openSUSE Build Service is sponsored by