From faccf5f9c899c40d4da5792629d0714249a4616b Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Tue, 1 Oct 2019 16:11:12 -0400 Subject: [PATCH 1/2] doc: Explain QT_QPA_PLATFORM for gui tests --- src/qt/test/addressbooktests.cpp | 2 +- src/qt/test/apptests.cpp | 2 +- src/qt/test/test_main.cpp | 2 +- src/qt/test/wallettests.cpp | 8 ++++---- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/qt/test/addressbooktests.cpp b/src/qt/test/addressbooktests.cpp index 11a518ebd..4fe440a67 100644 --- a/src/qt/test/addressbooktests.cpp +++ b/src/qt/test/addressbooktests.cpp @@ -146,7 +146,7 @@ void AddressBookTests::addressBookTests() // 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."); + "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 index 8ae01ac09..e730c8f6d 100644 --- a/src/qt/test/apptests.cpp +++ b/src/qt/test/apptests.cpp @@ -57,7 +57,7 @@ void AppTests::appTests() // 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."); + "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 index 796cf24b3..3e6b3a2a1 100644 --- a/src/qt/test/test_main.cpp +++ b/src/qt/test/test_main.cpp @@ -63,7 +63,7 @@ int main(int argc, char *argv[]) #if defined(WIN32) _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 index 120dff95c..eea874c0d 100644 --- a/src/qt/test/wallettests.cpp +++ b/src/qt/test/wallettests.cpp @@ -123,9 +123,9 @@ void BumpFee(TransactionView& view, const uint256& txid, bool expectDisabled, st // // 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() { // Set up wallet and chain with 105 blocks (5 mature blocks for spending). @@ -256,7 +256,7 @@ void WalletTests::walletTests() // 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."); + "with 'QT_QPA_PLATFORM=cocoa test_bitcoin-qt' on mac, or else use a linux or windows build."); return; } #endif From fa06bb607da2d3e35723661156d873c8eac1fa50 Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Tue, 1 Oct 2019 17:03:09 -0400 Subject: [PATCH 2/2] qa: Do not force overwrite of QT_QPA_PLATFORM on windows for gui tests --- src/qt/test/test_main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qt/test/test_main.cpp b/src/qt/test/test_main.cpp index 3e6b3a2a1..c39266a39 100644 --- a/src/qt/test/test_main.cpp +++ b/src/qt/test/test_main.cpp @@ -61,7 +61,7 @@ int main(int argc, char *argv[]) // 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", /* overwrite */ 0); #endif