diff options
author | Juha Vuolle <juha.vuolle@insta.fi> | 2022-08-26 12:52:51 +0300 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2022-08-30 05:30:44 +0000 |
commit | 8caf21bc979f7ae2aed21dff2a0371e48d771bdf (patch) | |
tree | 44dfbdd003229678b3ccd1e7136e21e3912795bb | |
parent | bc2703443f7b051389c36028e6363fd51636e633 (diff) | |
download | qtconnectivity-8caf21bc979f7ae2aed21dff2a0371e48d771bdf.tar.gz |
Skip parts of Bluetooth autotests on Android 12+ emulator
The CI uses Android emulator for running bluetooth tests for Android.
Up until Android 12 the emulator didn't have a bluetooth and only
the bluetooth parts which don't require actual bluetooth were tested.
This is similar to other platforms' bluetooth testing on CI.
The Android 12 emulator introduces a Bluetooth emulation. This causes
trouble when running tests on CI, as using bluetooth triggers
end-user dialogues, and consequently test cases time out waiting for
them.
This commit skips the problematic parts when tests are built for Android
in CI environment. This way the developers and testers can still run
the full bluetooth tests locally without need for manually removing the
skips.
Fixes: QTBUG-105803
Fixes: QTBUG-105808
Change-Id: I20bac041c3a4a0b83058482305dc735122d4c489
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 1ef066bf7d7a67d1b381443b9ecfa60f9204aca8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
5 files changed, 23 insertions, 20 deletions
diff --git a/tests/auto/CMakeLists.txt b/tests/auto/CMakeLists.txt index 96222438..672a550e 100644 --- a/tests/auto/CMakeLists.txt +++ b/tests/auto/CMakeLists.txt @@ -1,4 +1,9 @@ if(TARGET Qt::Bluetooth) + if(ANDROID) + if("$ENV{QTEST_ENVIRONMENT}" STREQUAL "ci") + add_compile_definitions(ANDROID_CI_TEST_ENVIRONMENT) + endif() + endif() add_subdirectory(qbluetoothaddress) add_subdirectory(qbluetoothdevicediscoveryagent) add_subdirectory(qbluetoothdeviceinfo) diff --git a/tests/auto/qbluetoothdevicediscoveryagent/tst_qbluetoothdevicediscoveryagent.cpp b/tests/auto/qbluetoothdevicediscoveryagent/tst_qbluetoothdevicediscoveryagent.cpp index 8e918b21..4cd2ddf9 100644 --- a/tests/auto/qbluetoothdevicediscoveryagent/tst_qbluetoothdevicediscoveryagent.cpp +++ b/tests/auto/qbluetoothdevicediscoveryagent/tst_qbluetoothdevicediscoveryagent.cpp @@ -128,9 +128,9 @@ void tst_QBluetoothDeviceDiscoveryAgent::deviceDiscoveryDebug(const QBluetoothDe void tst_QBluetoothDeviceDiscoveryAgent::tst_startStopDeviceDiscoveries() { -#ifdef Q_OS_ANDROID +#ifdef ANDROID_CI_TEST_ENVIRONMENT if (QNativeInterface::QAndroidApplication::sdkVersion() >= 31) - QSKIP("Fails on Android 12 in CI (QTBUG-105803)"); + QSKIP("Skipping test on Android 12+, emulator on CI can timeout waiting for user input"); #endif QBluetoothDeviceDiscoveryAgent discoveryAgent; @@ -404,9 +404,9 @@ void tst_QBluetoothDeviceDiscoveryAgent::tst_discoveryTimeout() void tst_QBluetoothDeviceDiscoveryAgent::tst_discoveryMethods() { -#ifdef Q_OS_ANDROID +#ifdef ANDROID_CI_TEST_ENVIRONMENT if (QNativeInterface::QAndroidApplication::sdkVersion() >= 31) - QSKIP("Fails on Android 12 in CI (QTBUG-105803)"); + QSKIP("Skipping test on Android 12+, emulator on CI can timeout waiting for user input"); #endif const QBluetoothLocalDevice localDevice; if (localDevice.allDevices().size() != 1) { diff --git a/tests/auto/qbluetoothlocaldevice/tst_qbluetoothlocaldevice.cpp b/tests/auto/qbluetoothlocaldevice/tst_qbluetoothlocaldevice.cpp index c610038e..d395379c 100644 --- a/tests/auto/qbluetoothlocaldevice/tst_qbluetoothlocaldevice.cpp +++ b/tests/auto/qbluetoothlocaldevice/tst_qbluetoothlocaldevice.cpp @@ -78,9 +78,9 @@ void tst_QBluetoothLocalDevice::initTestCase() void tst_QBluetoothLocalDevice::tst_powerOn() { -#ifdef Q_OS_ANDROID +#ifdef ANDROID_CI_TEST_ENVIRONMENT if (QNativeInterface::QAndroidApplication::sdkVersion() >= 31) - QSKIP("Skipping test on Android 12+, it can timeout waiting for user input (QTBUG-104914)"); + QSKIP("Skipping test on Android 12+, emulator on CI can timeout waiting for user input"); #endif #ifdef Q_OS_OSX QSKIP("Not possible on OS X"); @@ -114,9 +114,9 @@ void tst_QBluetoothLocalDevice::tst_powerOn() void tst_QBluetoothLocalDevice::tst_powerOff() { -#ifdef Q_OS_ANDROID +#ifdef ANDROID_CI_TEST_ENVIRONMENT if (QNativeInterface::QAndroidApplication::sdkVersion() >= 31) - QSKIP("Skipping test on Android 12+, it can timeout waiting for user input (QTBUG-104914)"); + QSKIP("Skipping test on Android 12+, emulator on CI can timeout waiting for user input"); #endif #ifdef Q_OS_OSX QSKIP("Not possible on OS X"); @@ -192,9 +192,9 @@ void tst_QBluetoothLocalDevice::tst_hostModes_data() void tst_QBluetoothLocalDevice::tst_hostModes() { -#ifdef Q_OS_ANDROID +#ifdef ANDROID_CI_TEST_ENVIRONMENT if (QNativeInterface::QAndroidApplication::sdkVersion() >= 31) - QSKIP("Skipping test on Android 12+, it can timeout waiting for user input (QTBUG-104914)"); + QSKIP("Skipping test on Android 12+, emulator on CI can timeout waiting for user input"); #endif #ifdef Q_OS_OSX QSKIP("Not possible on OS X"); @@ -371,10 +371,9 @@ void tst_QBluetoothLocalDevice::tst_pairDevice_data() void tst_QBluetoothLocalDevice::tst_pairDevice() { -#ifdef Q_OS_ANDROID - if (QNativeInterface::QAndroidApplication::sdkVersion() >= 31) { - QSKIP("Skipping test on Android 12+, it can timeout waiting for user input (QTBUG-104914)"); - } +#ifdef ANDROID_CI_TEST_ENVIRONMENT + if (QNativeInterface::QAndroidApplication::sdkVersion() >= 31) + QSKIP("Skipping test on Android 12+, emulator on CI can timeout waiting for user input"); #endif #if defined(Q_OS_MACOS) QSKIP("The pair device test fails on macOS"); diff --git a/tests/auto/qbluetoothserver/tst_qbluetoothserver.cpp b/tests/auto/qbluetoothserver/tst_qbluetoothserver.cpp index 6be10ec7..bf1a55b9 100644 --- a/tests/auto/qbluetoothserver/tst_qbluetoothserver.cpp +++ b/tests/auto/qbluetoothserver/tst_qbluetoothserver.cpp @@ -144,10 +144,9 @@ void tst_QBluetoothServer::tst_receive() { QFETCH(QBluetoothLocalDevice::HostMode, hostmode); -#ifdef Q_OS_ANDROID - if (QNativeInterface::QAndroidApplication::sdkVersion() >= 31) { - QSKIP("Skipping test on Android 12+, it can timeout waiting for user input (QTBUG-104914)"); - } +#ifdef ANDROID_CI_TEST_ENVIRONMENT + if (QNativeInterface::QAndroidApplication::sdkVersion() >= 31) + QSKIP("Skipping test on Android 12+, emulator on CI can timeout waiting for user input"); #endif QBluetoothLocalDevice localDev; diff --git a/tests/auto/qbluetoothservicediscoveryagent/tst_qbluetoothservicediscoveryagent.cpp b/tests/auto/qbluetoothservicediscoveryagent/tst_qbluetoothservicediscoveryagent.cpp index d8197780..a2979dc1 100644 --- a/tests/auto/qbluetoothservicediscoveryagent/tst_qbluetoothservicediscoveryagent.cpp +++ b/tests/auto/qbluetoothservicediscoveryagent/tst_qbluetoothservicediscoveryagent.cpp @@ -90,9 +90,9 @@ void tst_QBluetoothServiceDiscoveryAgent::serviceError(const QBluetoothServiceDi void tst_QBluetoothServiceDiscoveryAgent::initTestCase() { -#ifdef Q_OS_ANDROID +#ifdef ANDROID_CI_TEST_ENVIRONMENT if (QNativeInterface::QAndroidApplication::sdkVersion() >= 31) - QSKIP("Fails on Android 12 in CI (QTBUG-105803)"); + QSKIP("Skipping test on Android 12+, emulator on CI can timeout waiting for user input"); #endif if (localDeviceAvailable) { QBluetoothDeviceDiscoveryAgent discoveryAgent; |