From fb4c1257d849c82f522b85592f9e13256a113fef Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Mon, 26 May 2025 12:27:31 +0200 Subject: [PATCH] Add run opengl tests feature On Woa cross compile we want to compile with opengl feature, however tests windows arm nodes do not have opengl installed add a feature to skip the tests preventing the crash otherwise. Note this is just temporary workaround and should be reverted as soon as opengl libs land on windows arm vm nodes. Task-number: COIN-1211 Change-Id: Iaae205b9cc10bd17e82152a44b2e976e4321d00d Reviewed-by: Alexandru Croitor --- src/gui/configure.cmake | 5 +++++ tests/auto/gui/kernel/qopenglwindow/tst_qopenglwindow.cpp | 3 +++ tests/auto/gui/qopengl/tst_qopengl.cpp | 3 +++ tests/auto/gui/qopenglconfig/tst_qopenglconfig.cpp | 3 +++ .../graphicsview/qgraphicsview/tst_qgraphicsview.cpp | 3 +++ .../qwidgetrepaintmanager/tst_qwidgetrepaintmanager.cpp | 7 +++++++ .../widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp | 3 +++ tests/auto/widgets/widgets/qrhiwidget/tst_qrhiwidget.cpp | 2 +- 8 files changed, 28 insertions(+), 1 deletion(-) diff --git a/src/gui/configure.cmake b/src/gui/configure.cmake index af97214557f..8dffa4623e7 100644 --- a/src/gui/configure.cmake +++ b/src/gui/configure.cmake @@ -1570,6 +1570,11 @@ qt_feature("egl-extension-platform-wayland" PRIVATE CONDITION QT_FEATURE_wayland_client AND QT_FEATURE_opengl AND QT_FEATURE_egl AND TEST_egl_1_5_wayland ) +qt_feature("run-opengl-tests" PRIVATE + LABEL "Run opengl tests" + PURPOSE "Provides the ability to skip tests which require opengl to run" + CONDITION QT_FEATURE_opengl +) qt_configure_add_summary_section(NAME "Qt Gui") diff --git a/tests/auto/gui/kernel/qopenglwindow/tst_qopenglwindow.cpp b/tests/auto/gui/kernel/qopenglwindow/tst_qopenglwindow.cpp index 06a1ffb2960..6019261f792 100644 --- a/tests/auto/gui/kernel/qopenglwindow/tst_qopenglwindow.cpp +++ b/tests/auto/gui/kernel/qopenglwindow/tst_qopenglwindow.cpp @@ -26,6 +26,9 @@ private slots: void tst_QOpenGLWindow::initTestCase() { +#if !QT_CONFIG(run_opengl_tests) + QSKIP("Skip test as run-opengl-tests feature is off."); +#endif if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::OpenGL)) QSKIP("OpenGL is not supported on this platform."); } diff --git a/tests/auto/gui/qopengl/tst_qopengl.cpp b/tests/auto/gui/qopengl/tst_qopengl.cpp index 36ff1d1f2e9..b9b4c3aa11c 100644 --- a/tests/auto/gui/qopengl/tst_qopengl.cpp +++ b/tests/auto/gui/qopengl/tst_qopengl.cpp @@ -185,6 +185,9 @@ static QSurface *createSurface(int surfaceClass) void tst_QOpenGL::initTestCase() { +#if !QT_CONFIG(run_opengl_tests) + QSKIP("Skip test as run-opengl-tests feature is off."); +#endif if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::OpenGL)) QSKIP("OpenGL is not supported on this platform."); } diff --git a/tests/auto/gui/qopenglconfig/tst_qopenglconfig.cpp b/tests/auto/gui/qopenglconfig/tst_qopenglconfig.cpp index 423f9419daf..f597dac53d7 100644 --- a/tests/auto/gui/qopenglconfig/tst_qopenglconfig.cpp +++ b/tests/auto/gui/qopenglconfig/tst_qopenglconfig.cpp @@ -139,6 +139,9 @@ static void dumpConfiguration(QTextStream &str) void tst_QOpenGlConfig::initTestCase() { +#if !QT_CONFIG(run_opengl_tests) + QSKIP("Skip test as run-opengl-tests feature is off."); +#endif if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::OpenGL)) QSKIP("OpenGL is not supported on this platform."); } diff --git a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp index df19ea1568e..3e5ff5ce640 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp @@ -657,6 +657,9 @@ void tst_QGraphicsView::viewport() #if QT_CONFIG(opengl) void tst_QGraphicsView::openGLViewport() { +#if !QT_CONFIG(run_opengl_tests) + QSKIP("Skip test as run-opengl-tests feature is off."); +#endif if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::OpenGL)) QSKIP("QOpenGL is not supported on this platform."); if (isPlatformEGLFS()) diff --git a/tests/auto/widgets/kernel/qwidgetrepaintmanager/tst_qwidgetrepaintmanager.cpp b/tests/auto/widgets/kernel/qwidgetrepaintmanager/tst_qwidgetrepaintmanager.cpp index 261ea56b345..c460eb1db8c 100644 --- a/tests/auto/widgets/kernel/qwidgetrepaintmanager/tst_qwidgetrepaintmanager.cpp +++ b/tests/auto/widgets/kernel/qwidgetrepaintmanager/tst_qwidgetrepaintmanager.cpp @@ -654,6 +654,8 @@ void tst_QWidgetRepaintManager::evaluateRhi() } #if QT_CONFIG(opengl) + +#if QT_CONFIG(run_opengl_tests) { // Non-native child RHI widget enables RHI for top level regular widget QWidget topLevel; @@ -767,6 +769,7 @@ void tst_QWidgetRepaintManager::evaluateRhi() QVERIFY(!QWidgetPrivate::get(&rhiChild)->usesRhiFlush); QVERIFY(QWidgetPrivate::get(&rhiChild)->rhi()); } +#endif // QT_CONFIG(run_opengl_tests) #if QT_CONFIG(metal) QRhiMetalInitParams metalParams; @@ -802,6 +805,10 @@ void tst_QWidgetRepaintManager::evaluateRhi() void tst_QWidgetRepaintManager::rhiRecreateMaintainsWindowProperties() { +#if !QT_CONFIG(run_opengl_tests) + QSKIP("Skip test as run-opengl-tests feature is off."); +#endif + const auto *integration = QGuiApplicationPrivate::platformIntegration(); if (!integration->hasCapability(QPlatformIntegration::RhiBasedRendering)) QSKIP("Platform does not support RHI based rendering"); diff --git a/tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp b/tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp index 51f898c9537..b2cdd6b72c2 100644 --- a/tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp +++ b/tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp @@ -63,6 +63,9 @@ private slots: void tst_QOpenGLWidget::initTestCase() { +#if !QT_CONFIG(run_opengl_tests) + QSKIP("Skip test as run-opengl-tests feature is off."); +#endif // See QOpenGLWidget constructor if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::RasterGLSurface)) QSKIP("QOpenGLWidget is not supported on this platform."); diff --git a/tests/auto/widgets/widgets/qrhiwidget/tst_qrhiwidget.cpp b/tests/auto/widgets/widgets/qrhiwidget/tst_qrhiwidget.cpp index 457df2159b1..da4fee72f65 100644 --- a/tests/auto/widgets/widgets/qrhiwidget/tst_qrhiwidget.cpp +++ b/tests/auto/widgets/widgets/qrhiwidget/tst_qrhiwidget.cpp @@ -64,7 +64,7 @@ void tst_QRhiWidget::testData() QTest::newRow("Null") << QRhiWidget::Api::Null; #endif -#if QT_CONFIG(opengl) +#if QT_CONFIG(opengl) && QT_CONFIG(run_opengl_tests) if (QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::OpenGL)) QTest::newRow("OpenGL") << QRhiWidget::Api::OpenGL; #endif