Package the tests suite as subpackage

This commit is contained in:
Peter Hutterer 2019-03-21 11:18:49 +10:00
parent 8bdce90385
commit c358832c15
2 changed files with 87 additions and 2 deletions

View File

@ -0,0 +1,66 @@
From b8123db0df7f1d358bcd2a1cc984095f4091fe61 Mon Sep 17 00:00:00 2001
From: Peter Hutterer <peter.hutterer@who-t.net>
Date: Fri, 15 Mar 2019 10:23:25 +1000
Subject: [PATCH libinput] meson.build: make valgrind optional
Now that we're providing the test suite as installed option, distributions
will likely include it as a test package. valgrind is only used for the
meson-specifc test setup. So let's make it optional.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
---
.gitlab-ci.yml | 8 +++++---
meson.build | 30 +++++++++++++++++-------------
2 files changed, 22 insertions(+), 16 deletions(-)
diff --git a/meson.build b/meson.build
index 6e1e5590..cb3218b2 100644
--- a/meson.build
+++ b/meson.build
@@ -665,7 +665,6 @@ endif
# dependencies
if get_option('tests')
dep_check = dependency('check', version : '>= 0.9.10')
- valgrind = find_program('valgrind')
leftover_rules = find_program('test/check-leftover-udev-rules.sh')
test('leftover-rules', leftover_rules, is_parallel : false)
@@ -865,18 +864,23 @@ if get_option('tests')
libinput_test_runner,
args: ['--filter-deviceless'])
- valgrind_env = environment()
- valgrind_env.set('CK_FORK', 'no')
- valgrind_env.set('USING_VALGRIND', '1')
- valgrind_suppressions_file = join_paths(dir_src_test, 'valgrind.suppressions')
- add_test_setup('valgrind',
- exe_wrapper : [ valgrind,
- '--leak-check=full',
- '--gen-suppressions=all',
- '--error-exitcode=3',
- '--suppressions=' + valgrind_suppressions_file ],
- env : valgrind_env,
- timeout_multiplier : 100)
+ valgrind = find_program('valgrind', required : false)
+ if valgrind.found()
+ valgrind_env = environment()
+ valgrind_env.set('CK_FORK', 'no')
+ valgrind_env.set('USING_VALGRIND', '1')
+ valgrind_suppressions_file = join_paths(dir_src_test, 'valgrind.suppressions')
+ add_test_setup('valgrind',
+ exe_wrapper : [ valgrind,
+ '--leak-check=full',
+ '--gen-suppressions=all',
+ '--error-exitcode=3',
+ '--suppressions=' + valgrind_suppressions_file ],
+ env : valgrind_env,
+ timeout_multiplier : 100)
+ else
+ message('valgrind not found, disabling valgrind test suite')
+ endif
configure_file(output : 'litest-config.h',
install : false,
configuration : litest_config_h)
--
2.20.1

View File

@ -5,7 +5,7 @@
Name: libinput
Version: 1.12.901
Release: 2%{?gitdate:.%{gitdate}git%{gitversion}}%{?dist}
Release: 3%{?gitdate:.%{gitdate}git%{gitversion}}%{?dist}
Summary: Input device library
License: MIT
@ -18,6 +18,8 @@ Source2: commitid
Source0: http://www.freedesktop.org/software/libinput/libinput-%{version}.tar.xz
%endif
Patch01: 0001-meson.build-make-valgrind-optional.patch
BuildRequires: git-core
BuildRequires: gcc gcc-c++
BuildRequires: meson
@ -26,6 +28,7 @@ BuildRequires: pkgconfig(mtdev) >= 1.1.0
BuildRequires: pkgconfig(libevdev) >= 0.4
BuildRequires: pkgconfig(libwacom) >= 0.20
BuildRequires: python3-devel
BuildRequires: check-devel
%description
libinput is a library that handles input devices for display servers and other
@ -53,6 +56,14 @@ Requires: python3-evdev python3-pyudev python3-libevdev
The %{name}-utils package contains tools to debug hardware and analyze
%{name}.
%package test
Summary: libinput integration test suite
Requires: %{name}%{?_isa} = %{version}-%{release}
%description test
The %{name}-test package contains the libinput test suite. It is not
intended to be run by users.
%prep
%autosetup -S git
# Replace whatever the source uses with the approved call
@ -61,7 +72,8 @@ pathfix.py -i %{__python3} -p -n $(git grep -l '#!/usr/bin/.*python3')
%build
%meson -Ddebug-gui=false \
-Ddocumentation=false \
-Dtests=false \
-Dtests=true \
-Dinstall-tests=true \
-Dudev-dir=%{udevdir}
%meson_build
@ -116,7 +128,14 @@ pathfix.py -i %{__python3} -p -n $(git grep -l '#!/usr/bin/.*python3')
%{_mandir}/man1/libinput-record.1*
%{_mandir}/man1/libinput-replay.1*
%files test
%{_libexecdir}/libinput/libinput-test-suite
%{_mandir}/man1/libinput-test-suite.1*
%changelog
* Thu Mar 21 2019 Peter Hutterer <peter.hutterer@redhat.com> 1.12.901-3
- Package the tests suite as subpackage
* Fri Mar 15 2019 Peter Hutterer <peter.hutterer@redhat.com> 1.12.901-2
- Require python3-libevdev for the utils subpackage