Add test coverage for Qt initialization code & basic RPC console functionality
Motivation for this change was a bug in #11603 which existing tests failed to catch.
Travis failures:
0In file included from /usr/include/qt4/QtGui/QLineEdit:1:0,
1 from qt/test/apptests.cpp:20:
2/usr/include/qt4/QtGui/qlineedit.h: In function ‘void {anonymous}::TestRpcCommand(RPCConsole*)’:
3/usr/include/qt4/QtGui/qlineedit.h:198:10: error: ‘void QLineEdit::returnPressed()’ is protected
4 void returnPressed();
5 ^
6qt/test/apptests.cpp:34:29: error: within this context
7 lineEdit->returnPressed();
8 ^
9make[2]: *** [qt/test/qt_test_test_bitcoin_qt-apptests.o] Error 1
0FAIL: qt/test/test_bitcoin-qt
1=============================
2********* Start testing of AppTests *********
3Config: Using QtTest library 5.7.1, Qt 5.7.1 (x86_64-little_endian-lp64 static release build; by GCC 4.8.4)
4PASS : AppTests::initTestCase()
5QWARN : AppTests::appTests() Backing up GUI settings to "/tmp/test_bitcoin-qt_1510018491_71945/regtest/guisettings.ini.bak"
6QWARN : AppTests::appTests() QFont::setPointSizeF: Point size <= 0 (-1.000000), must be greater than 0
7QWARN : AppTests::appTests() QFont::setPointSizeF: Point size <= 0 (-1.000000), must be greater than 0
8QWARN : AppTests::appTests() QFont::setPointSizeF: Point size <= 0 (-1.000000), must be greater than 0
9QWARN : AppTests::appTests() QFont::setPointSizeF: Point size <= 0 (-1.000000), must be greater than 0
10QWARN : AppTests::appTests() QFont::setPointSizeF: Point size <= 0 (-1.000000), must be greater than 0
11QWARN : AppTests::appTests() QFont::setPointSizeF: Point size <= 0 (-1.000000), must be greater than 0
12QWARN : AppTests::appTests() QFont::setPointSizeF: Point size <= 0 (-1.000000), must be greater than 0
13QWARN : AppTests::appTests() QFont::setPointSizeF: Point size <= 0 (-1.000000), must be greater than 0
14QDEBUG : AppTests::appTests() requestInitialize : Requesting initialize
15QDEBUG : AppTests::appTests() initialize : Running initialization in thread
16QDEBUG : AppTests::appTests() initializeResult : Initialization result: true
17QWARN : AppTests::appTests() Platform customization: "other"
18========= Received signal, dumping stack ==============
19========= End of stack trace ==============
20QFATAL : AppTests::appTests() Received signal 11
21 Function time: 267ms Total time: 272ms
22FAIL! : AppTests::appTests() Received a fatal error.
23 Loc: [Unknown file(0)]
24Totals: 1 passed, 1 failed, 0 skipped, 0 blacklisted, 284ms
25********* Finished testing of AppTests *********
58+ m_app.exec();
59+
60+ // Reset some global state to avoid interfering with later tests.
61+ ResetShutdownRequested();
62+#ifdef ENABLE_WALLET
63+ ::bitdb.~CDBEnv();
0bitdb.Close();
1bitdb.Reset();
68+
69+//! Entry point for BitcoinGUI tests.
70+void AppTests::guiTests(BitcoinGUI* window)
71+{
72+ HandleCallback windowShown{*this};
73+ expectCallback(); // consoleShown
How about storing the name? Is this supposed to be stack like?
Kind of, but it’s a pool, not a stack. The idea is just for AppTests to just create a bunch of windows and let appropriate tests run as the windows are created, without having to worry about the order events happen. To track names instead of using a counter, int m_callbacks
could be replaced with std::multiset<std::string> m_callbacks
, and ++
--
replaced by insert
and erase
. It seems like this might just be more verbose and error prone without being more readable than current comments, but I could change it if you think it would be better.
I see 2 advantages over counting:
BTW, have you thought using QSignalSpy?
I see 2 advantages over counting:
- the comment is optional but the argument is not;
- better hint if the set is not empty at the end.
BTW, have you thought using QSignalSpy?
Ok, switched from an int to a set. I didn’t know about signal spy, but it doesn’t seem quite right for this because it can track signals but not run handlers. Here I am tracking signals (to trigger shutdown after last one) but only in the course of handling them. Signal spy does have a wait method which looks like it would be nice to replace the temporary loop in TestRpcCommand, but unfortunately it is in qt5 but not qt4.
31+
32+ //! Bitcoin application.
33+ BitcoinApplication& m_app;
34+
35+ //! Number of expected callbacks pending.
36+ int m_callbacks = 0;
QStack<QString> m_callbacks;
. See above.
579@@ -578,11 +580,13 @@ void BitcoinGUI::setWalletActionsEnabled(bool enabled)
580 void BitcoinGUI::createTrayIcon(const NetworkStyle *networkStyle)
581 {
582 #ifndef Q_OS_MAC
583- trayIcon = new QSystemTrayIcon(this);
584- QString toolTip = tr("%1 client").arg(tr(PACKAGE_NAME)) + " " + networkStyle->getTitleAddText();
585- trayIcon->setToolTip(toolTip);
586- trayIcon->setIcon(networkStyle->getTrayAndWindowIcon());
587- trayIcon->hide();
588+ if (QSystemTrayIcon::isSystemTrayAvailable()) {
Different commit?
I’m not a fan of putting code changes in separate commits from test changes. Having related code changes, test changes, and documentation changes together in a single atomic unit makes understanding history simpler, and can let you run automated checks for things like the new test failing before the code change, and succeeding after the code change.
24+#include <QtGlobal>
25+#if QT_VERSION >= 0x050000
26+#include <QtTest/QtTestWidgets>
27+#endif
28+#include <QtTest/QtTestGui>
29+#include <new>
Remove?
I don’t see why it should be removed. This was added by iwyu, and I tend to agree with the rationales they give for including things at https://github.com/include-what-you-use/include-what-you-use/blob/master/docs/WhyIWYU.md
19+#include <QEventLoop>
20+#include <QLineEdit>
21+#include <QScopedPointer>
22+#include <QTest>
23+#include <QTextEdit>
24+#include <QtGlobal>
Nit, sort includes.
These are sorted (case is significant).
Any hint?
0make clean && make
1
2...
3
4 CXXLD qt/test/test_bitcoin-qt
5Undefined symbols for architecture x86_64:
6 "MacNotificationHandler::instance()", referenced from:
7 Notificator::Notificator(QString const&, QSystemTrayIcon*, QWidget*) in libbitcoinqt.a(qt_libbitcoinqt_a-notificator.o)
8 Notificator::notify(Notificator::Class, QString const&, QString const&, QIcon const&, int) in libbitcoinqt.a(qt_libbitcoinqt_a-notificator.o)
9 "MacNotificationHandler::hasUserNotificationCenterSupport()", referenced from:
10 Notificator::Notificator(QString const&, QSystemTrayIcon*, QWidget*) in libbitcoinqt.a(qt_libbitcoinqt_a-notificator.o)
11 "MacNotificationHandler::showNotification(QString const&, QString const&)", referenced from:
12 Notificator::notify(Notificator::Class, QString const&, QString const&, QIcon const&, int) in libbitcoinqt.a(qt_libbitcoinqt_a-notificator.o)
13 "MacDockIconHandler::cleanup()", referenced from:
14 BitcoinGUI::~BitcoinGUI() in libbitcoinqt.a(qt_libbitcoinqt_a-bitcoingui.o)
15 "MacDockIconHandler::setMainWindow(QMainWindow*)", referenced from:
16 BitcoinGUI::createTrayIconMenu() in libbitcoinqt.a(qt_libbitcoinqt_a-bitcoingui.o)
17 "MacDockIconHandler::dockMenu()", referenced from:
18 BitcoinGUI::createTrayIconMenu() in libbitcoinqt.a(qt_libbitcoinqt_a-bitcoingui.o)
19 "MacDockIconHandler::instance()", referenced from:
20 BitcoinGUI::BitcoinGUI(PlatformStyle const*, NetworkStyle const*, QWidget*) in libbitcoinqt.a(qt_libbitcoinqt_a-bitcoingui.o)
21 BitcoinGUI::createTrayIconMenu() in libbitcoinqt.a(qt_libbitcoinqt_a-bitcoingui.o)
22 "MacDockIconHandler::setIcon(QIcon const&)", referenced from:
23 BitcoinGUI::BitcoinGUI(PlatformStyle const*, NetworkStyle const*, QWidget*) in libbitcoinqt.a(qt_libbitcoinqt_a-bitcoingui.o)
24ld: symbol(s) not found for architecture x86_64
25clang: error: linker command failed with exit code 1 (use -v to see invocation)
26make[2]: *** [qt/test/test_bitcoin-qt] Error 1
27make[2]: *** Waiting for unfinished jobs....
28make[1]: *** [all-recursive] Error 1
29make: *** [all-recursive] Error 1
Have the same compile issue (clang):
0Undefined symbols for architecture x86_64:
1 "MacNotificationHandler::instance()", referenced from:
2 Notificator::Notificator(QString const&, QSystemTrayIcon*, QWidget*) in libbitcoinqt.a(qt_libbitcoinqt_a-notificator.o)
3 Notificator::notifyMacUserNotificationCenter(Notificator::Class, QString const&, QString const&, QIcon const&) in libbitcoinqt.a(qt_libbitcoinqt_a-notificator.o)
4 "MacNotificationHandler::hasUserNotificationCenterSupport()", referenced from:
5 Notificator::Notificator(QString const&, QSystemTrayIcon*, QWidget*) in libbitcoinqt.a(qt_libbitcoinqt_a-notificator.o)
6 "MacNotificationHandler::showNotification(QString const&, QString const&)", referenced from:
7 Notificator::notifyMacUserNotificationCenter(Notificator::Class, QString const&, QString const&, QIcon const&) in libbitcoinqt.a(qt_libbitcoinqt_a-notificator.o)
8 "MacDockIconHandler::cleanup()", referenced from:
9 BitcoinGUI::~BitcoinGUI() in libbitcoinqt.a(qt_libbitcoinqt_a-bitcoingui.o)
10 "MacDockIconHandler::setMainWindow(QMainWindow*)", referenced from:
11 BitcoinGUI::createTrayIconMenu() in libbitcoinqt.a(qt_libbitcoinqt_a-bitcoingui.o)
12 "MacDockIconHandler::dockMenu()", referenced from:
13 BitcoinGUI::createTrayIconMenu() in libbitcoinqt.a(qt_libbitcoinqt_a-bitcoingui.o)
14 "MacDockIconHandler::instance()", referenced from:
15 BitcoinGUI::BitcoinGUI(PlatformStyle const*, NetworkStyle const*, QWidget*) in libbitcoinqt.a(qt_libbitcoinqt_a-bitcoingui.o)
16 BitcoinGUI::createTrayIconMenu() in libbitcoinqt.a(qt_libbitcoinqt_a-bitcoingui.o)
17 "MacDockIconHandler::setIcon(QIcon const&)", referenced from:
18 BitcoinGUI::BitcoinGUI(PlatformStyle const*, NetworkStyle const*, QWidget*) in libbitcoinqt.a(qt_libbitcoinqt_a-bitcoingui.o)
19ld: symbol(s) not found for architecture x86_64
20clang: error: linker command failed with exit code 1 (use -v to see invocation)
21make[2]: *** [qt/test/test_bitcoin-qt] Error 1
22make[1]: *** [all-recursive] Error 1
Looks like an OSX issue.
Looking into the link error, but @jonasschnelli do you have an idea why the build might be failing for you even though the apple target succeeds on travis?
Seems like the reason is that travis doesn’t build tests for the apple target (it is just running make deploy
).
I also think I see the reason for the error. BITCOIN_MM
files seem to get directly linked into the qt/bitcoin-qt
executable instead of being part of qt/libbitcoinqt.a
. I will try to move them there.
Travis was passing, but I just re-triggered it (to test it on top of master), now https://travis-ci.org/bitcoin/bitcoin/jobs/309721182 :(
Strange:
00.01s$ if [ "$CHECK_DOC" = 1 -a "$TRAVIS_EVENT_TYPE" = "pull_request" ]; then contrib/devtools/lint-all.sh; fi
1contrib/devtools/lint-python.sh: 10: contrib/devtools/lint-python.sh: flake8: not found
2^---- failure generated from contrib/devtools/lint-python.sh
@laanwj It is a travis bug :( They use the source code from master (merged with this pull) but the .travis.yml of only the pull…
Needs rebase
Just ran this locally (on top of master) and got the error blow (while master passes):
0********* Start testing of AppTests *********
1Config: Using QtTest library 5.10.0, Qt 5.10.0 (x86_64-little_endian-lp64 shared (dynamic) release build; by Clang 9.0.0 (clang-900.0.39.2) (Apple))
2PASS : AppTests::initTestCase()
3QWARN : AppTests::appTests() Backing up GUI settings to "/var/folders/ct/m1t1vdnj16b578f6f50jct3m0000gn/T/test_bitcoin-qt_1518433105_69222/regtest/guisettings.ini.bak"
4
5========= Received signal, dumping stack ==============
6(lldb) process attach --pid 19198
7Process 19198 stopped
8* thread [#1](/bitcoin-bitcoin/1/), queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
9 frame [#0](/bitcoin-bitcoin/0/): 0x00007fffe7487406 libsystem_kernel.dylib`__wait4_nocancel + 10
10libsystem_kernel.dylib`__wait4_nocancel:
11-> 0x7fffe7487406 <+10>: jae 0x7fffe7487410 ; <+20>
12 0x7fffe7487408 <+12>: movq %rax, %rdi
13 0x7fffe748740b <+15>: jmp 0x7fffe747fcaf ; cerror_nocancel
14 0x7fffe7487410 <+20>: retq
15Target 0: (test_bitcoin-qt) stopped.
16
17Executable module set to "/Users/jonasschnelli/Documents/bitcoin/bitcoin/./src/qt/test/test_bitcoin-qt".
18Architecture set to: x86_64h-apple-macosx.
19(lldb) bt all
20* thread [#1](/bitcoin-bitcoin/1/), queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
21 * frame [#0](/bitcoin-bitcoin/0/): 0x00007fffe7487406 libsystem_kernel.dylib`__wait4_nocancel + 10
22 frame [#1](/bitcoin-bitcoin/1/): 0x00007fffe740de3d libsystem_c.dylib`system + 463
23 frame [#2](/bitcoin-bitcoin/2/): 0x0000000107da0f42 QtTest`___lldb_unnamed_symbol20$$QtTest + 162
24 frame [#3](/bitcoin-bitcoin/3/): 0x0000000107da0e4d QtTest`___lldb_unnamed_symbol19$$QtTest + 205
25 frame [#4](/bitcoin-bitcoin/4/): 0x00007fffe7567b3a libsystem_platform.dylib`_sigtramp + 26
26 frame [#5](/bitcoin-bitcoin/5/): 0x000000010812202a QtWidgets`QMenu::setAsDockMenu() + 42
27 frame [#6](/bitcoin-bitcoin/6/): 0x000000010546de81 test_bitcoin-qt`MacDockIconHandler::MacDockIconHandler(this=0x00007f9578f0fee0) at macdockiconhandler.mm:60
28 frame [#7](/bitcoin-bitcoin/7/): 0x000000010546df25 test_bitcoin-qt`MacDockIconHandler::MacDockIconHandler(this=0x00007f9578f0fee0) at macdockiconhandler.mm:50
29 frame [#8](/bitcoin-bitcoin/8/): 0x000000010546e508 test_bitcoin-qt`MacDockIconHandler::instance() at macdockiconhandler.mm:116
30 frame [#9](/bitcoin-bitcoin/9/): 0x00000001052e40a9 test_bitcoin-qt`BitcoinGUI::BitcoinGUI(this=0x00007f9578f0e6b0, _platformStyle=0x00007f9578deb140, networkStyle=0x00007f9578c03db0, parent=0x0000000000000000) at bitcoingui.cpp:143
31 frame [#10](/bitcoin-bitcoin/10/): 0x00000001052ea17b test_bitcoin-qt`BitcoinGUI::BitcoinGUI(this=0x00007f9578f0e6b0, _platformStyle=0x00007f9578deb140, networkStyle=0x00007f9578c03db0, parent=0x0000000000000000) at bitcoingui.cpp:121
32 frame [#11](/bitcoin-bitcoin/11/): 0x00000001052de9f9 test_bitcoin-qt`BitcoinApplication::createWindow(this=0x00007fff5a9d18b8, networkStyle=0x00007f9578c03db0) at bitcoin.cpp:297
33 frame [#12](/bitcoin-bitcoin/12/): 0x0000000105236c9a test_bitcoin-qt`AppTests::appTests(this=0x00007fff5a9d1880) at apptests.cpp:58
34 frame [#13](/bitcoin-bitcoin/13/): 0x00000001052d6b1a test_bitcoin-qt`AppTests::qt_static_metacall(_o=0x00007fff5a9d1880, _c=InvokeMetaMethod, _id=0, _a=0x00007fff5a9d0d50) at moc_apptests.cpp:81
35 frame [#14](/bitcoin-bitcoin/14/): 0x00000001079fb19c QtCore`QMetaMethod::invoke(QObject*, Qt::ConnectionType, QGenericReturnArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument) const + 1308
36 frame [#15](/bitcoin-bitcoin/15/): 0x0000000107d9ee01 QtTest`___lldb_unnamed_symbol11$$QtTest + 1169
37 frame [#16](/bitcoin-bitcoin/16/): 0x0000000107d9fac9 QtTest`___lldb_unnamed_symbol13$$QtTest + 777
38 frame [#17](/bitcoin-bitcoin/17/): 0x0000000107da09d7 QtTest`___lldb_unnamed_symbol17$$QtTest + 1031
39 frame [#18](/bitcoin-bitcoin/18/): 0x0000000107da1557 QtTest`QTest::qRun() + 247
40 frame [#19](/bitcoin-bitcoin/19/): 0x0000000107da11b0 QtTest`QTest::qExec(QObject*, int, char**) + 16
41 frame [#20](/bitcoin-bitcoin/20/): 0x000000010524fb66 test_bitcoin-qt`main(argc=1, argv=0x00007fff5a9d19d8) at test_main.cpp:82
42 frame [#21](/bitcoin-bitcoin/21/): 0x00007fffe7358235 libdyld.dylib`start + 1
43 frame [#22](/bitcoin-bitcoin/22/): 0x00007fffe7358235 libdyld.dylib`start + 1
44 thread [#2](/bitcoin-bitcoin/2/)
45 frame [#0](/bitcoin-bitcoin/0/): 0x00007fffe748744e libsystem_kernel.dylib`__workq_kernreturn + 10
46 frame [#1](/bitcoin-bitcoin/1/): 0x00007fffe7571621 libsystem_pthread.dylib`_pthread_wqthread + 1426
47 frame [#2](/bitcoin-bitcoin/2/): 0x00007fffe757107d libsystem_pthread.dylib`start_wqthread + 13
48 thread [#3](/bitcoin-bitcoin/3/)
49 frame [#0](/bitcoin-bitcoin/0/): 0x00007fffe748744e libsystem_kernel.dylib`__workq_kernreturn + 10
50 frame [#1](/bitcoin-bitcoin/1/): 0x00007fffe7571621 libsystem_pthread.dylib`_pthread_wqthread + 1426
51 frame [#2](/bitcoin-bitcoin/2/): 0x00007fffe757107d libsystem_pthread.dylib`start_wqthread + 13
52 thread [#4](/bitcoin-bitcoin/4/)
53 frame [#0](/bitcoin-bitcoin/0/): 0x00007fffe748744e libsystem_kernel.dylib`__workq_kernreturn + 10
54 frame [#1](/bitcoin-bitcoin/1/): 0x00007fffe757148e libsystem_pthread.dylib`_pthread_wqthread + 1023
55 frame [#2](/bitcoin-bitcoin/2/): 0x00007fffe757107d libsystem_pthread.dylib`start_wqthread + 13
56 thread [#5](/bitcoin-bitcoin/5/), name = 'QThread'
57 frame [#0](/bitcoin-bitcoin/0/): 0x00007fffe7486bf2 libsystem_kernel.dylib`__psynch_cvwait + 10
58 frame [#1](/bitcoin-bitcoin/1/): 0x00007fffe75727fa libsystem_pthread.dylib`_pthread_cond_wait + 712
59 frame [#2](/bitcoin-bitcoin/2/): 0x0000000107831c06 QtCore`___lldb_unnamed_symbol320$$QtCore + 294
60 frame [#3](/bitcoin-bitcoin/3/): 0x000000010783195b QtCore`___lldb_unnamed_symbol319$$QtCore + 43
61 frame [#4](/bitcoin-bitcoin/4/): 0x000000010783190c QtCore`QWaitCondition::wait(QMutex*, unsigned long) + 156
62 frame [#5](/bitcoin-bitcoin/5/): 0x0000000107da6566 QtTest`___lldb_unnamed_symbol34$$QtTest + 70
63 frame [#6](/bitcoin-bitcoin/6/): 0x00000001078303cc QtCore`___lldb_unnamed_symbol310$$QtCore + 364
64 frame [#7](/bitcoin-bitcoin/7/): 0x00007fffe757193b libsystem_pthread.dylib`_pthread_body + 180
65 frame [#8](/bitcoin-bitcoin/8/): 0x00007fffe7571887 libsystem_pthread.dylib`_pthread_start + 286
66 frame [#9](/bitcoin-bitcoin/9/): 0x00007fffe757108d libsystem_pthread.dylib`thread_start + 13
67 thread [#6](/bitcoin-bitcoin/6/)
68 frame [#0](/bitcoin-bitcoin/0/): 0x00007fffe748744e libsystem_kernel.dylib`__workq_kernreturn + 10
69 frame [#1](/bitcoin-bitcoin/1/): 0x00007fffe7571621 libsystem_pthread.dylib`_pthread_wqthread + 1426
70 frame [#2](/bitcoin-bitcoin/2/): 0x00007fffe757107d libsystem_pthread.dylib`start_wqthread + 13
71 thread [#7](/bitcoin-bitcoin/7/)
72 frame [#0](/bitcoin-bitcoin/0/): 0x00007fffe748744e libsystem_kernel.dylib`__workq_kernreturn + 10
73 frame [#1](/bitcoin-bitcoin/1/): 0x00007fffe7571621 libsystem_pthread.dylib`_pthread_wqthread + 1426
74 frame [#2](/bitcoin-bitcoin/2/): 0x00007fffe757107d libsystem_pthread.dylib`start_wqthread + 13
75(lldb) quit
76========= End of stack trace ==============
77QFATAL : AppTests::appTests() Received signal 11
78 Function time: 143ms Total time: 144ms
79FAIL! : AppTests::appTests() Received a fatal error.
80 Loc: [Unknown file(0)]
81Totals: 1 passed, 1 failed, 0 skipped, 0 blacklisted, 4580ms
82********* Finished testing of AppTests *********
83Abort trap: 6
Just ran this locally (on top of master) and got the error blow (while master passes):
I don’t have easy access to a mac, but it looks like this could be caused by the following Qt bug: https://bugreports.qt.io/browse/QTBUG-49686
Issue described there is failing to check for d->createPlatformMenu()
null return value before calling SetDockMenuFunction
here: http://code.qt.io/cgit/qt/qtbase.git/tree/src/widgets/widgets/qmenu_mac.mm?h=5.10#n109
Will look more for a workaround.
@jonasschnelli, added commit a6f6182fb02c38a13982e3edcd03db3da316f1b3 to try to address mac qt test crash. Do you think you could test it?
Rebased b67d524b69350e131dd102ef716cc095130e72d7 -> 328eb8610d123bf748f829a4db9fc4214e5d5606 (pr/apptest.6 -> pr/apptest.7) due to conflict with #12266 (thread_group / CScheduler removal) Added 1 commits 412fb2d06fc3a0e2337caa07ca158089be6abffe -> a6f6182fb02c38a13982e3edcd03db3da316f1b3 (pr/apptest.7 -> pr/apptest.8, compare) Rebased a6f6182fb02c38a13982e3edcd03db3da316f1b3 -> 4aeec0ebccb4d55800e1f2271f1af15dae4d7eca (pr/apptest.8 -> pr/apptest.9) due to conflict with new commit and #10498.
make check
on MacOS 10.13.3 fails. More specifically:
0iMac:bitcoin bitcoin$ src/qt/test/test_bitcoin-qt
1********* Start testing of AppTests *********
2Config: Using QtTest library 5.10.0, Qt 5.10.0 (x86_64-little_endian-lp64 shared (dynamic) release build; by Clang 9.0.0 (clang-900.0.39.2) (Apple))
3PASS : AppTests::initTestCase()
4QWARN : AppTests::appTests() Backing up GUI settings to "/var/folders/lv/01bvgc7x1fz03w1t8v7g7mrw0000gp/T/test_bitcoin-qt_1518462364_49176/regtest/guisettings.ini.bak"
5QWARN : AppTests::appTests() QFont::setPointSizeF: Point size <= 0 (-1.000000), must be greater than 0
6QWARN : AppTests::appTests() QFont::setPointSizeF: Point size <= 0 (-1.000000), must be greater than 0
7QWARN : AppTests::appTests() QFont::setPointSizeF: Point size <= 0 (-1.000000), must be greater than 0
8QWARN : AppTests::appTests() QFont::setPointSizeF: Point size <= 0 (-1.000000), must be greater than 0
9QWARN : AppTests::appTests() QFont::setPointSizeF: Point size <= 0 (-1.000000), must be greater than 0
10QWARN : AppTests::appTests() QFont::setPointSizeF: Point size <= 0 (-1.000000), must be greater than 0
11QWARN : AppTests::appTests() QFont::setPointSizeF: Point size <= 0 (-1.000000), must be greater than 0
12QWARN : AppTests::appTests() QFont::setPointSizeF: Point size <= 0 (-1.000000), must be greater than 0
13QWARN : AppTests::appTests() QFont::setPointSizeF: Point size <= 0 (-1.000000), must be greater than 0
14QWARN : AppTests::appTests() QFont::setPointSizeF: Point size <= 0 (-1.000000), must be greater than 0
15QWARN : AppTests::appTests() QFont::setPointSizeF: Point size <= 0 (-1.000000), must be greater than 0
16QDEBUG : AppTests::appTests() requestInitialize : Requesting initialize
17QDEBUG : AppTests::appTests() initialize : Running initialization in thread
18QDEBUG : AppTests::appTests() initializeResult : Initialization result: true
19QWARN : AppTests::appTests() Platform customization: "macosx"
20QDEBUG : AppTests::appTests() "ReportInvalidCertificate: Payment server found an invalid certificate: " "0d:5e:99:0a:d6:9d:b7:78:ec:d8:07:56:3b:86:15:d9" ("DST ACES CA X6") () ("DST ACES")
21QDEBUG : AppTests::appTests() "ReportInvalidCertificate: Payment server found an invalid certificate: " "01" ("Izenpe.com") () ()
22QDEBUG : AppTests::appTests() "ReportInvalidCertificate: Payment server found an invalid certificate: " "11" ("TÜBİTAK UEKAE Kök Sertifika Hizmet Sağlayıcısı - Sürüm 3") () ("Kamu Sertifikasyon Merkezi", "Ulusal Elektronik ve Kriptoloji Araştırma Enstitüsü - UEKAE")
23QDEBUG : AppTests::appTests() "ReportInvalidCertificate: Payment server found an invalid certificate: " "01" ("TÜRKTRUST Elektronik Sertifika Hizmet Sağlayıcısı") () ()
24QWARN : AppTests::appTests() PaymentServer::LoadRootCAs: Loaded 173 root certificates
25QFATAL : AppTests::appTests() Received signal 11
26 Function time: 2345ms Total time: 2346ms
27FAIL! : AppTests::appTests() Received a fatal error.
28 Loc: [Unknown file(0)]
29Totals: 1 passed, 1 failed, 0 skipped, 0 blacklisted, 2346ms
30********* Finished testing of AppTests *********
31Abort trap: 6
That test does pass on master (5dc00f68).
QFATAL : AppTests::appTests() Received signal 11
Would be useful to have a stack trace to debug further. Any chance you could run the test under gdb?
I’m not really familiar with how to use gdb
… So far I was able to produce this:
0gdb src/qt/test/test_bitcoin-qt
1GNU gdb (GDB) 8.1
2This GDB was configured as "x86_64-apple-darwin17.3.0".
3Reading symbols from src/qt/test/test_bitcoin-qt...
4warning: can't find symbol '_Z10ParseHexUVRK8UniValueRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE' in minsymtab
5
6warning: can't find symbol '_Z11qMetaTypeIdIPbEiv' in minsymtab
7
8warning: can't find symbol '_Z17qRegisterMetaTypeINSt3__18functionIFvvEEEEiPKcPT_N9QtPrivate21MetaTypeDefinedHelperIS6_Xaasr12QMetaTypeId2IS6_EE7Definedntsr12QMetaTypeId2IS6_EE9IsBuiltInEE11DefinedTypeE' in minsymtab
9
10warning: can't find symbol '_Z17qRegisterMetaTypeIPbEiPKcPT_N9QtPrivate21MetaTypeDefinedHelperIS3_Xaasr12QMetaTypeId2IS3_EE7Definedntsr12QMetaTypeId2IS3_EE9IsBuiltInEE11DefinedTypeE' in minsymtab
11
12warning: can't find symbol '_Z17qRegisterMetaTypeIPbEiv' in minsymtab
13
14warning: can't find symbol '_Z17qRegisterMetaTypeIxEiPKcPT_N9QtPrivate21MetaTypeDefinedHelperIS2_Xaasr12QMetaTypeId2IS2_EE7Definedntsr12QMetaTypeId2IS2_EE9IsBuiltInEE11DefinedTypeE' in minsymtab
15
16warning: can't find symbol '_Z19DebugMessageHandler9QtMsgTypeRK18QMessageLogContextRK7QString' in minsymtab
17
18warning: can't find symbol '_ZTSFNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEPKcE' in minsymtab
19
20warning: can't find symbol '_ZN16FreespaceChecker16staticMetaObjectE' in minsymtab
21
22warning: can't find symbol '_ZTI16FreespaceChecker' in minsymtab
23
24warning: can't find symbol '_ZTS16FreespaceChecker' in minsymtab
25
26warning: can't find symbol '_ZTV16FreespaceChecker' in minsymtab
27
28warning: can't find symbol '_ZN15TransactionDesc11qt_metacallEN11QMetaObject4CallEiPPv' in minsymtab
29
30warning: can't find symbol '_ZN15TransactionDesc11qt_metacastEPKc' in minsymtab
31done.
32(gdb) run
33Starting program: [...]/src/qt/test/test_bitcoin-qt
34[New Thread 0x2803 of process 58382]
35[New Thread 0x1a03 of process 58382]
36During startup program terminated with signal SIGTRAP, Trace/breakpoint trap.
37(gdb)
lldb
output might be more useful:
0lldb src/qt/test/test_bitcoin-qt
1(lldb) target create "src/qt/test/test_bitcoin-qt"
2Current executable set to 'src/qt/test/test_bitcoin-qt' (x86_64).
3(lldb) run
4Process 58456 launched: '[...]/src/qt/test/test_bitcoin-qt' (x86_64)
5********* Start testing of AppTests *********
6Config: Using QtTest library 5.10.0, Qt 5.10.0 (x86_64-little_endian-lp64 shared (dynamic) release build; by Clang 9.0.0 (clang-900.0.39.2) (Apple))
7PASS : AppTests::initTestCase()
8QWARN : AppTests::appTests() Backing up GUI settings to "/var/folders/lv/01bvgc7x1fz03w1t8v7g7mrw0000gp/T/test_bitcoin-qt_1518467512_26673/regtest/guisettings.ini.bak"
9QWARN : AppTests::appTests() QFont::setPointSizeF: Point size <= 0 (-1.000000), must be greater than 0
10QWARN : AppTests::appTests() QFont::setPointSizeF: Point size <= 0 (-1.000000), must be greater than 0
11QWARN : AppTests::appTests() QFont::setPointSizeF: Point size <= 0 (-1.000000), must be greater than 0
12QWARN : AppTests::appTests() QFont::setPointSizeF: Point size <= 0 (-1.000000), must be greater than 0
13QWARN : AppTests::appTests() QFont::setPointSizeF: Point size <= 0 (-1.000000), must be greater than 0
14QWARN : AppTests::appTests() QFont::setPointSizeF: Point size <= 0 (-1.000000), must be greater than 0
15QWARN : AppTests::appTests() QFont::setPointSizeF: Point size <= 0 (-1.000000), must be greater than 0
16QWARN : AppTests::appTests() QFont::setPointSizeF: Point size <= 0 (-1.000000), must be greater than 0
17QWARN : AppTests::appTests() QFont::setPointSizeF: Point size <= 0 (-1.000000), must be greater than 0
18QWARN : AppTests::appTests() QFont::setPointSizeF: Point size <= 0 (-1.000000), must be greater than 0
19QWARN : AppTests::appTests() QFont::setPointSizeF: Point size <= 0 (-1.000000), must be greater than 0
20QDEBUG : AppTests::appTests() requestInitialize : Requesting initialize
21QDEBUG : AppTests::appTests() initialize : Running initialization in thread
22QDEBUG : AppTests::appTests() initializeResult : Initialization result: true
23QWARN : AppTests::appTests() Platform customization: "macosx"
24QDEBUG : AppTests::appTests() "ReportInvalidCertificate: Payment server found an invalid certificate: " "0d:5e:99:0a:d6:9d:b7:78:ec:d8:07:56:3b:86:15:d9" ("DST ACES CA X6") () ("DST ACES")
25QDEBUG : AppTests::appTests() "ReportInvalidCertificate: Payment server found an invalid certificate: " "01" ("Izenpe.com") () ()
26QDEBUG : AppTests::appTests() "ReportInvalidCertificate: Payment server found an invalid certificate: " "11" ("TÜBİTAK UEKAE Kök Sertifika Hizmet Sağlayıcısı - Sürüm 3") () ("Kamu Sertifikasyon Merkezi", "Ulusal Elektronik ve Kriptoloji Araştırma Enstitüsü - UEKAE")
27QDEBUG : AppTests::appTests() "ReportInvalidCertificate: Payment server found an invalid certificate: " "01" ("TÜRKTRUST Elektronik Sertifika Hizmet Sağlayıcısı") () ()
28QWARN : AppTests::appTests() PaymentServer::LoadRootCAs: Loaded 173 root certificates
29Process 58456 stopped
30* thread [#1](/bitcoin-bitcoin/1/), queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x8)
31 frame [#0](/bitcoin-bitcoin/0/): 0x0000000102e92c61 QtWidgets`QWidget::insertAction(QAction*, QAction*) + 33
32QtWidgets`QWidget::insertAction:
33-> 0x102e92c61 <+33>: movq 0x8(%r14), %r12
34 0x102e92c65 <+37>: movq 0x1a0(%r12), %rax
35 0x102e92c6d <+45>: addq $0x1a0, %r12 ; imm = 0x1A0
36 0x102e92c74 <+52>: movl 0x8(%rax), %edx
37Target 0: (test_bitcoin-qt) stopped.
0(lldb) bt
1* thread [#1](/bitcoin-bitcoin/1/), queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x8)
2 * frame [#0](/bitcoin-bitcoin/0/): 0x0000000102e92c61 QtWidgets`QWidget::insertAction(QAction*, QAction*) + 33
3 frame [#1](/bitcoin-bitcoin/1/): 0x00000001000bdb84 test_bitcoin-qt`BitcoinGUI::createTrayIconMenu(this=0x00000001042125e0) at bitcoingui.cpp:614
4 frame [#2](/bitcoin-bitcoin/2/): 0x00000001000bd665 test_bitcoin-qt`BitcoinGUI::setClientModel(this=0x00000001042125e0, _clientModel=0x000000010dfb4c30) at bitcoingui.cpp:480
5 frame [#3](/bitcoin-bitcoin/3/): 0x00000001000b2531 test_bitcoin-qt`BitcoinApplication::initializeResult(this=0x00007ffeefbff8f8, success=true) at bitcoin.cpp:389
6 frame [#4](/bitcoin-bitcoin/4/): 0x0000000100243a39 test_bitcoin-qt`BitcoinApplication::qt_static_metacall(_o=0x00007ffeefbff8f8, _c=InvokeMetaMethod, _id=5, _a=0x000000010dd938c0) at moc_bitcoin.cpp:266
7 frame [#5](/bitcoin-bitcoin/5/): 0x0000000102957401 QtCore`QObject::event(QEvent*) + 769
8 frame [#6](/bitcoin-bitcoin/6/): 0x000000010340d70b QtGui`QGuiApplication::event(QEvent*) + 267
9 frame [#7](/bitcoin-bitcoin/7/): 0x0000000102e63b33 QtWidgets`QApplication::event(QEvent*) + 883
10 frame [#8](/bitcoin-bitcoin/8/): 0x0000000102e653bd QtWidgets`QApplicationPrivate::notify_helper(QObject*, QEvent*) + 269
11 frame [#9](/bitcoin-bitcoin/9/): 0x0000000102e6675a QtWidgets`QApplication::notify(QObject*, QEvent*) + 362
12 frame [#10](/bitcoin-bitcoin/10/): 0x000000010292e1f8 QtCore`QCoreApplication::notifyInternal2(QObject*, QEvent*) + 168
13 frame [#11](/bitcoin-bitcoin/11/): 0x000000010292f388 QtCore`QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) + 840
14 frame [#12](/bitcoin-bitcoin/12/): 0x0000000102982b08 QtCore`QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 72
15 frame [#13](/bitcoin-bitcoin/13/): 0x000000010448659e libqminimal.dylib`___lldb_unnamed_symbol47$$libqminimal.dylib + 14
16 frame [#14](/bitcoin-bitcoin/14/): 0x0000000102929dae QtCore`QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 398
17 frame [#15](/bitcoin-bitcoin/15/): 0x000000010292e8f1 QtCore`QCoreApplication::exec() + 369
18 frame [#16](/bitcoin-bitcoin/16/): 0x000000010000942a test_bitcoin-qt`AppTests::appTests(this=0x00007ffeefbff8c0) at apptests.cpp:63
19 frame [#17](/bitcoin-bitcoin/17/): 0x00000001000a9b2a test_bitcoin-qt`AppTests::qt_static_metacall(_o=0x00007ffeefbff8c0, _c=InvokeMetaMethod, _id=0, _a=0x00007ffeefbfed90) at moc_apptests.cpp:81
20 frame [#18](/bitcoin-bitcoin/18/): 0x000000010293819c QtCore`QMetaMethod::invoke(QObject*, Qt::ConnectionType, QGenericReturnArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument) const + 1308
21 frame [#19](/bitcoin-bitcoin/19/): 0x0000000102cd8e01 QtTest`___lldb_unnamed_symbol11$$QtTest + 1169
22 frame [#20](/bitcoin-bitcoin/20/): 0x0000000102cd9ac9 QtTest`___lldb_unnamed_symbol13$$QtTest + 777
23 frame [#21](/bitcoin-bitcoin/21/): 0x0000000102cda9d7 QtTest`___lldb_unnamed_symbol17$$QtTest + 1031
24 frame [#22](/bitcoin-bitcoin/22/): 0x0000000102cdb557 QtTest`QTest::qRun() + 247
25 frame [#23](/bitcoin-bitcoin/23/): 0x0000000102cdb1b0 QtTest`QTest::qExec(QObject*, int, char**) + 16
26 frame [#24](/bitcoin-bitcoin/24/): 0x00000001000222d6 test_bitcoin-qt`main(argc=1, argv=0x00007ffeefbffa18) at test_main.cpp:82
27 frame [#25](/bitcoin-bitcoin/25/): 0x00007fff798b8115 libdyld.dylib`start + 1
28 frame [#26](/bitcoin-bitcoin/26/): 0x00007fff798b8115 libdyld.dylib`start + 1
@theuni this is the issue I was referring to.
Looking at the stack trace: #11625 (comment) it doesn’t immediately make sense to me because BitcoinGUI::createTrayIconMenu does not appear to be directly calling QWidget::insertAction. Also, I’d be curious if the issue might be fixed by extending the workaround in a6f6182fb02c38a13982e3edcd03db3da316f1b3 to avoid the trayIconMenu->addAction
calls in BitcoinGUI::createTrayIconMenu()
when MacDockIconHandler::instance()
returns null.
Same crash here. Here’s a backtrace of relevant threads with a few things commented out as requested:
0* thread [#1](/bitcoin-bitcoin/1/): tid = 0x36e12a, 0x00000001018deaf5 QtWidgets`QToolBar::event(QEvent*) + 501, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
1 frame [#0](/bitcoin-bitcoin/0/): 0x00000001018deaf5 QtWidgets`QToolBar::event(QEvent*) + 501
2QtWidgets`QToolBar::event:
3-> 0x1018deaf5 <+501>: movq (%rbx), %rax
4 0x1018deaf8 <+504>: movq 0x88(%rax), %r15
5 0x1018deaff <+511>: leaq 0x2946d9(%rip), %rsi ; "setContentBorderAreaEnabled"
6 0x1018deb06 <+518>: leaq -0x90(%rbp), %r13
7
8* thread [#1](/bitcoin-bitcoin/1/): tid = 0x36e12a, 0x00000001018deaf5 QtWidgets`QToolBar::event(QEvent*) + 501, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
9 frame [#0](/bitcoin-bitcoin/0/): 0x00000001018deaf5 QtWidgets`QToolBar::event(QEvent*) + 501
10 frame [#1](/bitcoin-bitcoin/1/): 0x000000010173697b QtWidgets`QApplicationPrivate::notify_helper(QObject*, QEvent*) + 251
11 frame [#2](/bitcoin-bitcoin/2/): 0x00000001017392de QtWidgets`QApplication::notify(QObject*, QEvent*) + 5630
12 frame [#3](/bitcoin-bitcoin/3/): 0x00000001011774f3 QtCore`QCoreApplication::notifyInternal(QObject*, QEvent*) + 115
13 frame [#4](/bitcoin-bitcoin/4/): 0x00000001017736e7 QtWidgets`QWidgetPrivate::show_helper() + 423
14 * frame [#5](/bitcoin-bitcoin/5/): 0x000000010177416c QtWidgets`QWidget::setVisible(bool) + 956
15 frame [#6](/bitcoin-bitcoin/6/): 0x00000001017738e0 QtWidgets`QWidgetPrivate::showChildren(bool) + 304
16 frame [#7](/bitcoin-bitcoin/7/): 0x000000010177358c QtWidgets`QWidgetPrivate::show_helper() + 76
17 frame [#8](/bitcoin-bitcoin/8/): 0x000000010177416c QtWidgets`QWidget::setVisible(bool) + 956
18 frame [#9](/bitcoin-bitcoin/9/): 0x0000000100038960 test_bitcoin-qt`BitcoinApplication::initializeResult(this=0x00007fff5fbff870, success=<unavailable>) + 1008 at bitcoin.cpp:412
19 frame [#10](/bitcoin-bitcoin/10/): 0x00000001011a018c QtCore`QObject::event(QEvent*) + 156
20 frame [#11](/bitcoin-bitcoin/11/): 0x0000000101178d46 QtCore`QCoreApplication::event(QEvent*) + 102
21 frame [#12](/bitcoin-bitcoin/12/): 0x0000000101df5ece QtGui`QGuiApplication::event(QEvent*) + 270
22 frame [#13](/bitcoin-bitcoin/13/): 0x0000000101735182 QtWidgets`QApplication::event(QEvent*) + 1122
23 frame [#14](/bitcoin-bitcoin/14/): 0x000000010173697b QtWidgets`QApplicationPrivate::notify_helper(QObject*, QEvent*) + 251
24 frame [#15](/bitcoin-bitcoin/15/): 0x00000001017392de QtWidgets`QApplication::notify(QObject*, QEvent*) + 5630
25 frame [#16](/bitcoin-bitcoin/16/): 0x0000000101178212 QtCore`QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) + 1058
26 frame [#17](/bitcoin-bitcoin/17/): 0x00000001011c77db QtCore`QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 59
27 frame [#18](/bitcoin-bitcoin/18/): 0x0000000105063e5e libqminimal.dylib`QUnixEventDispatcherQPA::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 14
28 frame [#19](/bitcoin-bitcoin/19/): 0x0000000101174c1c QtCore`QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 412
29 frame [#20](/bitcoin-bitcoin/20/): 0x0000000101177a95 QtCore`QCoreApplication::exec() + 341
30 frame [#21](/bitcoin-bitcoin/21/): 0x0000000100008708 test_bitcoin-qt`AppTests::appTests(this=<unavailable>) + 360 at apptests.cpp:63
31 frame [#22](/bitcoin-bitcoin/22/): 0x00000001011810b4 QtCore`QMetaMethod::invoke(QObject*, Qt::ConnectionType, QGenericReturnArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument) const + 1364
32 frame [#23](/bitcoin-bitcoin/23/): 0x00000001011805a7 QtCore`QMetaObject::invokeMethod(QObject*, char const*, Qt::ConnectionType, QGenericReturnArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument) + 2199
33 frame [#24](/bitcoin-bitcoin/24/): 0x0000000100f60124 QtTest`QTest::qInvokeTestMethod(char const*, char const*) + 1444
34 frame [#25](/bitcoin-bitcoin/25/): 0x0000000100f5b5e0 QtTest`QTest::qExec(QObject*, int, char**) + 1328
35 frame [#26](/bitcoin-bitcoin/26/): 0x00000001000110ff test_bitcoin-qt`main(argc=<unavailable>, argv=<unavailable>) + 575 at test_main.cpp:82
36 frame [#27](/bitcoin-bitcoin/27/): 0x00007fff8e98b5ad libdyld.dylib`start + 1
37 frame [#28](/bitcoin-bitcoin/28/): 0x00007fff8e98b5ad libdyld.dylib`start + 1
38
39 thread [#7](/bitcoin-bitcoin/7/): tid = 0x36e172, 0x00007fff9315607a libsystem_kernel.dylib`__select + 10, name = 'QThread'
40 frame [#0](/bitcoin-bitcoin/0/): 0x00007fff9315607a libsystem_kernel.dylib`__select + 10
41 frame [#1](/bitcoin-bitcoin/1/): 0x00000001011c57a3 QtCore`qt_safe_select(int, fd_set*, fd_set*, fd_set*, timespec const*) + 547
42 frame [#2](/bitcoin-bitcoin/2/): 0x00000001011c66b5 QtCore`QEventDispatcherUNIXPrivate::doSelect(QFlags<QEventLoop::ProcessEventsFlag>, timespec*) + 693
43 frame [#3](/bitcoin-bitcoin/3/): 0x00000001011c788a QtCore`QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 234
44 frame [#4](/bitcoin-bitcoin/4/): 0x0000000101174c1c QtCore`QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 412
45 frame [#5](/bitcoin-bitcoin/5/): 0x0000000100fca07e QtCore`QThread::exec() + 110
46 frame [#6](/bitcoin-bitcoin/6/): 0x0000000100fcdc02 QtCore`QThreadPrivate::start(void*) + 338
47 frame [#7](/bitcoin-bitcoin/7/): 0x00007fff9721299d libsystem_pthread.dylib`_pthread_body + 131
48 frame [#8](/bitcoin-bitcoin/8/): 0x00007fff9721291a libsystem_pthread.dylib`_pthread_start + 168
49 frame [#9](/bitcoin-bitcoin/9/): 0x00007fff97210351 libsystem_pthread.dylib`thread_start + 13
Cory found you could get around the last crash by -passing the -min
option to avoid showing the main window and triggering the broken window border code (setContentBorderAreaEnabled
) that runs when the minimal platform is selected on mac:
But there is similar crash soon after when the test tries to open the debug window:
Cory also found the test works if you set the QT_QPA_PLATFORM environment variable to cocoa.
I’m going to see if it’s possible to make a small change that would try to show both windows minimized and avoid the crashes.
I’m going to see if it’s possible to make a small change that would try to show both windows minimized and avoid the crashes.
Replacing the showNormal
and show
calls with showMinimized
apparently resulted in another segfault on Cory’s machine. I’d be curious to see the stack trace, but it seems easier right now to just skip the test on the mac minimal platform (while continuing to run it on linux and windows minimal platforms and the mac cocoa platform).
Added 2 commits 4aeec0ebccb4d55800e1f2271f1af15dae4d7eca -> f955ab2f2e419e865a7fb41dc109d8aae2356f3a (pr/apptest.9 -> pr/apptest.10, compare) Squashed f955ab2f2e419e865a7fb41dc109d8aae2356f3a -> 452367f0a46d6ea61746819680faebd8a6456633 (pr/apptest.10 -> pr/apptest.11)
That made make unhappy. @Sjors thanks for testing! Added a new commit which should help.
Added 1 commits 452367f0a46d6ea61746819680faebd8a6456633 -> f5ef4a12b5d7467f17145663e3ad9ab45517ce58 (pr/apptest.11 -> pr/apptest.12, compare) Squashed f5ef4a12b5d7467f17145663e3ad9ab45517ce58 -> f4b25d498233cf2a894fa27616d65f56b99af390 (pr/apptest.12 -> pr/apptest.13)
make is happy now, but qt/test/test_bitcoin-qt fails: test-suite.log
Wow, the problems this test is causing on the Qt mac minimal platform seem to be endless. Now even though the new test is being skipped, the startup tweaks I made to support it are causing an old test to fail with a UniValue exception. I think I’m going mark this PR work in progress and wait until I have a mac handy to debug locally, instead of trying to debug more remotely now. I think next step will be to try to catch the UniValue exception and print it.
What exactly does “Qt mac minimal platform” mean?
It means running with QT_QPA_PLATFORM=minimal on a mac Qt build. A lot of Qt bugs seem to get triggered if you try this. Running with QT_QPA_PLATFORM=minimal with a linux or windows qt build works fine. Running with QT_QPA_PLATFORM=cocoa on with a mac Qt build also seems to work fine (according to Cory).
Our Qt unit tests run by default with QT_QPA_PLATFORM=minimal so the tests can run on headless machines, and to avoid windows and widgets popping up onscreen during the test on machines with displays. You can change this by using the -platform
command line option as described here:
QT_QPA_PLATFORM=minimal
?
Thanks. Just to clarify further, do we know any use case other than running tests that requires QT support with QT_QPA_PLATFORM=minimal?
I don’t think so. Conceivably somebody could choose to run bitcoin-qt
with QT_QPA_PLATFORM=minimal
instead of running bitcoind
, in order to run be able to run a bitcoin node headlessly and still have access coin selection or some other feature that only exists in the GUI. But I doubt anybody would actually do this, and in any case, the bugs in Qt minimal platform on mac are in Qt code not our code, so if somebody wanted to get this working on mac, they would need to take any issues up with Qt project rather than ours.
Sadly make
fails for me on macOS 10.13.3:
0make clean
1./autogen.sh
2./configure --disable-bench --with-miniupnpc=no --with-incompatible-bdb --with-qrencode
3make -j5
4
5...
6
7 CXXLD test/test_bitcoin_fuzzy
8qt/test/apptests.cpp:80:7: error: no member named 'bitdb' in the global namespace
9 ::bitdb.Close();
10 ~~^
75+ m_app.exec();
76+
77+ // Reset some global state to avoid interfering with later tests.
78+ ResetShutdownRequested();
79+#ifdef ENABLE_WALLET
80+ ::bitdb.Close();
bitdb
be used directly? See https://github.com/bitcoin/bitcoin/pull/9951/commits/be9e1a968debbb7ede8ed50e9288a62ff15d1e1e
Should bitdb be used directly? See be9e1a9
Probably these calls should just be dropped. I had to make similar changes to wallettests.cpp in #11687 (which was merged since the PR was opened): https://github.com/bitcoin/bitcoin/pull/11687/commits/d8a99f65e53019becdd8d2631396012bafb29741#diff-6fcb1829ce66ad65046d6896dbcc910b
make
is happy (but tests still fail, see below).
If I remove the two ::bitdb
lines I can compile, but tests still fail. Trace (using --enable-debug
):
0********* Start testing of RPCNestedTests *********
1Config: Using QtTest library 5.10.0, Qt 5.10.0 (x86_64-little_endian-lp64 shared (dynamic) release build; by Clang 9.0.0 (clang-900.0.39.2) (Apple))
2PASS : RPCNestedTests::initTestCase()
3FAIL! : RPCNestedTests::rpcNestedTests() Caught unhandled exception
4 Loc: [qtestcase.cpp(1836)]
5Totals: 1 passed, 1 failed, 0 skipped, 0 blacklisted, 49ms
6********* Finished testing of RPCNestedTests *********
7libc++abi.dylib: terminating with uncaught exception of type UniValue
8Process 99582 stopped
9* thread [#1](/bitcoin-bitcoin/1/), queue = 'com.apple.main-thread', stop reason = signal SIGABRT
10 frame [#0](/bitcoin-bitcoin/0/): 0x00007fff58a7fe3e libsystem_kernel.dylib`__pthread_kill + 10
11libsystem_kernel.dylib`__pthread_kill:
12-> 0x7fff58a7fe3e <+10>: jae 0x7fff58a7fe48 ; <+20>
13 0x7fff58a7fe40 <+12>: movq %rax, %rdi
14 0x7fff58a7fe43 <+15>: jmp 0x7fff58a770b8 ; cerror_nocancel
15 0x7fff58a7fe48 <+20>: retq
16Target 0: (test_bitcoin-qt) stopped.
0(lldb) bt
1* thread [#1](/bitcoin-bitcoin/1/), queue = 'com.apple.main-thread', stop reason = signal SIGABRT
2 * frame [#0](/bitcoin-bitcoin/0/): 0x00007fff58a7fe3e libsystem_kernel.dylib`__pthread_kill + 10
3 frame [#1](/bitcoin-bitcoin/1/): 0x00007fff58bbe150 libsystem_pthread.dylib`pthread_kill + 333
4 frame [#2](/bitcoin-bitcoin/2/): 0x00007fff589dc312 libsystem_c.dylib`abort + 127
5 frame [#3](/bitcoin-bitcoin/3/): 0x00007fff569b7f8f libc++abi.dylib`abort_message + 245
6 frame [#4](/bitcoin-bitcoin/4/): 0x00007fff569b812b libc++abi.dylib`default_terminate_handler() + 265
7 frame [#5](/bitcoin-bitcoin/5/): 0x00007fff57d42eab libobjc.A.dylib`_objc_terminate() + 105
8 frame [#6](/bitcoin-bitcoin/6/): 0x00007fff569d37c9 libc++abi.dylib`std::__terminate(void (*)()) + 8
9 frame [#7](/bitcoin-bitcoin/7/): 0x00007fff569d3478 libc++abi.dylib`__cxa_rethrow + 99
10 frame [#8](/bitcoin-bitcoin/8/): 0x00000001016d2b1a QtTest`QTest::qRun() + 1722
11 frame [#9](/bitcoin-bitcoin/9/): 0x00000001016d21b0 QtTest`QTest::qExec(QObject*, int, char**) + 16
12 frame [#10](/bitcoin-bitcoin/10/): 0x0000000100011978 test_bitcoin-qt`main(argc=<unavailable>, argv=<unavailable>) at test_main.cpp:96 [opt]
13 frame [#11](/bitcoin-bitcoin/11/): 0x00007fff58930115 libdyld.dylib`start + 1
This is the same UniValue exception that was happening before: #11625 (comment). Next step for debugging should probably be to catch the exception and print it.
This PR is marked work in progress because the UniValue error only happens on macs and I don’t currently have one to test with, but I was going to revisit this at some point (and would welcome any help debugging before then).
Rebased bdc576f0720efa7fb389657719bd1ad2bc91ff1a -> 469134517a9dbea0491ac6448b0cd6044982e792 (pr/apptest.16 -> pr/apptest.17) due to conflict with #10244 Rebased 469134517a9dbea0491ac6448b0cd6044982e792 -> b3c4b6a5a4c89072d4cd044b6fad757c26aa9053 (pr/apptest.17 -> pr/apptest.18) due to conflict with #12906 Rebased b3c4b6a5a4c89072d4cd044b6fad757c26aa9053 -> c807f8f2273469eb71afa4d4c3548d96169c6b95 (pr/apptest.18 -> pr/apptest.19) due to conflict with #12830 Rebased c807f8f2273469eb71afa4d4c3548d96169c6b95 -> 3f5802c4a4ae37351f88001ff5c53d71099d2ccd (pr/apptest.19 -> pr/apptest.20) due to conflict with #13097 Rebased 3f5802c4a4ae37351f88001ff5c53d71099d2ccd -> 5e10f0b69f03f49503c82dfcfc39c6d89b1076e2 (pr/apptest.20 -> pr/apptest.21) due to conflict with #13112 Updated 5e10f0b69f03f49503c82dfcfc39c6d89b1076e2 -> d764545fa6bcddf5b5aa97f503d61d4cd570b45b (pr/apptest.21 -> pr/apptest.22) to fix travis failure
Needs rebase
Rebased d764545fa6bcddf5b5aa97f503d61d4cd570b45b -> 48f1dec14469270b1e3ca3f9f6d22341ce7009ee (pr/apptest.22 -> pr/apptest.23) due to conflict with #13111 Updated 48f1dec14469270b1e3ca3f9f6d22341ce7009ee -> 54f9280bb9d6a561b5b358d88281c9cf2d5ff1d0 (pr/apptest.23 -> pr/apptest.24) to fix lint error Rebased 54f9280bb9d6a561b5b358d88281c9cf2d5ff1d0 -> 0f22f1bcff15cb61bf122658854cc540739c8c6a (pr/apptest.24 -> pr/apptest.25) due to conflict with #13235 Rebased 0f22f1bcff15cb61bf122658854cc540739c8c6a -> 9a062963f588913c1bb3ad824aa60c312d68a49e (pr/apptest.25 -> pr/apptest.26) to work around travis using outdated .yml file #13859 (comment)
Updated 9a062963f588913c1bb3ad824aa60c312d68a49e -> bd1028c45d784539f03de07582a33e466cc5c721 (pr/apptest.26 -> pr/apptest.27), fixing some of bugs and finally getting this working on macOS with -platform minimal
and -platform cocoa
options.
Updated bd1028c45d784539f03de07582a33e466cc5c721 -> bbe0cc9ea20975807de69d8a0e9e30d94981280c (pr/apptest.27 -> pr/apptest.28) fixing travis compile error.
Changes:
SetRPCWarmupFinished
call so rpcnestedtests doesn’t throw the UniValue error reported by Sjors (https://github.com/bitcoin/bitcoin/pull/11625#issuecomment-376916368) when apptests are skipped.m_app.exec()
call to return early before shutdown actually completed, and subsequent tests would assert false in ECC_Start
because it was already started.The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
Reviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.
This fails to compile due to
0qt/libbitcoinqt.a(qt_libbitcoinqt_a-bitcoin.o):(.bss+0x0): multiple definition of `G_TRANSLATION_FUN[abi:cxx11]'
multiple definition of `G_TRANSLATION_FUN[abi:cxx11]
This is from #13961 being merged. It’s fixed with the latest rebase.
Updated bbe0cc9ea20975807de69d8a0e9e30d94981280c -> 91f623f3dff697c570d070fddc05265e7555ba9b (pr/apptest.28 -> pr/apptest.29) with whitespace fix Rebased 91f623f3dff697c570d070fddc05265e7555ba9b -> 9f4a8af909379763440b49b3927e0cd1a55e309d (pr/apptest.29 -> pr/apptest.30) to fix silent merge conflicts with #13961 and #13529 Rebased 9f4a8af909379763440b49b3927e0cd1a55e309d -> 1bbfce80c16821b0517db626ffff0d10051a84be (pr/apptest.30 -> pr/apptest.31) after base #14527 merged. Updated 1bbfce80c16821b0517db626ffff0d10051a84be -> 71510b93973b5797c3eaec7ff89ddffb01f74b39 (pr/apptest.31 -> pr/apptest.32) with lint fixes. Rebased 71510b93973b5797c3eaec7ff89ddffb01f74b39 -> cb5a11401afdeb1c14f33fb3d29c36e3e9f488be (pr/apptest.32 -> pr/apptest.33) due to conflict with #14451 Rebased cb5a11401afdeb1c14f33fb3d29c36e3e9f488be -> e6cb33ae9df93aefc659e5301673e60cc4e20447 (pr/apptest.33 -> pr/apptest.34) due to conflict with #14123 Rebased e6cb33ae9df93aefc659e5301673e60cc4e20447 -> 7cca59d8144ba097a9f168e5b16699325ceb32dc (pr/apptest.34 -> pr/apptest.35) due to conflict with #14854 Rebased 7cca59d8144ba097a9f168e5b16699325ceb32dc -> 7e4bd19785ff9120b7242ff9f15231868aaf7db4 (pr/apptest.35 -> pr/apptest.36) due to conflict with #15000
0@@ -0,0 +1,113 @@
1+#include <qt/test/apptests.h>
0@@ -0,0 +1,46 @@
1+#ifndef BITCOIN_QT_TEST_APPTESTS_H
12+
13+class AppTests : public QObject
14+{
15+ Q_OBJECT
16+public:
17+ AppTests(BitcoinApplication& app) : m_app(app) {}
explicit
:-)
Tests pass for me on macOS 10.14.1, with and without --disable-bip70
.
Shouldn’t this be run as part of make check
? Otherwise, maybe add them to Travis in a followup?
Move-only commit, no code changes
Add test coverage for Qt initialization code & basic RPC console functionality.
@ryanofsky: interested to pick this up again?
There was a minor conflict with #15000 last week, but I am maintaining this (and think it probably could be merged).
Tested ACK ca20b65cc04825bb317f1a59d02c77912f6bf097
I don’t ran into problems when running on macOS with QT_QPA_PLATFORM=cocoa
, I can see then GUI window opening and closing.
Did also ran without issues on Ubuntu Bionic with minimal
and xcb
Platform.
@ryanofsky any reasons why – on Ubuntu – I see the window opening/closing during the AddressBookTests but not during the AppTests?
@ryanofsky any reasons why – on Ubuntu – I see the window opening/closing during the AddressBookTests but not during the AppTests?
That would be an unexpected bug. I’m not seeing any windows shown by default with 699d0bd9fe5d39dd078ae4996079af2caf29a4e3 (current master) running qt/test/test_bitcoin-qt
. I do see windows if I set QT_QPA_PLATFORM=xcb
(as expected).
You may want to experiment with unset DISPLAY && src/qt/test/test_bitcoin-qt
. This should pass and not show any windows.