summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuha Vuolle <juha.vuolle@insta.fi>2021-12-14 12:50:42 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-12-22 16:12:44 +0000
commit27029057b039e4efbfd67deb883d50e3b1ce69b1 (patch)
tree344773e8b6aa3a6abf8e3b17f135e50183cdc3a6
parentf928bd4415aaa300929d336e26c42de8dca2fdb5 (diff)
Re-enable BT tests on macOS and add appropriate Info.plist
The custom Info.plist is needed to run the tests on macOS 12+ If the bluetooth adapter is OFF (as it is in CI) the tests pass fast. If the bluetooth adapter is ON there is one fail that will be addressed with another task (QTBUG-98955). In addition fixed one invokeMethod error which the testing revealed. Task-number: QTBUG-99222 Change-Id: Ia9fb10f0c3d00f5519fafc56234dcaacbb8013e8 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> (cherry picked from commit a508b9092bd2cfba67e059bf3b09f0dcdb3ae440) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/bluetooth/qbluetoothlocaldevice_macos.mm2
-rw-r--r--tests/auto/qbluetoothdevicediscoveryagent/CMakeLists.txt12
-rw-r--r--tests/auto/qbluetoothdevicediscoveryagent/tst_qbluetoothdevicediscoveryagent.cpp4
-rw-r--r--tests/auto/qbluetoothservicediscoveryagent/CMakeLists.txt12
-rw-r--r--tests/auto/qbluetoothservicediscoveryagent/tst_qbluetoothservicediscoveryagent.cpp3
-rw-r--r--tests/auto/qlowenergycharacteristic/CMakeLists.txt12
-rw-r--r--tests/auto/qlowenergycharacteristic/tst_qlowenergycharacteristic.cpp2
-rw-r--r--tests/auto/qlowenergycontroller/CMakeLists.txt12
-rw-r--r--tests/auto/qlowenergycontroller/tst_qlowenergycontroller.cpp6
-rw-r--r--tests/auto/qlowenergydescriptor/CMakeLists.txt12
-rw-r--r--tests/auto/qlowenergydescriptor/tst_qlowenergydescriptor.cpp5
-rw-r--r--tests/bluetoothtestdevice/CMakeLists.txt6
-rw-r--r--tests/manual/qlowenergycontroller/CMakeLists.txt6
-rw-r--r--tests/manual/qlowenergycontroller/Info.ios.plist35
-rw-r--r--tests/manual/qlowenergycontroller/Info.macos.plist24
-rw-r--r--tests/shared/Info.ios.plist (renamed from tests/bluetoothtestdevice/Info.ios.plist)0
-rw-r--r--tests/shared/Info.macos.plist (renamed from tests/bluetoothtestdevice/Info.macos.plist)0
17 files changed, 73 insertions, 80 deletions
diff --git a/src/bluetooth/qbluetoothlocaldevice_macos.mm b/src/bluetooth/qbluetoothlocaldevice_macos.mm
index 0ee9fce7..d425fe3f 100644
--- a/src/bluetooth/qbluetoothlocaldevice_macos.mm
+++ b/src/bluetooth/qbluetoothlocaldevice_macos.mm
@@ -315,7 +315,7 @@ void QBluetoothLocalDevicePrivate::deviceDisconnected(const QBluetoothAddress &d
void QBluetoothLocalDevicePrivate::emitError(QBluetoothLocalDevice::Error error, bool queued)
{
if (queued) {
- QMetaObject::invokeMethod(q_ptr, "error", Qt::QueuedConnection,
+ QMetaObject::invokeMethod(q_ptr, "errorOccurred", Qt::QueuedConnection,
Q_ARG(QBluetoothLocalDevice::Error, error));
} else {
emit q_ptr->errorOccurred(QBluetoothLocalDevice::PairingError);
diff --git a/tests/auto/qbluetoothdevicediscoveryagent/CMakeLists.txt b/tests/auto/qbluetoothdevicediscoveryagent/CMakeLists.txt
index cf72862e..44244264 100644
--- a/tests/auto/qbluetoothdevicediscoveryagent/CMakeLists.txt
+++ b/tests/auto/qbluetoothdevicediscoveryagent/CMakeLists.txt
@@ -16,3 +16,15 @@ qt_internal_extend_target(tst_qbluetoothdevicediscoveryagent CONDITION MACOS
PUBLIC_LIBRARIES
Qt::Widgets
)
+
+set_target_properties(tst_qbluetoothdevicediscoveryagent PROPERTIES
+ MACOSX_BUNDLE TRUE
+)
+
+if (APPLE AND NOT IOS)
+ # Ninja has trouble with relative paths, convert to absolute as a workaround
+ get_filename_component(SHARED_PLIST_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../shared ABSOLUTE)
+ set_target_properties(tst_qbluetoothdevicediscoveryagent PROPERTIES
+ MACOSX_BUNDLE_INFO_PLIST "${SHARED_PLIST_DIR}/Info.macos.plist"
+ )
+endif()
diff --git a/tests/auto/qbluetoothdevicediscoveryagent/tst_qbluetoothdevicediscoveryagent.cpp b/tests/auto/qbluetoothdevicediscoveryagent/tst_qbluetoothdevicediscoveryagent.cpp
index 9a9ed0f2..45b8e0b4 100644
--- a/tests/auto/qbluetoothdevicediscoveryagent/tst_qbluetoothdevicediscoveryagent.cpp
+++ b/tests/auto/qbluetoothdevicediscoveryagent/tst_qbluetoothdevicediscoveryagent.cpp
@@ -95,10 +95,6 @@ tst_QBluetoothDeviceDiscoveryAgent::~tst_QBluetoothDeviceDiscoveryAgent()
void tst_QBluetoothDeviceDiscoveryAgent::initTestCase()
{
-#if defined(Q_OS_MACOS)
- QSKIP("The device discovery agent tests fail on macOS");
-#endif
-
qRegisterMetaType<QBluetoothDeviceInfo>();
noOfLocalDevices = QBluetoothLocalDevice::allDevices().count();
diff --git a/tests/auto/qbluetoothservicediscoveryagent/CMakeLists.txt b/tests/auto/qbluetoothservicediscoveryagent/CMakeLists.txt
index 60763824..fd1244a0 100644
--- a/tests/auto/qbluetoothservicediscoveryagent/CMakeLists.txt
+++ b/tests/auto/qbluetoothservicediscoveryagent/CMakeLists.txt
@@ -16,3 +16,15 @@ qt_internal_extend_target(tst_qbluetoothservicediscoveryagent CONDITION MACOS
PUBLIC_LIBRARIES
Qt::Widgets
)
+
+set_target_properties(tst_qbluetoothservicediscoveryagent PROPERTIES
+ MACOSX_BUNDLE TRUE
+)
+
+if (APPLE AND NOT IOS)
+ # Ninja has trouble with relative paths, convert to absolute as a workaround
+ get_filename_component(SHARED_PLIST_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../shared ABSOLUTE)
+ set_target_properties(tst_qbluetoothservicediscoveryagent PROPERTIES
+ MACOSX_BUNDLE_INFO_PLIST "${SHARED_PLIST_DIR}/Info.macos.plist"
+ )
+endif()
diff --git a/tests/auto/qbluetoothservicediscoveryagent/tst_qbluetoothservicediscoveryagent.cpp b/tests/auto/qbluetoothservicediscoveryagent/tst_qbluetoothservicediscoveryagent.cpp
index 3568f940..99f1642e 100644
--- a/tests/auto/qbluetoothservicediscoveryagent/tst_qbluetoothservicediscoveryagent.cpp
+++ b/tests/auto/qbluetoothservicediscoveryagent/tst_qbluetoothservicediscoveryagent.cpp
@@ -114,9 +114,6 @@ void tst_QBluetoothServiceDiscoveryAgent::serviceError(const QBluetoothServiceDi
void tst_QBluetoothServiceDiscoveryAgent::initTestCase()
{
-#if defined(Q_OS_MACOS)
- QSKIP("The service discovery agent tests fail on macOS");
-#endif
if (localDeviceAvailable) {
QBluetoothDeviceDiscoveryAgent discoveryAgent;
diff --git a/tests/auto/qlowenergycharacteristic/CMakeLists.txt b/tests/auto/qlowenergycharacteristic/CMakeLists.txt
index 43932a68..44d47e2d 100644
--- a/tests/auto/qlowenergycharacteristic/CMakeLists.txt
+++ b/tests/auto/qlowenergycharacteristic/CMakeLists.txt
@@ -8,3 +8,15 @@ qt_internal_add_test(tst_qlowenergycharacteristic
PUBLIC_LIBRARIES
Qt::Bluetooth
)
+
+set_target_properties(tst_qlowenergycharacteristic PROPERTIES
+ MACOSX_BUNDLE TRUE
+)
+
+if (APPLE AND NOT IOS)
+ # Ninja has trouble with relative paths, convert to absolute as a workaround
+ get_filename_component(SHARED_PLIST_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../shared ABSOLUTE)
+ set_target_properties(tst_qlowenergycharacteristic PROPERTIES
+ MACOSX_BUNDLE_INFO_PLIST "${SHARED_PLIST_DIR}/Info.macos.plist"
+ )
+endif()
diff --git a/tests/auto/qlowenergycharacteristic/tst_qlowenergycharacteristic.cpp b/tests/auto/qlowenergycharacteristic/tst_qlowenergycharacteristic.cpp
index f56d7098..27a89dd6 100644
--- a/tests/auto/qlowenergycharacteristic/tst_qlowenergycharacteristic.cpp
+++ b/tests/auto/qlowenergycharacteristic/tst_qlowenergycharacteristic.cpp
@@ -113,7 +113,7 @@ void tst_QLowEnergyCharacteristic::initTestCase()
QVERIFY(spy.isEmpty());
devAgent->start();
- QTRY_VERIFY_WITH_TIMEOUT(spy.count() > 0, 50000);
+ QTRY_VERIFY_WITH_TIMEOUT(spy.count() > 0, 100000);
// find first service with descriptor
QLowEnergyController *controller = 0;
diff --git a/tests/auto/qlowenergycontroller/CMakeLists.txt b/tests/auto/qlowenergycontroller/CMakeLists.txt
index 247ee758..cab6bb44 100644
--- a/tests/auto/qlowenergycontroller/CMakeLists.txt
+++ b/tests/auto/qlowenergycontroller/CMakeLists.txt
@@ -21,3 +21,15 @@ qt_internal_extend_target(tst_qlowenergycontroller CONDITION IOS OR MACOS
PUBLIC_LIBRARIES
Qt::Widgets
)
+
+set_target_properties(tst_qlowenergycontroller PROPERTIES
+ MACOSX_BUNDLE TRUE
+)
+
+if (APPLE AND NOT IOS)
+ # Ninja has trouble with relative paths, convert to absolute as a workaround
+ get_filename_component(SHARED_PLIST_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../shared ABSOLUTE)
+ set_target_properties(tst_qlowenergycontroller PROPERTIES
+ MACOSX_BUNDLE_INFO_PLIST "${SHARED_PLIST_DIR}/Info.macos.plist"
+ )
+endif()
diff --git a/tests/auto/qlowenergycontroller/tst_qlowenergycontroller.cpp b/tests/auto/qlowenergycontroller/tst_qlowenergycontroller.cpp
index 33b45feb..3afb78b3 100644
--- a/tests/auto/qlowenergycontroller/tst_qlowenergycontroller.cpp
+++ b/tests/auto/qlowenergycontroller/tst_qlowenergycontroller.cpp
@@ -114,9 +114,6 @@ tst_QLowEnergyController::~tst_QLowEnergyController()
void tst_QLowEnergyController::initTestCase()
{
-#if defined(Q_OS_MACOS)
- QSKIP("The low energy controller tests fail on macOS");
-#endif
#if !defined(Q_OS_MAC)
if (remoteDevice.isNull()
#if !QT_CONFIG(winrt_bt)
@@ -163,7 +160,8 @@ void tst_QLowEnergyController::initTestCase()
}
}
- QVERIFY2(deviceFound, "Cannot find remote device.");
+ if (!deviceFound || !remoteDeviceInfo.isValid())
+ qWarning() << "The sensor tag device was not found, will skip most of the test";
// These are the services exported by the TI SensorTag
#ifndef Q_OS_MAC
diff --git a/tests/auto/qlowenergydescriptor/CMakeLists.txt b/tests/auto/qlowenergydescriptor/CMakeLists.txt
index 310746e5..7bc72966 100644
--- a/tests/auto/qlowenergydescriptor/CMakeLists.txt
+++ b/tests/auto/qlowenergydescriptor/CMakeLists.txt
@@ -8,3 +8,15 @@ qt_internal_add_test(tst_qlowenergydescriptor
PUBLIC_LIBRARIES
Qt::Bluetooth
)
+
+set_target_properties(tst_qlowenergydescriptor PROPERTIES
+ MACOSX_BUNDLE TRUE
+)
+
+if (APPLE AND NOT IOS)
+ # Ninja has trouble with relative paths, convert to absolute as a workaround
+ get_filename_component(SHARED_PLIST_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../shared ABSOLUTE)
+ set_target_properties(tst_qlowenergydescriptor PROPERTIES
+ MACOSX_BUNDLE_INFO_PLIST "${SHARED_PLIST_DIR}/Info.macos.plist"
+ )
+endif()
diff --git a/tests/auto/qlowenergydescriptor/tst_qlowenergydescriptor.cpp b/tests/auto/qlowenergydescriptor/tst_qlowenergydescriptor.cpp
index 45cdf4ac..2fe6decf 100644
--- a/tests/auto/qlowenergydescriptor/tst_qlowenergydescriptor.cpp
+++ b/tests/auto/qlowenergydescriptor/tst_qlowenergydescriptor.cpp
@@ -74,9 +74,6 @@ tst_QLowEnergyDescriptor::~tst_QLowEnergyDescriptor()
void tst_QLowEnergyDescriptor::initTestCase()
{
-#if defined(Q_OS_MACOS)
- QSKIP("The low energy descriptor tests fail on macOS");
-#endif
if (QBluetoothLocalDevice::allDevices().isEmpty()) {
qWarning("No remote device discovered.");
@@ -104,7 +101,7 @@ void tst_QLowEnergyDescriptor::initTestCase()
QVERIFY(spy.isEmpty());
devAgent->start();
- QTRY_VERIFY_WITH_TIMEOUT(spy.count() > 0, 50000);
+ QTRY_VERIFY_WITH_TIMEOUT(spy.count() > 0, 100000);
// find first service with descriptor
QLowEnergyController *controller = nullptr;
diff --git a/tests/bluetoothtestdevice/CMakeLists.txt b/tests/bluetoothtestdevice/CMakeLists.txt
index 7e9281e8..ed35ac16 100644
--- a/tests/bluetoothtestdevice/CMakeLists.txt
+++ b/tests/bluetoothtestdevice/CMakeLists.txt
@@ -34,13 +34,15 @@ set_target_properties(bluetoothtestdevice PROPERTIES
)
if(APPLE)
+ # Ninja has trouble with relative paths, convert to absolute as a workaround
+ get_filename_component(SHARED_PLIST_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../shared ABSOLUTE)
if(IOS)
set_target_properties(bluetoothtestdevice PROPERTIES
- MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/Info.ios.plist"
+ MACOSX_BUNDLE_INFO_PLIST "${SHARED_PLIST_DIR}/Info.ios.plist"
)
else()
set_target_properties(bluetoothtestdevice PROPERTIES
- MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/Info.macos.plist"
+ MACOSX_BUNDLE_INFO_PLIST "${SHARED_PLIST_DIR}/Info.macos.plist"
)
endif()
endif()
diff --git a/tests/manual/qlowenergycontroller/CMakeLists.txt b/tests/manual/qlowenergycontroller/CMakeLists.txt
index 6573c19c..022433ee 100644
--- a/tests/manual/qlowenergycontroller/CMakeLists.txt
+++ b/tests/manual/qlowenergycontroller/CMakeLists.txt
@@ -44,13 +44,15 @@ set_target_properties(tst_qlowenergycontroller_device PROPERTIES
)
if(APPLE)
+ # Ninja has trouble with relative paths, convert to absolute as a workaround
+ get_filename_component(SHARED_PLIST_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../shared ABSOLUTE)
if(IOS)
set_target_properties(tst_qlowenergycontroller_device PROPERTIES
- MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/Info.ios.plist"
+ MACOSX_BUNDLE_INFO_PLIST "${SHARED_PLIST_DIR}/Info.ios.plist"
)
else()
set_target_properties(tst_qlowenergycontroller_device PROPERTIES
- MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/Info.macos.plist"
+ MACOSX_BUNDLE_INFO_PLIST "${SHARED_PLIST_DIR}/Info.macos.plist"
)
endif()
endif()
diff --git a/tests/manual/qlowenergycontroller/Info.ios.plist b/tests/manual/qlowenergycontroller/Info.ios.plist
deleted file mode 100644
index 8dc7f08e..00000000
--- a/tests/manual/qlowenergycontroller/Info.ios.plist
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>CFBundleDisplayName</key>
- <string>${MACOSX_BUNDLE_EXECUTABLE_NAME}</string>
- <key>CFBundleExecutable</key>
- <string>${MACOSX_BUNDLE_EXECUTABLE_NAME}</string>
- <key>CFBundleIconFile</key>
- <string>${MACOSX_BUNDLE_ICON_FILE}</string>
- <key>CFBundleIdentifier</key>
- <string>${MACOSX_BUNDLE_GUI_IDENTIFIER}</string>
- <key>CFBundleName</key>
- <string>${MACOSX_BUNDLE_BUNDLE_NAME}</string>
- <key>CFBundlePackageType</key>
- <string>APPL</string>
- <key>CFBundleShortVersionString</key>
- <string>${MACOSX_BUNDLE_SHORT_VERSION_STRING}</string>
- <key>CFBundleVersion</key>
- <string>${MACOSX_BUNDLE_BUNDLE_VERSION}</string>
- <key>LSRequiresIPhoneOS</key>
- <true/>
- <key>NSBluetoothAlwaysUsageDescription</key>
- <string>BT test component wants to access your bluetooth adapter</string>
- <key>UILaunchStoryboardName</key>
- <string>LaunchScreen</string>
- <key>UISupportedInterfaceOrientations</key>
- <array>
- <string>UIInterfaceOrientationPortrait</string>
- <string>UIInterfaceOrientationPortraitUpsideDown</string>
- <string>UIInterfaceOrientationLandscapeLeft</string>
- <string>UIInterfaceOrientationLandscapeRight</string>
- </array>
-</dict>
-</plist>
diff --git a/tests/manual/qlowenergycontroller/Info.macos.plist b/tests/manual/qlowenergycontroller/Info.macos.plist
deleted file mode 100644
index 7c18450d..00000000
--- a/tests/manual/qlowenergycontroller/Info.macos.plist
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>CFBundleExecutable</key>
- <string>${MACOSX_BUNDLE_EXECUTABLE_NAME}</string>
- <key>CFBundleIconFile</key>
- <string>${MACOSX_BUNDLE_ICON_FILE}</string>
- <key>CFBundleIdentifier</key>
- <string>${MACOSX_BUNDLE_GUI_IDENTIFIER}</string>
- <key>CFBundlePackageType</key>
- <string>APPL</string>
- <key>CFBundleSignature</key>
- <string>????</string>
- <key>LSMinimumSystemVersion</key>
- <string>${CMAKE_OSX_DEPLOYMENT_TARGET}</string>
- <key>NSPrincipalClass</key>
- <string>NSApplication</string>
- <key>NSBluetoothAlwaysUsageDescription</key>
- <string>BT test component wants to access your bluetooth adapter</string>
- <key>NSSupportsAutomaticGraphicsSwitching</key>
- <true/>
-</dict>
-</plist>
diff --git a/tests/bluetoothtestdevice/Info.ios.plist b/tests/shared/Info.ios.plist
index 8dc7f08e..8dc7f08e 100644
--- a/tests/bluetoothtestdevice/Info.ios.plist
+++ b/tests/shared/Info.ios.plist
diff --git a/tests/bluetoothtestdevice/Info.macos.plist b/tests/shared/Info.macos.plist
index 7c18450d..7c18450d 100644
--- a/tests/bluetoothtestdevice/Info.macos.plist
+++ b/tests/shared/Info.macos.plist