diff options
author | Andreas Buhr <andreas@andreasbuhr.de> | 2021-03-09 11:21:11 +0100 |
---|---|---|
committer | Andreas Buhr <andreas@andreasbuhr.de> | 2021-03-10 12:59:14 +0100 |
commit | ab01e03bd27eaba421826e6cd8f8533bd5b2a9a0 (patch) | |
tree | 9a68ccc440c5deb9f63f353c0f47a50392a510ba /tests/auto/qbluetoothservicediscoveryagent/tst_qbluetoothservicediscoveryagent.cpp | |
parent | 44e72b713fe8d80ffcde7a76cb2c2c53bc16f5ff (diff) |
Fix tst_qbluetoothservicediscoveryagent
Only two failures during SDP discovery were allowed. If more than
two devices not supporting SDP are in range, the tests failed.
This is often the case. This patch changes the code to allow
for any number of non-SDP supporting devices in range.
Change-Id: I299cda56858b04f5077929365f2e6e096f11ef1a
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'tests/auto/qbluetoothservicediscoveryagent/tst_qbluetoothservicediscoveryagent.cpp')
-rw-r--r-- | tests/auto/qbluetoothservicediscoveryagent/tst_qbluetoothservicediscoveryagent.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/tests/auto/qbluetoothservicediscoveryagent/tst_qbluetoothservicediscoveryagent.cpp b/tests/auto/qbluetoothservicediscoveryagent/tst_qbluetoothservicediscoveryagent.cpp index d177edcc..f0ca059c 100644 --- a/tests/auto/qbluetoothservicediscoveryagent/tst_qbluetoothservicediscoveryagent.cpp +++ b/tests/auto/qbluetoothservicediscoveryagent/tst_qbluetoothservicediscoveryagent.cpp @@ -352,9 +352,6 @@ void tst_QBluetoothServiceDiscoveryAgent::tst_serviceDiscoveryAdapters() void tst_QBluetoothServiceDiscoveryAgent::tst_serviceDiscovery() { - // Not all devices respond to SDP, so allow for a failure - static int expected_failures = 0; - if (devices.isEmpty()) QSKIP("This test requires an in-range bluetooth device"); @@ -402,7 +399,7 @@ void tst_QBluetoothServiceDiscoveryAgent::tst_serviceDiscovery() scanTime -= 1000; } - if (discoveryAgent.error() && expected_failures++ < 2){ + if (discoveryAgent.error()) { qDebug() << "Device failed to respond to SDP, skipping device" << discoveryAgent.error() << discoveryAgent.errorString(); return; } @@ -415,7 +412,7 @@ void tst_QBluetoothServiceDiscoveryAgent::tst_serviceDiscovery() QVERIFY(errorSpy.isEmpty()); //if (discoveryAgent.discoveredServices().count() && expected_failures++ <2){ - if (discoveredSpy.isEmpty() && expected_failures++ < 2){ + if (discoveredSpy.isEmpty()) { qDebug() << "Device failed to return any results, skipping device" << discoveryAgent.discoveredServices().count(); return; } |