summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuha Vuolle <juha.vuolle@insta.fi>2022-09-16 12:54:11 +0300
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-09-19 09:46:28 +0000
commitb5cd988f066a732468faeff39eb4afc38cc3a45c (patch)
treee800bf7f23c5f326993102493cbecc97c9abbb6e
parent3875ca3ffea989257f59fefa1ee98a28d8e22547 (diff)
Fix failing BT LE autotest on CI & RHEL 9
It appears that with RHEL 9 on CI there is no bluez dbus. This means that the older kernel ATT interface is used instead. With that there is an error already at construction time if there is no local adapter available (QLowEnergyControllerPrivateBluez::init()) Fixes: QTBUG-106282 Change-Id: I8ecab26440a2b533c4d641c31d2345b46b95427e Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> (cherry picked from commit 4371448c637f3059824cef22e1c98544cc0f45ed) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--tests/auto/qlowenergycontroller/tst_qlowenergycontroller.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/auto/qlowenergycontroller/tst_qlowenergycontroller.cpp b/tests/auto/qlowenergycontroller/tst_qlowenergycontroller.cpp
index 0c7ec876..862568c4 100644
--- a/tests/auto/qlowenergycontroller/tst_qlowenergycontroller.cpp
+++ b/tests/auto/qlowenergycontroller/tst_qlowenergycontroller.cpp
@@ -209,7 +209,17 @@ void tst_QLowEnergyController::tst_emptyCtor()
QSignalSpy connectedSpy(control.data(), SIGNAL(connected()));
QSignalSpy stateSpy(control.data(), SIGNAL(stateChanged(QLowEnergyController::ControllerState)));
QSignalSpy errorSpy(control.data(), SIGNAL(errorOccurred(QLowEnergyController::Error)));
+#if QT_CONFIG(bluez)
+ QBluetoothLocalDevice localDevice;
+ // With bluez Kernel ATT interface we get the error already at construction time if the
+ // device does not have a bluetooth adapter
+ if (!isBluezDbusLE && !localDevice.isValid())
+ QCOMPARE(control->error(), QLowEnergyController::InvalidBluetoothAdapterError);
+ else
+ QCOMPARE(control->error(), QLowEnergyController::NoError);
+#else
QCOMPARE(control->error(), QLowEnergyController::NoError);
+#endif
control->connectToDevice();
QTRY_VERIFY_WITH_TIMEOUT(!errorSpy.isEmpty(), 10000);
@@ -228,7 +238,15 @@ void tst_QLowEnergyController::tst_emptyCtor()
QSignalSpy connectedSpy(control.data(), SIGNAL(connected()));
QSignalSpy stateSpy(control.data(), SIGNAL(stateChanged(QLowEnergyController::ControllerState)));
QSignalSpy errorSpy(control.data(), SIGNAL(errorOccurred(QLowEnergyController::Error)));
+#if QT_CONFIG(bluez)
+ QBluetoothLocalDevice localDevice;
+ if (!isBluezDbusLE && !localDevice.isValid())
+ QCOMPARE(control->error(), QLowEnergyController::InvalidBluetoothAdapterError);
+ else
+ QCOMPARE(control->error(), QLowEnergyController::NoError);
+#else
QCOMPARE(control->error(), QLowEnergyController::NoError);
+#endif
control->connectToDevice();
QTRY_VERIFY_WITH_TIMEOUT(!errorSpy.isEmpty(), 10000);