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:08:50 +01:00
parent 2233090cbb
commit 4a8ad6deaf

View File

@ -7,11 +7,12 @@
%endif %endif
%global examples 1 %global examples 1
%global build_tests 1
Summary: Qt6 - QtTool components Summary: Qt6 - QtTool components
Name: qt6-qttools Name: qt6-qttools
Version: 6.6.1 Version: 6.6.1
Release: 2%{?dist} Release: 3%{?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
@ -150,6 +151,15 @@ Requires: %{name}-common = %{version}-%{release}
%{summary}. %{summary}.
%endif %endif
%if 0%{?build_tests}
%package tests
Summary: Unit tests for %{name}
Requires: %{name}%{?_isa} = %{version}-%{release}
%description tests
%{summary}.
%endif
%prep %prep
%setup -q -n %{qt_module}-everywhere-src-%{qt_version}%{?unstable:-%{prerelease}} %setup -q -n %{qt_module}-everywhere-src-%{qt_version}%{?unstable:-%{prerelease}}
@ -159,14 +169,28 @@ Requires: %{name}-common = %{version}-%{release}
%endif %endif
%build %build
%cmake_qt6 -DQT_BUILD_EXAMPLES:BOOL=%{?examples:ON}%{!?examples:OFF} %cmake_qt6 \
-DQT_BUILD_EXAMPLES:BOOL=%{?examples:ON}%{!?examples:OFF} \
-DQT_BUILD_TESTS=%{?build_tests:ON}%{!?build_tests:OFF}
%if 0%{?build_tests}
%qt6_fix_tests
%endif
%cmake_build %cmake_build
%install %install
%if 0%{?build_tests}
%qt6_dont_autoinstall_tests
%endif
%cmake_install %cmake_install
%if 0%{?build_tests}
%qt6_install_tests
%endif
# Add desktop files, --vendor=... helps avoid possible conflicts with qt3/qt4 # Add desktop files, --vendor=... helps avoid possible conflicts with qt3/qt4
desktop-file-install \ desktop-file-install \
--dir=%{buildroot}%{_datadir}/applications \ --dir=%{buildroot}%{_datadir}/applications \
@ -330,6 +354,7 @@ popd
%{_qt6_libdir}/libQt6UiTools.so %{_qt6_libdir}/libQt6UiTools.so
%{_qt6_libdir}/cmake/Qt6/FindWrapLibClang.cmake %{_qt6_libdir}/cmake/Qt6/FindWrapLibClang.cmake
%{_qt6_libdir}/cmake/Qt6BuildInternals/StandaloneTests/QtToolsTestsConfig.cmake %{_qt6_libdir}/cmake/Qt6BuildInternals/StandaloneTests/QtToolsTestsConfig.cmake
%dir %{_qt6_libdir}/cmake/Qt6Designer
%{_qt6_libdir}/cmake/Qt6Designer/*.cmake %{_qt6_libdir}/cmake/Qt6Designer/*.cmake
%{_qt6_libdir}/cmake/Qt6DesignerComponentsPrivate/*.cmake %{_qt6_libdir}/cmake/Qt6DesignerComponentsPrivate/*.cmake
%dir %{_qt6_libdir}/cmake/Qt6QDocCatchPrivate %dir %{_qt6_libdir}/cmake/Qt6QDocCatchPrivate
@ -380,11 +405,18 @@ popd
%if 0%{?examples} %if 0%{?examples}
%files examples %files examples
%{_qt6_examplesdir}/ %{_qt6_examplesdir}/
%dir %{_qt6_libdir}/cmake/Qt6Designer
%endif %endif
%if 0%{?build_tests}
%files tests
%{_qt6_archdatadir}/tests
%endif
%changelog %changelog
* Wed Mar 27 2024 Jan Grulich <jgrulich@redhat.com> - 6.6.1-3
- Add -tests subpackage with unit tests that can run in CI
Resolves: RHEL-28239
* Mon Jan 22 2024 Fedora Release Engineering <releng@fedoraproject.org> - 6.6.1-2 * Mon Jan 22 2024 Fedora Release Engineering <releng@fedoraproject.org> - 6.6.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild