From 0f769caabd3965a528be426b22286b2a46e62fe2 Mon Sep 17 00:00:00 2001 From: Jan Grulich Date: Wed, 27 Mar 2024 10:53:48 +0100 Subject: [PATCH] Add -tests subpackage with unit tests that can run in CI Resolves: RHEL-28239 --- qt6-qtbase.spec | 50 ++++++++++++++++++++++++---- qtbase-fix-tests.patch | 75 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 119 insertions(+), 6 deletions(-) create mode 100644 qtbase-fix-tests.patch diff --git a/qt6-qtbase.spec b/qt6-qtbase.spec index c5fca68..c8002ec 100644 --- a/qt6-qtbase.spec +++ b/qt6-qtbase.spec @@ -12,6 +12,14 @@ %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++ %if 0%{?use_clang} @@ -30,7 +38,8 @@ BuildRequires: pkgconfig(libsystemd) %global examples 1 ## skip for now, until we're better at it --rex -#global tests 1 +#global tests 0 +%global build_tests 1 #global unstable 0 %global prerelease rc2 @@ -38,7 +47,7 @@ BuildRequires: pkgconfig(libsystemd) Name: qt6-qtbase Summary: Qt6 - QtBase components 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 Url: http://qt-project.org/ @@ -96,6 +105,9 @@ Patch58: qtbase-libglvnd.patch Patch100: qtbase-use-qgnomeplatform-as-default-platform-theme-on-gnome.patch %endif +## RHEL specific patches +Patch200: qtbase-fix-tests.patch + ## upstream patches # Do not check any files in %%{_qt6_plugindir}/platformthemes/ for requires. @@ -186,7 +198,7 @@ BuildRequires: qt6-rpm-macros BuildRequires: dbus-x11 BuildRequires: mesa-dri-drivers BuildRequires: time -BuildRequires: xorg-x11-server-Xvfb +BuildRequires: (wlheadless-run and %{wlheadless_compositor}) %endif Requires: %{name}-common = %{version}-%{release} @@ -263,6 +275,15 @@ Requires: pkgconfig(zlib) %description static %{summary}. +%if 0%{?build_tests} +%package tests +Summary: Unit tests for %{name} +Requires: %{name}%{?_isa} = %{version}-%{release} + +%description tests +%{summary}. +%endif + %if 0%{?ibase} %package ibase Summary: IBase driver for Qt6's SQL classes @@ -383,7 +404,7 @@ export MAKEFLAGS="%{?_smp_mflags}" %{?sqlite:-DQT_FEATURE_system_sqlite=ON} \ -DBUILD_SHARED_LIBS=ON \ -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} # FIXME @@ -393,8 +414,16 @@ export MAKEFLAGS="%{?_smp_mflags}" %install +%if 0%{?build_tests} +%qt6_dont_autoinstall_tests +%endif + %cmake_install +%if 0%{?build_tests} +%qt6_install_tests +%endif + install -m644 -p -D %{SOURCE1} %{buildroot}%{_qt6_datadir}/qtlogging.ini # Qt6.pc @@ -495,8 +524,7 @@ export PATH=%{buildroot}%{_qt6_bindir}:$PATH export LD_LIBRARY_PATH=%{buildroot}%{_qt6_libdir} # dbus tests error out when building if session bus is not available dbus-launch --exit-with-session \ -%make_build sub-tests -k ||: -xvfb-run -a --server-args="-screen 0 1280x1024x32" \ +wlheadless-run -c %{wlheadless_compositor} -- \ dbus-launch --exit-with-session \ time \ make check -k ||: @@ -756,11 +784,17 @@ make check -k ||: %{_qt6_headerdir}/QtKmsSupport %{_qt6_libdir}/libQt6KmsSupport.*a %{_qt6_libdir}/libQt6KmsSupport.prl + %if 0%{?examples} %files examples %{_qt6_examplesdir}/ %endif +%if 0%{?build_tests} +%files tests +%{_qt6_archdatadir}/tests +%endif + %if 0%{?ibase} %files ibase %{_qt6_plugindir}/sqldrivers/libqsqlibase.so @@ -837,6 +871,10 @@ make check -k ||: %changelog +* Wed Mar 27 2024 Jan Grulich - 6.6.1-6 +- Add -tests subpackage with unit tests that can run in CI + Resolves: RHEL-28239 + * Wed Jan 31 2024 Pete Walter - 6.6.1-5 - Rebuild for ICU 74 diff --git a/qtbase-fix-tests.patch b/qtbase-fix-tests.patch new file mode 100644 index 0000000..f043f1a --- /dev/null +++ b/qtbase-fix-tests.patch @@ -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 vbuf(rhi->newBuffer(QRhiBuffer::Immutable, QRhiBuffer::VertexBuffer, sizeof(vertices)));