diff --git a/src/qt/test/addressbooktests.cpp b/src/qt/test/addressbooktests.cpp --- a/src/qt/test/addressbooktests.cpp +++ b/src/qt/test/addressbooktests.cpp @@ -154,10 +154,10 @@ // framework when it tries to look up unimplemented cocoa functions, // and fails to handle returned nulls // (https://bugreports.qt.io/browse/QTBUG-49686). - QWARN( - "Skipping AddressBookTests on mac build with 'minimal' platform " - "set due to Qt bugs. To run AppTests, invoke with 'test_bitcoin-qt " - "-platform cocoa' on mac, or else use a linux or windows build."); + QWARN("Skipping AddressBookTests on mac build with 'minimal' platform " + "set due to Qt bugs. To run AppTests, invoke with " + "'QT_QPA_PLATFORM=cocoa test_bitcoin-qt' on mac, or else use a " + "linux or windows build."); return; } #endif diff --git a/src/qt/test/apptests.cpp b/src/qt/test/apptests.cpp --- a/src/qt/test/apptests.cpp +++ b/src/qt/test/apptests.cpp @@ -66,9 +66,8 @@ // and fails to handle returned nulls // (https://bugreports.qt.io/browse/QTBUG-49686). QWARN("Skipping AppTests on mac build with 'minimal' platform set due " - "to Qt bugs. To run AppTests, invoke " - "with 'test_bitcoin-qt -platform cocoa' on mac, or else use a " - "linux or windows build."); + "to Qt bugs. To run AppTests, invoke with 'QT_QPA_PLATFORM=cocoa " + "test_bitcoin-qt' on mac, or else use a linux or windows build."); return; } #endif diff --git a/src/qt/test/test_main.cpp b/src/qt/test/test_main.cpp --- a/src/qt/test/test_main.cpp +++ b/src/qt/test/test_main.cpp @@ -67,9 +67,11 @@ // platform ("xcb", "windows", or "cocoa") so tests can't unintentionally // interfere with any background GUIs and don't require extra resources. #if defined(WIN32) - _putenv_s("QT_QPA_PLATFORM", "minimal"); + if (getenv("QT_QPA_PLATFORM") == nullptr) { + _putenv_s("QT_QPA_PLATFORM", "minimal"); + } #else - setenv("QT_QPA_PLATFORM", "minimal", 0); + setenv("QT_QPA_PLATFORM", "minimal", /* overwrite */ 0); #endif // Don't remove this, it's needed to access diff --git a/src/qt/test/wallettests.cpp b/src/qt/test/wallettests.cpp --- a/src/qt/test/wallettests.cpp +++ b/src/qt/test/wallettests.cpp @@ -102,9 +102,9 @@ // // This also requires overriding the default minimal Qt platform: // -// src/qt/test/test_bitcoin-qt -platform xcb # Linux -// src/qt/test/test_bitcoin-qt -platform windows # Windows -// src/qt/test/test_bitcoin-qt -platform cocoa # macOS +// QT_QPA_PLATFORM=xcb src/qt/test/test_bitcoin-qt # Linux +// QT_QPA_PLATFORM=windows src/qt/test/test_bitcoin-qt # Windows +// QT_QPA_PLATFORM=cocoa src/qt/test/test_bitcoin-qt # macOS void TestGUI(interfaces::Node &node) { // Set up wallet and chain with 105 blocks (5 mature blocks for spending). TestChain100Setup test; @@ -256,9 +256,10 @@ // framework when it tries to look up unimplemented cocoa functions, // and fails to handle returned nulls // (https://bugreports.qt.io/browse/QTBUG-49686). - QWARN("Skipping WalletTests on mac build with 'minimal' platform set " - "due to Qt bugs. To run AppTests, invoke with 'test_bitcoin-qt " - "-platform cocoa' on mac, or else use a linux or windows build."); + QWARN( + "Skipping WalletTests on mac build with 'minimal' platform set due " + "to Qt bugs. To run AppTests, invoke with 'QT_QPA_PLATFORM=cocoa " + "test_bitcoin-qt' on mac, or else use a linux or windows build."); return; } #endif