Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Angelo Compagnucci <angelo.compagnucci@gmail.com>
To: buildroot@buildroot.org
Cc: James Hilliard <james.hilliard1@gmail.com>,
	Roy Kollen Svendsen <roykollensvendsen@gmail.com>,
	Dylan Bespalko <dylan.bespalko@gmail.com>,
	Angelo Compagnucci <angelo.compagnucci@gmail.com>,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Subject: [Buildroot] [PATCH v5 3/5] support/testing: add python-pyside6 runtime test
Date: Mon, 16 Nov 2026 22:36:10 +0100	[thread overview]
Message-ID: <20261116213612.873856-4-angelo.compagnucci@gmail.com> (raw)
In-Reply-To: <20261116213612.873856-1-angelo.compagnucci@gmail.com>

From: Dylan Bespalko <dylan.bespalko@gmail.com>

The test imports the PySide6 modules, and uses a class of each one.

It runs with the offscreen Qt platform plugin, so it needs no display.

Signed-off-by: Dylan Bespalko <dylan.bespalko@gmail.com>
Co-authored-by: Angelo Compagnucci <angelo.compagnucci@gmail.com>
Signed-off-by: Angelo Compagnucci <angelo.compagnucci@gmail.com>
---
Changes v4 -> v5:
  - No change

Changes v3 -> v4:
  - Split from the package patch
  - Use the current mesa3d options and an ext4 root filesystem
  - Look up the QML files with QLibraryInfo
  - Write the asserts as statements, for flake8
  - DEVELOPERS: v3 had the test files in a new entry for Dylan. v4 has
    them in my entry. Dylan, tell me if you want to be listed

 DEVELOPERS                                    |   2 +
 .../tests/package/sample_python_pyside6.py    | 165 ++++++++++++++++++
 .../tests/package/test_python_pyside6.py      |  63 +++++++
 3 files changed, 230 insertions(+)
 create mode 100644 support/testing/tests/package/sample_python_pyside6.py
 create mode 100644 support/testing/tests/package/test_python_pyside6.py

diff --git a/DEVELOPERS b/DEVELOPERS
index 1d2960f9b3..14aac54303 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -265,6 +265,8 @@ F:	package/sshguard/
 F:	package/sunwait/
 F:	package/sysdig/
 F:	package/uthash/
+F:	support/testing/tests/package/sample_python_pyside6.py
+F:	support/testing/tests/package/test_python_pyside6.py
 
 N:	Andy Shevchenko <andy.shevchenko@gmail.com>
 F:	package/fb-test-app/
