Add -tests subpackage with unit tests that can run in CI

Resolves: RHEL-28239
This commit is contained in:
Jan Grulich 2024-03-27 11:05:38 +01:00
parent b3e652a4a8
commit 6fccc950a9

View File

@ -6,10 +6,12 @@
%global prerelease rc2 %global prerelease rc2
%endif %endif
%global build_tests 1
Summary: Qt6 - Qt Shader Tools module builds on the SPIR-V Open Source Ecosystem Summary: Qt6 - Qt Shader Tools module builds on the SPIR-V Open Source Ecosystem
Name: qt6-%{qt_module} Name: qt6-%{qt_module}
Version: 6.6.1 Version: 6.6.1
Release: 3%{?dist} Release: 4%{?dist}
License: LGPL-3.0-only OR GPL-3.0-only WITH Qt-GPL-exception-1.0 License: LGPL-3.0-only OR GPL-3.0-only WITH Qt-GPL-exception-1.0
Url: http://www.qt.io Url: http://www.qt.io
@ -44,13 +46,23 @@ Requires: qt6-qtbase-devel%{?_isa}
%description devel %description devel
%{summary}. %{summary}.
%if 0%{?build_tests}
%package tests
Summary: Unit tests for %{name}
Requires: %{name}%{?_isa} = %{version}-%{release}
%description tests
%{summary}.
%endif
%prep %prep
%autosetup -n %{qt_module}-everywhere-src-%{qt_version}%{?unstable:-%{prerelease}} -p1 %autosetup -n %{qt_module}-everywhere-src-%{qt_version}%{?unstable:-%{prerelease}} -p1
%build %build
%cmake_qt6 %cmake_qt6 \
-DQT_BUILD_EXAMPLES:BOOL=%{?examples:ON}%{!?examples:OFF} \
-DQT_BUILD_TESTS=%{?build_tests:ON}%{!?build_tests:OFF}
%cmake_build %cmake_build
@ -58,6 +70,10 @@ Requires: qt6-qtbase-devel%{?_isa}
%install %install
%cmake_install %cmake_install
%if 0%{?build_tests}
%qt6_install_tests
%endif
# hardlink files to %{_bindir}, add -qt6 postfix to not conflict # hardlink files to %{_bindir}, add -qt6 postfix to not conflict
mkdir %{buildroot}%{_bindir} mkdir %{buildroot}%{_bindir}
pushd %{buildroot}%{_qt6_bindir} pushd %{buildroot}%{_qt6_bindir}
@ -109,7 +125,16 @@ popd
%{_qt6_libdir}/qt6/metatypes/qt6*_metatypes.json %{_qt6_libdir}/qt6/metatypes/qt6*_metatypes.json
%{_qt6_libdir}/pkgconfig/Qt6ShaderTools.pc %{_qt6_libdir}/pkgconfig/Qt6ShaderTools.pc
%if 0%{?build_tests}
%files tests
%{_qt6_archdatadir}/tests
%endif
%changelog %changelog
* Wed Mar 27 2024 Jan Grulich <jgrulich@redhat.com> - 6.6.1-4
- Add -tests subpackage with unit tests that can run in CI
Resolves: RHEL-28239
* Fri Jan 26 2024 Fedora Release Engineering <releng@fedoraproject.org> - 6.6.1-3 * Fri Jan 26 2024 Fedora Release Engineering <releng@fedoraproject.org> - 6.6.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild