diff options
author | Juha Vuolle <juha.vuolle@insta.fi> | 2022-09-16 12:54:11 +0300 |
---|---|---|
committer | Juha Vuolle <juha.vuolle@insta.fi> | 2022-09-19 11:26:40 +0300 |
commit | 4371448c637f3059824cef22e1c98544cc0f45ed (patch) | |
tree | c6ee806f3c69f5f507be5b55d08bf56282ce7dad | |
parent | b1968a0eafb74b3feb2202743a3e96ad19352ea8 (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())
Pick-to: 6.2 6.3 6.4
Fixes: QTBUG-106282
Change-Id: I8ecab26440a2b533c4d641c31d2345b46b95427e
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
-rw-r--r-- | tests/auto/qlowenergycontroller/tst_qlowenergycontroller.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/auto/qlowenergycontroller/tst_qlowenergycontroller.cpp b/tests/auto/qlowenergycontroller/tst_qlowenergycontroller.cpp index 306704b7..926cf8d8 100644 --- a/tests/auto/qlowenergycontroller/tst_qlowenergycontroller.cpp +++ b/tests/auto/qlowenergycontroller/tst_qlowenergycontroller.cpp @@ -185,7 +185,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); @@ -204,7 +214,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); |