diff --git a/support/testing/tests/package/sample_python_pyside6.py b/support/testing/tests/package/sample_python_pyside6.py
new file mode 100644
index 0000000000..f2677c6286
--- /dev/null
+++ b/support/testing/tests/package/sample_python_pyside6.py
@@ -0,0 +1,165 @@
+import os
+
+
+def qml_file(name):
+    from PySide6.QtCore import QLibraryInfo
+    qml_dir = QLibraryInfo.path(QLibraryInfo.LibraryPath.QmlImportsPath)
+    return os.path.join(qml_dir, name)
+
+
+# The essential modules: ALL_ESSENTIAL_MODULES in PySideHelpers.cmake
+def test_python_pyside6_qt():
+    from PySide6.QtCore import Qt
+    enum = Qt.white
+    assert str(enum) == 'GlobalColor.white'
+
+
+def test_python_pyside6_qtcore():
+    from PySide6 import QtCore
+    obj = QtCore.QObject()
+    obj.setObjectName('MyObject')
+    assert obj.objectName() == 'MyObject'
+
+
+def test_python_pyside6_qtgui():
+    from PySide6 import QtGui
+    color = QtGui.QColor.fromRgb(255, 255, 255, 255)
+    assert color.name(QtGui.QColor.HexArgb) == "#ffffffff"
+
+
+def test_python_pyside6_qtwidgets():
+    from PySide6 import QtWidgets
+    app = QtWidgets.QApplication()
+    label = QtWidgets.QLabel('Hello World')
+    assert label.text() == 'Hello World'
+    QtWidgets.QApplication.shutdown(app)
+
+
+def test_python_pyside6_qtprintsupport():
+    from PySide6 import QtWidgets
+    from PySide6 import QtPrintSupport
+    app = QtWidgets.QApplication()
+    p = QtPrintSupport.QPrinter()
+    assert p.creator() == ''
+    QtWidgets.QApplication.shutdown(app)
+
+
+def test_python_pyside6_qtsql():
+    from PySide6 import QtSql
+    db = QtSql.QSqlDatabase()
+    assert db.hostName() == ''
+
+
+def test_python_pyside6_qtnetwork():
+    from PySide6 import QtNetwork
+    host_info = QtNetwork.QHostInfo()
+    assert host_info.localHostName() == 'buildroot'
+
+
+def test_python_pyside6_qttest():
+    from PySide6 import QtTest
+    text = QtTest.QTest.toPrettyCString('hello there', 5)
+    assert text == '"hello"'
+
+
+def test_python_pyside6_qtconcurrent():
+    from PySide6 import QtConcurrent
+    future = QtConcurrent.QFutureQString()
+    assert future.isRunning() is False
+
+
+# The optional modules: ALL_OPTIONAL_MODULES in PySideHelpers.cmake
+def test_python_pyside6_qtdbus():
+    from PySide6 import QtDBus
+    message = QtDBus.QDBusMessage()
+    assert message.errorMessage() == ''
+
+
+def test_python_pyside6_qtxml():
+    from PySide6 import QtXml
+    doc = QtXml.QDomDocument('temp.xml')
+    assert doc.toString() == ''
+
+
+def test_python_pyside6_qtopengl():
+    from PySide6 import QtOpenGL
+    log = QtOpenGL.QOpenGLDebugLogger()
+    assert log.isLogging() is False
+
+
+def test_python_pyside6_qtopenglwidgets():
+    from PySide6 import QtWidgets
+    from PySide6 import QtOpenGLWidgets
+    app = QtWidgets.QApplication()
+    _ = QtOpenGLWidgets.QOpenGLWidget()
+    # QOpenGLWidget is not supported on this platform: only create it.
+    QtWidgets.QApplication.shutdown(app)
+
+
+def test_python_pyside6_qtquickcontrols():
+    from PySide6 import QtWidgets
+    from PySide6 import QtQuick
+    app = QtWidgets.QApplication()
+    view = QtQuick.QQuickView()
+    assert str(view.status()) == 'Status.Null'
+    view.setSource(qml_file('QtQuick/Controls/Universal/Label.qml'))
+    assert str(view.status()) == 'Status.Ready'
+    view.close()
+    QtWidgets.QApplication.shutdown(app)
+
+
+def test_python_pyside6_qtquickwidgets():
+    from PySide6 import QtWidgets
+    from PySide6 import QtQuickWidgets
+    app = QtWidgets.QApplication()
+    view = QtQuickWidgets.QQuickWidget()
+    assert str(view.status()) == 'Status.Null'
+    view.setSource(qml_file('QtQuick/Controls/Universal/Label.qml'))
+    assert str(view.status()) == 'Status.Ready'
+    QtWidgets.QApplication.shutdown(app)
+
+
+def test_python_pyside6_qtserialport():
+    # The port does not need to exist: the test never opens it.
+    from PySide6 import QtSerialPort
+    ser = QtSerialPort.QSerialPort()
+    ser.setPortName('/dev/tty')
+    assert ser.portName() == 'tty'
+
+
+def test_python_pyside6_qtsvg():
+    from PySide6 import QtSvg
+    renderer = QtSvg.QSvgRenderer()
+    renderer.setFramesPerSecond(30)
+    assert renderer.framesPerSecond() == 30
+
+
+def test_python_pyside6_qtsvgwidgets():
+    from PySide6 import QtWidgets
+    from PySide6 import QtSvgWidgets
+    app = QtWidgets.QApplication()
+    widget = QtSvgWidgets.QSvgWidget()
+    widget.setObjectName('MyObject')
+    assert widget.objectName() == 'MyObject'
+    QtWidgets.QApplication.shutdown(app)
+
+
+if __name__ == "__main__":
+    test_python_pyside6_qt()
+    test_python_pyside6_qtcore()
+    test_python_pyside6_qtgui()
+    test_python_pyside6_qtwidgets()
+    test_python_pyside6_qtprintsupport()
+    test_python_pyside6_qtsql()
+    test_python_pyside6_qtnetwork()
+    test_python_pyside6_qttest()
+    test_python_pyside6_qtconcurrent()
+    test_python_pyside6_qtdbus()
+    test_python_pyside6_qtxml()
+    test_python_pyside6_qtopengl()
+    test_python_pyside6_qtopenglwidgets()
+    test_python_pyside6_qtquickcontrols()
+    test_python_pyside6_qtquickwidgets()
+    test_python_pyside6_qtserialport()
+    test_python_pyside6_qtsvg()
+    test_python_pyside6_qtsvgwidgets()
diff --git a/support/testing/tests/package/test_python_pyside6.py b/support/testing/tests/package/test_python_pyside6.py
new file mode 100644
index 0000000000..d93be0bb26
--- /dev/null
+++ b/support/testing/tests/package/test_python_pyside6.py
@@ -0,0 +1,63 @@
+import os
+
+from tests.package.test_python import TestPythonPackageBase
+
+
+# gitlab-runner: 2xlarge
+class TestPythonPy3PySide6(TestPythonPackageBase):
+    __test__ = True
+    # This test needs its own configuration:
+    # - Aarch64, to have more than 256 MB of memory;
+    # - an ext4 root filesystem on a virtio disk, not a cpio initrd.
+    #   The image is big, and this saves memory.
+    config = \
+        """
+        BR2_aarch64=y
+        BR2_TOOLCHAIN_EXTERNAL=y
+        BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0"
+        BR2_LINUX_KERNEL=y
+        BR2_LINUX_KERNEL_CUSTOM_VERSION=y
+        BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.1.81"
+        BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
+        BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/qemu/aarch64-virt/linux.config"
+        BR2_PACKAGE_MESA3D=y
+        BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_SOFTPIPE=y
+        BR2_PACKAGE_MESA3D_OPENGL_EGL=y
+        BR2_PACKAGE_MESA3D_OPENGL_ES=y
+        BR2_PACKAGE_QT6=y
+        BR2_PACKAGE_QT6BASE_GUI=y
+        BR2_PACKAGE_QT6BASE_WIDGETS=y
+        BR2_PACKAGE_QT6BASE_PRINTSUPPORT=y
+        BR2_PACKAGE_QT6BASE_SQL=y
+        BR2_PACKAGE_QT6BASE_SQLITE=y
+        BR2_PACKAGE_QT6BASE_NETWORK=y
+        BR2_PACKAGE_QT6BASE_TEST=y
+        BR2_PACKAGE_QT6BASE_CONCURRENT=y
+        BR2_PACKAGE_QT6BASE_DBUS=y
+        BR2_PACKAGE_QT6BASE_XML=y
+        BR2_PACKAGE_QT6BASE_OPENGL=y
+        BR2_PACKAGE_QT6BASE_DEFAULT_QPA="offscreen"
+        BR2_PACKAGE_QT6DECLARATIVE=y
+        BR2_PACKAGE_QT6DECLARATIVE_QUICK=y
+        BR2_PACKAGE_QT6SERIALPORT=y
+        BR2_PACKAGE_QT6SERIALBUS=y
+        BR2_PACKAGE_QT6SVG=y
+        BR2_PACKAGE_PYTHON3=y
+        BR2_PACKAGE_PYTHON_PYSIDE6=y
+        BR2_TARGET_ROOTFS_EXT2=y
+        BR2_TARGET_ROOTFS_EXT2_4=y
+        BR2_TARGET_ROOTFS_EXT2_SIZE="512M"
+        # BR2_TARGET_ROOTFS_TAR is not set
+        """
+    sample_scripts = ["tests/package/sample_python_pyside6.py"]
+    timeout = 60
+
+    def login(self):
+        drive = os.path.join(self.builddir, "images", "rootfs.ext4")
+        kern = os.path.join(self.builddir, "images", "Image")
+        self.emulator.boot(arch="aarch64",
+                           kernel=kern,
+                           kernel_cmdline=["root=/dev/vda console=ttyAMA0"],
+                           options=["-M", "virt", "-cpu", "cortex-a57", "-m", "512M",
+                                    "-drive", f"file={drive},if=virtio,format=raw"])
+        self.emulator.login()
-- 
2.53.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

  parent reply	other threads:[~2026-11-16 21:36 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-12  8:03 [Buildroot] [PATCH v3 1/1] added package/python-{shiboken6, pyside6}: new packages Dylan Bespalko
2024-08-14  6:02 ` Dylan Bespalko
2026-11-16 15:56 ` [Buildroot] [PATCH v4 0/3] package/python-pyside6: new package Angelo Compagnucci
2026-11-16 15:56   ` [Buildroot] [PATCH v4 1/3] package/python-shiboken6: " Angelo Compagnucci
2026-11-16 15:56   ` [Buildroot] [PATCH v4 2/3] package/python-pyside6: " Angelo Compagnucci
2026-11-16 15:56   ` [Buildroot] [PATCH v4 3/3] support/testing: add python-pyside6 runtime test Angelo Compagnucci
2026-11-16 21:29 ` [Buildroot] [PATCH v4 0/5] package/python-pyside6: new package Angelo Compagnucci
2026-11-16 21:29   ` [Buildroot] [PATCH v4 1/5] package/python-shiboken6: " Angelo Compagnucci
2026-11-16 21:29   ` [Buildroot] [PATCH v4 2/5] package/python-pyside6: " Angelo Compagnucci
2026-11-16 21:29   ` [Buildroot] [PATCH v4 3/5] support/testing: add python-pyside6 runtime test Angelo Compagnucci
2026-11-16 21:29   ` [Buildroot] [PATCH v4 4/5] package/python-matplotlib: add Qt6 support to the Qt display Angelo Compagnucci
2026-11-16 21:29   ` [Buildroot] [PATCH v4 5/5] support/testing: add python-matplotlib runtime test Angelo Compagnucci
2026-11-16 21:36   ` [Buildroot] [PATCH v5 0/5] package/python-pyside6: new package Angelo Compagnucci
2026-11-16 21:36     ` [Buildroot] [PATCH v5 1/5] package/python-shiboken6: " Angelo Compagnucci
2026-11-16 21:36     ` [Buildroot] [PATCH v5 2/5] package/python-pyside6: " Angelo Compagnucci
2026-11-16 21:36     ` Angelo Compagnucci [this message]
2026-11-16 21:36     ` [Buildroot] [PATCH v5 4/5] package/python-matplotlib: add Qt6 support to the Qt display Angelo Compagnucci
2026-11-16 21:36     ` [Buildroot] [PATCH v5 5/5] support/testing: add python-matplotlib runtime test Angelo Compagnucci

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261116213612.873856-4-angelo.compagnucci@gmail.com \
    --to=angelo.compagnucci@gmail.com \
    --cc=buildroot@buildroot.org \
    --cc=dylan.bespalko@gmail.com \
    --cc=james.hilliard1@gmail.com \
    --cc=roykollensvendsen@gmail.com \
    --cc=thomas.petazzoni@bootlin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox