--- /dev/null
+From 82f973442d7a7fe4b08b86aeccd11ac33ecf01d1 Mon Sep 17 00:00:00 2001
+From: Gerald Van Baren <gvb@unssw.com>
+Date: Tue, 25 Oct 2011 22:17:17 -0400
+Subject: [PATCH] Fix deprecated/removed spinlock declaration
+
+Signed-off-by: Gerald Van Baren <gvb@unssw.com>
+---
+ backfire.c | 3 +--
+ 1 files changed, 1 insertions(+), 2 deletions(-)
+
+diff --git a/backfire.c b/backfire.c
+index aaf9c4a..0e9a0df 100644
+--- a/src/backfire/backfire.c
++++ b/src/backfire/backfire.c
+@@ -24,7 +24,6 @@
+ #include <linux/sched.h>
+ #include <linux/cpumask.h>
+ #include <linux/time.h>
+-#include <linux/smp_lock.h>
+ #include <linux/types.h>
+ #include <linux/errno.h>
+ #include <linux/miscdevice.h>
+@@ -36,7 +35,7 @@
+
+ #define BACKFIRE_MINOR MISC_DYNAMIC_MINOR
+
+-static spinlock_t backfire_state_lock = SPIN_LOCK_UNLOCKED;
++static DEFINE_SPINLOCK(backfire_state_lock);
+ static int backfire_open_cnt; /* #times opened */
+ static int backfire_open_mode; /* special open modes */
+ static struct timeval sendtime; /* when the most recent signal was sent */
+--
+1.7.5.4
+
+Also <asm/system.h> is gone for most architectures since v3.4-rc1~54^2.
+--- rt-tests-1.0/src/backfire/backfire.c.orig 2017-03-29 18:54:44.833362351 +0200
++++ rt-tests-1.0/src/backfire/backfire.c 2017-03-29 18:56:06.890028082 +0200
+@@ -31,7 +31,6 @@
+ #include <linux/spinlock.h>
+
+ #include <asm/uaccess.h>
+-#include <asm/system.h>
+
+ #define BACKFIRE_MINOR MISC_DYNAMIC_MINOR
+
-# TODO:
-# - package the 'backfire' kernel module properly
+#
+# Conditional build:
+%bcond_without kernel # backfire kernel module
+%bcond_without userspace # userspace programs
+%bcond_with verbose # verbose kernel module build (V=1)
+
+%if 0%{?_pld_builder:1} && %{with kernel} && %{with userspace}
+%{error:kernel and userspace cannot be built at the same time on PLD builders}
+exit 1
+%endif
+
+%if %{without userspace}
+%define _enable_debug_packages 0
+%endif
Summary: Programs that test various rt-linux features
Summary(pl.UTF-8): Programy testujące różne właściwości rt-linuksa
-Name: rt-tests
+%define pname rt-tests
+Name: %{pname}%{?_pld_builder:%{?with_kernel:-kernel}}%{_alt_kernel}
Version: 1.0
-Release: 1
+%define rel 1
+Release: %{rel}%{?_pld_builder:%{?with_kernel:@%{_kernel_ver_str}}}
License: GPL v2
Group: Applications/System
-Source0: https://www.kernel.org/pub/linux/utils/rt-tests/%{name}-%{version}.tar.xz
+Source0: https://www.kernel.org/pub/linux/utils/rt-tests/%{pname}-%{version}.tar.xz
# Source0-md5: 3818d2d0a3069291864bf85fde40883b
+# https://bugs.launchpad.net/ubuntu/+source/rt-tests/+bug/881771/+attachment/2572753/+files/0001-Fix-deprecated-removed-spinlock-declaration.patch
+# + http://www.spinics.net/lists/linux-rt-users/msg08966.html
+Patch0: %{pname}-backfire.patch
URL: https://rt.wiki.kernel.org/index.php/Cyclictest
+%{?with_kernel:%{expand:%buildrequires_kernel kernel%%{_alt_kernel}-module-build >= 3:2.6.20.2}}
%ifarch %{ix86} %{x8664} x32 ia64 mipx ppc
BuildRequires: numactl-devel
%endif
+BuildRequires: python-modules
+BuildRequires: rpmbuild(macros) >= 1.701
BuildRequires: tar >= 1:1.22
BuildRequires: xz
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
%description -l pl.UTF-8
Programy testujące różne właściwości rt-linuksa.
+%define kernel_pkg()\
+%package -n kernel%{_alt_kernel}-char-backfire\
+Summary: Linux kernel module to benchmark signal delivery\
+Summary(pl.UTF-8): Moduł jądra Linuksa do testowania dostarczania sygnałów\
+Release: %{rel}@%{_kernel_ver_str}\
+Group: Base/Kernel\
+Requires(post,postun): /sbin/depmod\
+%requires_releq_kernel\
+Requires(postun): %releq_kernel\
+\
+%description -n kernel%{_alt_kernel}-char-backfire\
+Linux kernel "backfire" module sends a signal from driver to user.\
+It's primary use is benchmarking signal delivery.\
+\
+%description -n kernel%{_alt_kernel}-char-backfire -l pl.UTF-8\
+Moduł jądra Linuksa "backfire" wysyła sygnał ze sterownika do\
+użytkownika. Głównym zastosowaniem jest testowanie wydajności\
+dostarczania sygnałów.\
+\
+%if %{with kernel}\
+%files -n kernel%{_alt_kernel}-char-backfire\
+%defattr(644,root,root,755)\
+/lib/modules/%{_kernel_ver}/kernel/drivers/char/backfire.ko*\
+%endif\
+\
+%post -n kernel%{_alt_kernel}-char-backfire\
+%depmod %{_kernel_ver}\
+\
+%postun -n kernel%{_alt_kernel}-char-backfire\
+%depmod %{_kernel_ver}\
+%{nil}
+
+%define build_kernel_pkg()\
+%build_kernel_modules -C src/backfire -m backfire\
+\
+%install_kernel_modules -D installed -m src/backfire/backfire -d kernel/drivers/char\
+%{nil}
+
+%{?with_kernel:%{expand:%create_kernel_packages}}
+
%prep
-%setup -q
+%setup -q -n %{pname}-%{version}
+%patch0 -p1
%build
+%if %{with userspace}
CFLAGS="%{rpmcflags}" \
%{__make} \
prefix="%{_prefix}" \
CC="%{__cc}" \
LDFLAGS="%{rpmldflags}"
+%endif
+
+%{?with_kernel:%{expand:%build_kernel_packages}}
%install
rm -rf $RPM_BUILD_ROOT
+%if %{with userspace}
%{__make} install \
DESTDIR=$RPM_BUILD_ROOT \
prefix="%{_prefix}" \
PYLIB="%{py_sitescriptdir}" \
srcdir="%{_prefix}/src/%{name}-%{version}"
+%py_comp $RPM_BUILD_ROOT%{py_sitescriptdir}
+%py_ocomp $RPM_BUILD_ROOT%{py_sitescriptdir}
+%endif
+
+%if %{with kernel}
+cp -a installed/* $RPM_BUILD_ROOT
+%endif
+
%clean
rm -rf $RPM_BUILD_ROOT
%{_mandir}/man8/signaltest.8*
%{_mandir}/man8/sigwaittest.8*
%{_mandir}/man8/svsematest.8*
-%{py_sitescriptdir}/hwlatdetect.py
+%{py_sitescriptdir}/hwlatdetect.py*
%{_prefix}/src/%{name}-%{version}