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

Resolves: RHEL-28239
This commit is contained in:
Jan Grulich 2024-03-27 10:53:48 +01:00
parent 9e6f9d15b8
commit 0f769caabd
2 changed files with 119 additions and 6 deletions

View File

@ -12,6 +12,14 @@
%endif %endif
%endif %endif
%if 0%{?rhel} >= 10
# Use mutter on RHEL 10+ since it's the only shipped compositor
%global wlheadless_compositor mutter
%else
# Use the simple reference compositor to simplify dependencies
%global wlheadless_compositor weston
%endif
%global platform linux-g++ %global platform linux-g++
%if 0%{?use_clang} %if 0%{?use_clang}
@ -30,7 +38,8 @@ BuildRequires: pkgconfig(libsystemd)
%global examples 1 %global examples 1
## skip for now, until we're better at it --rex ## skip for now, until we're better at it --rex
#global tests 1 #global tests 0
%global build_tests 1
#global unstable 0 #global unstable 0
%global prerelease rc2 %global prerelease rc2
@ -38,7 +47,7 @@ BuildRequires: pkgconfig(libsystemd)
Name: qt6-qtbase Name: qt6-qtbase
Summary: Qt6 - QtBase components Summary: Qt6 - QtBase components
Version: 6.6.1 Version: 6.6.1
Release: 5%{?dist} Release: 6%{?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://qt-project.org/ Url: http://qt-project.org/
@ -96,6 +105,9 @@ Patch58: qtbase-libglvnd.patch
Patch100: qtbase-use-qgnomeplatform-as-default-platform-theme-on-gnome.patch Patch100: qtbase-use-qgnomeplatform-as-default-platform-theme-on-gnome.patch
%endif %endif
## RHEL specific patches
Patch200: qtbase-fix-tests.patch
## upstream patches ## upstream patches
# Do not check any files in %%{_qt6_plugindir}/platformthemes/ for requires. # Do not check any files in %%{_qt6_plugindir}/platformthemes/ for requires.
@ -186,7 +198,7 @@ BuildRequires: qt6-rpm-macros
BuildRequires: dbus-x11 BuildRequires: dbus-x11
BuildRequires: mesa-dri-drivers BuildRequires: mesa-dri-drivers
BuildRequires: time BuildRequires: time
BuildRequires: xorg-x11-server-Xvfb BuildRequires: (wlheadless-run and %{wlheadless_compositor})
%endif %endif
Requires: %{name}-common = %{version}-%{release} Requires: %{name}-common = %{version}-%{release}
@ -263,6 +275,15 @@ Requires: pkgconfig(zlib)
%description static %description static
%{summary}. %{summary}.
%if 0%{?build_tests}
%package tests
Summary: Unit tests for %{name}
Requires: %{name}%{?_isa} = %{version}-%{release}
%description tests
%{summary}.
%endif
%if 0%{?ibase} %if 0%{?ibase}
%package ibase %package ibase
Summary: IBase driver for Qt6's SQL classes Summary: IBase driver for Qt6's SQL classes
@ -383,7 +404,7 @@ export MAKEFLAGS="%{?_smp_mflags}"
%{?sqlite:-DQT_FEATURE_system_sqlite=ON} \ %{?sqlite:-DQT_FEATURE_system_sqlite=ON} \
-DBUILD_SHARED_LIBS=ON \ -DBUILD_SHARED_LIBS=ON \
-DQT_BUILD_EXAMPLES=%{?examples:ON}%{!?examples:OFF} \ -DQT_BUILD_EXAMPLES=%{?examples:ON}%{!?examples:OFF} \
-DQT_BUILD_TESTS=%{?tests:ON}%{!?tests:OFF} \ -DQT_BUILD_TESTS=%{?build_tests:ON}%{!?build_tests:OFF} \
-DQT_QMAKE_TARGET_MKSPEC=%{platform} -DQT_QMAKE_TARGET_MKSPEC=%{platform}
# FIXME # FIXME
@ -393,8 +414,16 @@ export MAKEFLAGS="%{?_smp_mflags}"
%install %install
%if 0%{?build_tests}
%qt6_dont_autoinstall_tests
%endif
%cmake_install %cmake_install
%if 0%{?build_tests}
%qt6_install_tests
%endif
install -m644 -p -D %{SOURCE1} %{buildroot}%{_qt6_datadir}/qtlogging.ini install -m644 -p -D %{SOURCE1} %{buildroot}%{_qt6_datadir}/qtlogging.ini
# Qt6.pc # Qt6.pc
@ -495,8 +524,7 @@ export PATH=%{buildroot}%{_qt6_bindir}:$PATH
export LD_LIBRARY_PATH=%{buildroot}%{_qt6_libdir} export LD_LIBRARY_PATH=%{buildroot}%{_qt6_libdir}
# dbus tests error out when building if session bus is not available # dbus tests error out when building if session bus is not available
dbus-launch --exit-with-session \ dbus-launch --exit-with-session \
%make_build sub-tests -k ||: wlheadless-run -c %{wlheadless_compositor} -- \
xvfb-run -a --server-args="-screen 0 1280x1024x32" \
dbus-launch --exit-with-session \ dbus-launch --exit-with-session \
time \ time \
make check -k ||: make check -k ||:
@ -756,11 +784,17 @@ make check -k ||:
%{_qt6_headerdir}/QtKmsSupport %{_qt6_headerdir}/QtKmsSupport
%{_qt6_libdir}/libQt6KmsSupport.*a %{_qt6_libdir}/libQt6KmsSupport.*a
%{_qt6_libdir}/libQt6KmsSupport.prl %{_qt6_libdir}/libQt6KmsSupport.prl
%if 0%{?examples} %if 0%{?examples}
%files examples %files examples
%{_qt6_examplesdir}/ %{_qt6_examplesdir}/
%endif %endif
%if 0%{?build_tests}
%files tests
%{_qt6_archdatadir}/tests
%endif
%if 0%{?ibase} %if 0%{?ibase}
%files ibase %files ibase
%{_qt6_plugindir}/sqldrivers/libqsqlibase.so %{_qt6_plugindir}/sqldrivers/libqsqlibase.so
@ -837,6 +871,10 @@ make check -k ||:
%changelog %changelog
* Wed Mar 27 2024 Jan Grulich <jgrulich@redhat.com> - 6.6.1-6
- Add -tests subpackage with unit tests that can run in CI
Resolves: RHEL-28239
* Wed Jan 31 2024 Pete Walter <pwalter@fedoraproject.org> - 6.6.1-5 * Wed Jan 31 2024 Pete Walter <pwalter@fedoraproject.org> - 6.6.1-5
- Rebuild for ICU 74 - Rebuild for ICU 74

75
qtbase-fix-tests.patch Normal file
View File

@ -0,0 +1,75 @@
diff --git a/tests/auto/gui/painting/qcolortransform/tst_qcolortransform.cpp b/tests/auto/gui/painting/qcolortransform/tst_qcolortransform.cpp
index 06e8db3e..afe08dc4 100644
--- a/tests/auto/gui/painting/qcolortransform/tst_qcolortransform.cpp
+++ b/tests/auto/gui/painting/qcolortransform/tst_qcolortransform.cpp
@@ -182,25 +182,33 @@ void tst_QColorTransform::mapRGBAFP16x4()
else
QVERIFY(result != testColor);
- testColor = QRgbaFloat16{0.0f, 0.0f, 0.0f, 1.0f};
+ float floatValueZero = 0.0f;
+ qfloat16 float16ValueZero;
+ qFloatToFloat16(&float16ValueZero, &floatValueZero, 1);
+
+ float floatValueOne = 1.0f;
+ qfloat16 float16ValueOne;
+ qFloatToFloat16(&float16ValueOne, &floatValueOne, 1);
+
+ testColor = QRgbaFloat16{float16ValueZero, float16ValueZero, float16ValueZero, float16ValueOne};
result = transform.map(testColor);
QCOMPARE(result, testColor);
- testColor = QRgbaFloat16{1.0f, 1.0f, 1.0f, 1.0f};
+ testColor = QRgbaFloat16{float16ValueOne, float16ValueOne, float16ValueOne, float16ValueOne};
result = transform.map(testColor);
QCOMPARE(result, testColor);
- testColor = QRgbaFloat16{1.0f, 1.0f, 0.0f, 1.0f};
+ testColor = QRgbaFloat16{float16ValueOne, float16ValueOne, float16ValueZero, float16ValueOne};
result = transform.map(testColor);
- QCOMPARE(result.alpha(), 1.0f);
+ QCOMPARE(result.alpha(), float16ValueOne);
if (sharesRed)
- QCOMPARE(result.red(), 1.0f);
+ QCOMPARE(result.red(), float16ValueOne);
- testColor = QRgbaFloat16{0.0f, 1.0f, 1.0f, 1.0f};
+ testColor = QRgbaFloat16{float16ValueZero, float16ValueOne, float16ValueOne, float16ValueOne};
result = transform.map(testColor);
// QRgbaFloat16 might overflow blue if we convert to a smaller gamut:
QCOMPARE(result.blue16(), 65535);
- QCOMPARE(result.alpha(), 1.0f);
+ QCOMPARE(result.alpha(), float16ValueOne);
}
void tst_QColorTransform::mapRGBAFP32x4_data()
diff --git a/tests/auto/gui/rhi/qrhi/tst_qrhi.cpp b/tests/auto/gui/rhi/qrhi/tst_qrhi.cpp
index 942ee06f..1cc1b14b 100644
--- a/tests/auto/gui/rhi/qrhi/tst_qrhi.cpp
+++ b/tests/auto/gui/rhi/qrhi/tst_qrhi.cpp
@@ -6699,10 +6699,22 @@ void tst_QRhi::halfPrecisionAttributes()
//
// To avoid these errors, we pad the vertices to 8 byte stride.
//
+ float floatValueZero = 0.0f;
+ qfloat16 float16ValueZero;
+ qFloatToFloat16(&float16ValueZero, &floatValueZero, 1);
+
+ float floatValueOne = 1.0f;
+ qfloat16 float16ValueOne;
+ qFloatToFloat16(&float16ValueOne, &floatValueOne, 1);
+
+ float floatValueMinusOne = -1.0f;
+ qfloat16 float16ValueMinusOne;
+ qFloatToFloat16(&float16ValueMinusOne, &floatValueMinusOne, 1);
+
static const qfloat16 vertices[] = {
- -1.0, -1.0, 0.0, 0.0,
- 1.0, -1.0, 0.0, 0.0,
- 0.0, 1.0, 0.0, 0.0,
+ float16ValueMinusOne, float16ValueMinusOne, float16ValueZero, float16ValueZero,
+ float16ValueOne, float16ValueMinusOne, float16ValueZero, float16ValueZero,
+ float16ValueZero, float16ValueOne, float16ValueZero, float16ValueZero,
};
QScopedPointer<QRhiBuffer> vbuf(rhi->newBuffer(QRhiBuffer::Immutable, QRhiBuffer::VertexBuffer, sizeof(vertices)));