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:
In file included from /usr/include/qt4/QtGui/QLineEdit:1:0,
from qt/test/apptests.cpp:20:
/usr/include/qt4/QtGui/qlineedit.h: In function ‘void {anonymous}::TestRpcCommand(RPCConsole*)’:
/usr/include/qt4/QtGui/qlineedit.h:198:10: error: ‘void QLineEdit::returnPressed()’ is protected
void returnPressed();
^
qt/test/apptests.cpp:34:29: error: within this context
lineEdit->returnPressed();
^
make[2]: *** [qt/test/qt_test_test_bitcoin_qt-apptests.o] Error 1
FAIL: qt/test/test_bitcoin-qt
=============================
********* Start testing of AppTests *********
Config: Using QtTest library 5.7.1, Qt 5.7.1 (x86_64-little_endian-lp64 static release build; by GCC 4.8.4)
PASS : AppTests::initTestCase()
QWARN : AppTests::appTests() Backing up GUI settings to "/tmp/test_bitcoin-qt_1510018491_71945/regtest/guisettings.ini.bak"
QWARN : AppTests::appTests() QFont::setPointSizeF: Point size <= 0 (-1.000000), must be greater than 0
QWARN : AppTests::appTests() QFont::setPointSizeF: Point size <= 0 (-1.000000), must be greater than 0
QWARN : AppTests::appTests() QFont::setPointSizeF: Point size <= 0 (-1.000000), must be greater than 0
QWARN : AppTests::appTests() QFont::setPointSizeF: Point size <= 0 (-1.000000), must be greater than 0
QWARN : AppTests::appTests() QFont::setPointSizeF: Point size <= 0 (-1.000000), must be greater than 0
QWARN : AppTests::appTests() QFont::setPointSizeF: Point size <= 0 (-1.000000), must be greater than 0
QWARN : AppTests::appTests() QFont::setPointSizeF: Point size <= 0 (-1.000000), must be greater than 0
QWARN : AppTests::appTests() QFont::setPointSizeF: Point size <= 0 (-1.000000), must be greater than 0
QDEBUG : AppTests::appTests() requestInitialize : Requesting initialize
QDEBUG : AppTests::appTests() initialize : Running initialization in thread
QDEBUG : AppTests::appTests() initializeResult : Initialization result: true
QWARN : AppTests::appTests() Platform customization: "other"
========= Received signal, dumping stack ==============
========= End of stack trace ==============
QFATAL : AppTests::appTests() Received signal 11
Function time: 267ms Total time: 272ms
FAIL! : AppTests::appTests() Received a fatal error.
Loc: [Unknown file(0)]
Totals: 1 passed, 1 failed, 0 skipped, 0 blacklisted, 284ms
********* 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();
bitdb.Close();
bitdb.Reset();
Thanks, switched.
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?
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.
Responded above, would have to be a multiset instead of a stack.
LGTM. Some nits below.
Had to make some fixes for travis: 5be833cf92cddedd4c52c3e101ec8bc7dbcdafa6 -> 4bf5ecd0ff2f588ada7d2a4ad3f2c9ef4d3a75b1 (pr/apptest.1 -> pr/apptest.3), there was QSystemTrayIcon segfault happening with an older version of qt5 and there were compile errors with qt4.
Had to make some more #include fixes, but travis is actually fixed now. Updated 4bf5ecd0ff2f588ada7d2a4ad3f2c9ef4d3a75b1 -> e94e344d3c46ef084e0666955a7a1ebd69824406 (pr/apptest.3 -> pr/apptest.4)
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?
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?
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.
Nit, sort includes.
These are sorted (case is significant).
Some nits otherwise LGTM. Will test locally.
Any hint?
make clean && make
...
CXXLD qt/test/test_bitcoin-qt
Undefined symbols for architecture x86_64:
"MacNotificationHandler::instance()", referenced from:
Notificator::Notificator(QString const&, QSystemTrayIcon*, QWidget*) in libbitcoinqt.a(qt_libbitcoinqt_a-notificator.o)
Notificator::notify(Notificator::Class, QString const&, QString const&, QIcon const&, int) in libbitcoinqt.a(qt_libbitcoinqt_a-notificator.o)
"MacNotificationHandler::hasUserNotificationCenterSupport()", referenced from:
Notificator::Notificator(QString const&, QSystemTrayIcon*, QWidget*) in libbitcoinqt.a(qt_libbitcoinqt_a-notificator.o)
"MacNotificationHandler::showNotification(QString const&, QString const&)", referenced from:
Notificator::notify(Notificator::Class, QString const&, QString const&, QIcon const&, int) in libbitcoinqt.a(qt_libbitcoinqt_a-notificator.o)
"MacDockIconHandler::cleanup()", referenced from:
BitcoinGUI::~BitcoinGUI() in libbitcoinqt.a(qt_libbitcoinqt_a-bitcoingui.o)
"MacDockIconHandler::setMainWindow(QMainWindow*)", referenced from:
BitcoinGUI::createTrayIconMenu() in libbitcoinqt.a(qt_libbitcoinqt_a-bitcoingui.o)
"MacDockIconHandler::dockMenu()", referenced from:
BitcoinGUI::createTrayIconMenu() in libbitcoinqt.a(qt_libbitcoinqt_a-bitcoingui.o)
"MacDockIconHandler::instance()", referenced from:
BitcoinGUI::BitcoinGUI(PlatformStyle const*, NetworkStyle const*, QWidget*) in libbitcoinqt.a(qt_libbitcoinqt_a-bitcoingui.o)
BitcoinGUI::createTrayIconMenu() in libbitcoinqt.a(qt_libbitcoinqt_a-bitcoingui.o)
"MacDockIconHandler::setIcon(QIcon const&)", referenced from:
BitcoinGUI::BitcoinGUI(PlatformStyle const*, NetworkStyle const*, QWidget*) in libbitcoinqt.a(qt_libbitcoinqt_a-bitcoingui.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [qt/test/test_bitcoin-qt] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [all-recursive] Error 1
make: *** [all-recursive] Error 1
Have the same compile issue (clang):
Undefined symbols for architecture x86_64:
"MacNotificationHandler::instance()", referenced from:
Notificator::Notificator(QString const&, QSystemTrayIcon*, QWidget*) in libbitcoinqt.a(qt_libbitcoinqt_a-notificator.o)
Notificator::notifyMacUserNotificationCenter(Notificator::Class, QString const&, QString const&, QIcon const&) in libbitcoinqt.a(qt_libbitcoinqt_a-notificator.o)
"MacNotificationHandler::hasUserNotificationCenterSupport()", referenced from:
Notificator::Notificator(QString const&, QSystemTrayIcon*, QWidget*) in libbitcoinqt.a(qt_libbitcoinqt_a-notificator.o)
"MacNotificationHandler::showNotification(QString const&, QString const&)", referenced from:
Notificator::notifyMacUserNotificationCenter(Notificator::Class, QString const&, QString const&, QIcon const&) in libbitcoinqt.a(qt_libbitcoinqt_a-notificator.o)
"MacDockIconHandler::cleanup()", referenced from:
BitcoinGUI::~BitcoinGUI() in libbitcoinqt.a(qt_libbitcoinqt_a-bitcoingui.o)
"MacDockIconHandler::setMainWindow(QMainWindow*)", referenced from:
BitcoinGUI::createTrayIconMenu() in libbitcoinqt.a(qt_libbitcoinqt_a-bitcoingui.o)
"MacDockIconHandler::dockMenu()", referenced from:
BitcoinGUI::createTrayIconMenu() in libbitcoinqt.a(qt_libbitcoinqt_a-bitcoingui.o)
"MacDockIconHandler::instance()", referenced from:
BitcoinGUI::BitcoinGUI(PlatformStyle const*, NetworkStyle const*, QWidget*) in libbitcoinqt.a(qt_libbitcoinqt_a-bitcoingui.o)
BitcoinGUI::createTrayIconMenu() in libbitcoinqt.a(qt_libbitcoinqt_a-bitcoingui.o)
"MacDockIconHandler::setIcon(QIcon const&)", referenced from:
BitcoinGUI::BitcoinGUI(PlatformStyle const*, NetworkStyle const*, QWidget*) in libbitcoinqt.a(qt_libbitcoinqt_a-bitcoingui.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [qt/test/test_bitcoin-qt] Error 1
make[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?
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.
I can dig a little to see if I can find a fix.
Updated 55fe98350261e38c5c55ea938f128f1e1f0dc0eb -> b67d524b69350e131dd102ef716cc095130e72d7 (pr/apptest.5 -> pr/apptest.6) to fix the link error. I was able to reproduce it by building test_bitcoin-qt in a travis docker image, and confirmed that it now links.
Linux Tested ACK b67d524b69350e131dd102ef716cc095130e72d7
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:
0.01s$ if [ "$CHECK_DOC" = 1 -a "$TRAVIS_EVENT_TYPE" = "pull_request" ]; then contrib/devtools/lint-all.sh; fi
contrib/devtools/lint-python.sh: 10: contrib/devtools/lint-python.sh: flake8: not found
^---- 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):
********* Start testing of AppTests *********
Config: 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))
PASS : AppTests::initTestCase()
QWARN : AppTests::appTests() Backing up GUI settings to "/var/folders/ct/m1t1vdnj16b578f6f50jct3m0000gn/T/test_bitcoin-qt_1518433105_69222/regtest/guisettings.ini.bak"
========= Received signal, dumping stack ==============
(lldb) process attach --pid 19198
Process 19198 stopped
* thread [#1](/bitcoin-bitcoin/1/), queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
frame [#0](/bitcoin-bitcoin/0/): 0x00007fffe7487406 libsystem_kernel.dylib`__wait4_nocancel + 10
libsystem_kernel.dylib`__wait4_nocancel:
-> 0x7fffe7487406 <+10>: jae 0x7fffe7487410 ; <+20>
0x7fffe7487408 <+12>: movq %rax, %rdi
0x7fffe748740b <+15>: jmp 0x7fffe747fcaf ; cerror_nocancel
0x7fffe7487410 <+20>: retq
Target 0: (test_bitcoin-qt) stopped.
Executable module set to "/Users/jonasschnelli/Documents/bitcoin/bitcoin/./src/qt/test/test_bitcoin-qt".
Architecture set to: x86_64h-apple-macosx.
(lldb) bt all
* thread [#1](/bitcoin-bitcoin/1/), queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
* frame [#0](/bitcoin-bitcoin/0/): 0x00007fffe7487406 libsystem_kernel.dylib`__wait4_nocancel + 10
frame [#1](/bitcoin-bitcoin/1/): 0x00007fffe740de3d libsystem_c.dylib`system + 463
frame [#2](/bitcoin-bitcoin/2/): 0x0000000107da0f42 QtTest`___lldb_unnamed_symbol20$$QtTest + 162
frame [#3](/bitcoin-bitcoin/3/): 0x0000000107da0e4d QtTest`___lldb_unnamed_symbol19$$QtTest + 205
frame [#4](/bitcoin-bitcoin/4/): 0x00007fffe7567b3a libsystem_platform.dylib`_sigtramp + 26
frame [#5](/bitcoin-bitcoin/5/): 0x000000010812202a QtWidgets`QMenu::setAsDockMenu() + 42
frame [#6](/bitcoin-bitcoin/6/): 0x000000010546de81 test_bitcoin-qt`MacDockIconHandler::MacDockIconHandler(this=0x00007f9578f0fee0) at macdockiconhandler.mm:60
frame [#7](/bitcoin-bitcoin/7/): 0x000000010546df25 test_bitcoin-qt`MacDockIconHandler::MacDockIconHandler(this=0x00007f9578f0fee0) at macdockiconhandler.mm:50
frame [#8](/bitcoin-bitcoin/8/): 0x000000010546e508 test_bitcoin-qt`MacDockIconHandler::instance() at macdockiconhandler.mm:116
frame [#9](/bitcoin-bitcoin/9/): 0x00000001052e40a9 test_bitcoin-qt`BitcoinGUI::BitcoinGUI(this=0x00007f9578f0e6b0, _platformStyle=0x00007f9578deb140, networkStyle=0x00007f9578c03db0, parent=0x0000000000000000) at bitcoingui.cpp:143
frame [#10](/bitcoin-bitcoin/10/): 0x00000001052ea17b test_bitcoin-qt`BitcoinGUI::BitcoinGUI(this=0x00007f9578f0e6b0, _platformStyle=0x00007f9578deb140, networkStyle=0x00007f9578c03db0, parent=0x0000000000000000) at bitcoingui.cpp:121
frame [#11](/bitcoin-bitcoin/11/): 0x00000001052de9f9 test_bitcoin-qt`BitcoinApplication::createWindow(this=0x00007fff5a9d18b8, networkStyle=0x00007f9578c03db0) at bitcoin.cpp:297
frame [#12](/bitcoin-bitcoin/12/): 0x0000000105236c9a test_bitcoin-qt`AppTests::appTests(this=0x00007fff5a9d1880) at apptests.cpp:58
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
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
frame [#15](/bitcoin-bitcoin/15/): 0x0000000107d9ee01 QtTest`___lldb_unnamed_symbol11$$QtTest + 1169
frame [#16](/bitcoin-bitcoin/16/): 0x0000000107d9fac9 QtTest`___lldb_unnamed_symbol13$$QtTest + 777
frame [#17](/bitcoin-bitcoin/17/): 0x0000000107da09d7 QtTest`___lldb_unnamed_symbol17$$QtTest + 1031
frame [#18](/bitcoin-bitcoin/18/): 0x0000000107da1557 QtTest`QTest::qRun() + 247
frame [#19](/bitcoin-bitcoin/19/): 0x0000000107da11b0 QtTest`QTest::qExec(QObject*, int, char**) + 16
frame [#20](/bitcoin-bitcoin/20/): 0x000000010524fb66 test_bitcoin-qt`main(argc=1, argv=0x00007fff5a9d19d8) at test_main.cpp:82
frame [#21](/bitcoin-bitcoin/21/): 0x00007fffe7358235 libdyld.dylib`start + 1
frame [#22](/bitcoin-bitcoin/22/): 0x00007fffe7358235 libdyld.dylib`start + 1
thread [#2](/bitcoin-bitcoin/2/)
frame [#0](/bitcoin-bitcoin/0/): 0x00007fffe748744e libsystem_kernel.dylib`__workq_kernreturn + 10
frame [#1](/bitcoin-bitcoin/1/): 0x00007fffe7571621 libsystem_pthread.dylib`_pthread_wqthread + 1426
frame [#2](/bitcoin-bitcoin/2/): 0x00007fffe757107d libsystem_pthread.dylib`start_wqthread + 13
thread [#3](/bitcoin-bitcoin/3/)
frame [#0](/bitcoin-bitcoin/0/): 0x00007fffe748744e libsystem_kernel.dylib`__workq_kernreturn + 10
frame [#1](/bitcoin-bitcoin/1/): 0x00007fffe7571621 libsystem_pthread.dylib`_pthread_wqthread + 1426
frame [#2](/bitcoin-bitcoin/2/): 0x00007fffe757107d libsystem_pthread.dylib`start_wqthread + 13
thread [#4](/bitcoin-bitcoin/4/)
frame [#0](/bitcoin-bitcoin/0/): 0x00007fffe748744e libsystem_kernel.dylib`__workq_kernreturn + 10
frame [#1](/bitcoin-bitcoin/1/): 0x00007fffe757148e libsystem_pthread.dylib`_pthread_wqthread + 1023
frame [#2](/bitcoin-bitcoin/2/): 0x00007fffe757107d libsystem_pthread.dylib`start_wqthread + 13
thread [#5](/bitcoin-bitcoin/5/), name = 'QThread'
frame [#0](/bitcoin-bitcoin/0/): 0x00007fffe7486bf2 libsystem_kernel.dylib`__psynch_cvwait + 10
frame [#1](/bitcoin-bitcoin/1/): 0x00007fffe75727fa libsystem_pthread.dylib`_pthread_cond_wait + 712
frame [#2](/bitcoin-bitcoin/2/): 0x0000000107831c06 QtCore`___lldb_unnamed_symbol320$$QtCore + 294
frame [#3](/bitcoin-bitcoin/3/): 0x000000010783195b QtCore`___lldb_unnamed_symbol319$$QtCore + 43
frame [#4](/bitcoin-bitcoin/4/): 0x000000010783190c QtCore`QWaitCondition::wait(QMutex*, unsigned long) + 156
frame [#5](/bitcoin-bitcoin/5/): 0x0000000107da6566 QtTest`___lldb_unnamed_symbol34$$QtTest + 70
frame [#6](/bitcoin-bitcoin/6/): 0x00000001078303cc QtCore`___lldb_unnamed_symbol310$$QtCore + 364
frame [#7](/bitcoin-bitcoin/7/): 0x00007fffe757193b libsystem_pthread.dylib`_pthread_body + 180
frame [#8](/bitcoin-bitcoin/8/): 0x00007fffe7571887 libsystem_pthread.dylib`_pthread_start + 286
frame [#9](/bitcoin-bitcoin/9/): 0x00007fffe757108d libsystem_pthread.dylib`thread_start + 13
thread [#6](/bitcoin-bitcoin/6/)
frame [#0](/bitcoin-bitcoin/0/): 0x00007fffe748744e libsystem_kernel.dylib`__workq_kernreturn + 10
frame [#1](/bitcoin-bitcoin/1/): 0x00007fffe7571621 libsystem_pthread.dylib`_pthread_wqthread + 1426
frame [#2](/bitcoin-bitcoin/2/): 0x00007fffe757107d libsystem_pthread.dylib`start_wqthread + 13
thread [#7](/bitcoin-bitcoin/7/)
frame [#0](/bitcoin-bitcoin/0/): 0x00007fffe748744e libsystem_kernel.dylib`__workq_kernreturn + 10
frame [#1](/bitcoin-bitcoin/1/): 0x00007fffe7571621 libsystem_pthread.dylib`_pthread_wqthread + 1426
frame [#2](/bitcoin-bitcoin/2/): 0x00007fffe757107d libsystem_pthread.dylib`start_wqthread + 13
(lldb) quit
========= End of stack trace ==============
QFATAL : AppTests::appTests() Received signal 11
Function time: 143ms Total time: 144ms
FAIL! : AppTests::appTests() Received a fatal error.
Loc: [Unknown file(0)]
Totals: 1 passed, 1 failed, 0 skipped, 0 blacklisted, 4580ms
********* Finished testing of AppTests *********
Abort 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:
iMac:bitcoin bitcoin$ src/qt/test/test_bitcoin-qt
********* Start testing of AppTests *********
Config: 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))
PASS : AppTests::initTestCase()
QWARN : AppTests::appTests() Backing up GUI settings to "/var/folders/lv/01bvgc7x1fz03w1t8v7g7mrw0000gp/T/test_bitcoin-qt_1518462364_49176/regtest/guisettings.ini.bak"
QWARN : AppTests::appTests() QFont::setPointSizeF: Point size <= 0 (-1.000000), must be greater than 0
QWARN : AppTests::appTests() QFont::setPointSizeF: Point size <= 0 (-1.000000), must be greater than 0
QWARN : AppTests::appTests() QFont::setPointSizeF: Point size <= 0 (-1.000000), must be greater than 0
QWARN : AppTests::appTests() QFont::setPointSizeF: Point size <= 0 (-1.000000), must be greater than 0
QWARN : AppTests::appTests() QFont::setPointSizeF: Point size <= 0 (-1.000000), must be greater than 0
QWARN : AppTests::appTests() QFont::setPointSizeF: Point size <= 0 (-1.000000), must be greater than 0
QWARN : AppTests::appTests() QFont::setPointSizeF: Point size <= 0 (-1.000000), must be greater than 0
QWARN : AppTests::appTests() QFont::setPointSizeF: Point size <= 0 (-1.000000), must be greater than 0
QWARN : AppTests::appTests() QFont::setPointSizeF: Point size <= 0 (-1.000000), must be greater than 0
QWARN : AppTests::appTests() QFont::setPointSizeF: Point size <= 0 (-1.000000), must be greater than 0
QWARN : AppTests::appTests() QFont::setPointSizeF: Point size <= 0 (-1.000000), must be greater than 0
QDEBUG : AppTests::appTests() requestInitialize : Requesting initialize
QDEBUG : AppTests::appTests() initialize : Running initialization in thread
QDEBUG : AppTests::appTests() initializeResult : Initialization result: true
QWARN : AppTests::appTests() Platform customization: "macosx"
QDEBUG : 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")
QDEBUG : AppTests::appTests() "ReportInvalidCertificate: Payment server found an invalid certificate: " "01" ("Izenpe.com") () ()
QDEBUG : 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")
QDEBUG : AppTests::appTests() "ReportInvalidCertificate: Payment server found an invalid certificate: " "01" ("TÜRKTRUST Elektronik Sertifika Hizmet Sağlayıcısı") () ()
QWARN : AppTests::appTests() PaymentServer::LoadRootCAs: Loaded 173 root certificates
QFATAL : AppTests::appTests() Received signal 11
Function time: 2345ms Total time: 2346ms
FAIL! : AppTests::appTests() Received a fatal error.
Loc: [Unknown file(0)]
Totals: 1 passed, 1 failed, 0 skipped, 0 blacklisted, 2346ms
********* Finished testing of AppTests *********
Abort 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:
gdb src/qt/test/test_bitcoin-qt
GNU gdb (GDB) 8.1
This GDB was configured as "x86_64-apple-darwin17.3.0".
Reading symbols from src/qt/test/test_bitcoin-qt...
warning: can't find symbol '_Z10ParseHexUVRK8UniValueRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE' in minsymtab
warning: can't find symbol '_Z11qMetaTypeIdIPbEiv' in minsymtab
warning: can't find symbol '_Z17qRegisterMetaTypeINSt3__18functionIFvvEEEEiPKcPT_N9QtPrivate21MetaTypeDefinedHelperIS6_Xaasr12QMetaTypeId2IS6_EE7Definedntsr12QMetaTypeId2IS6_EE9IsBuiltInEE11DefinedTypeE' in minsymtab
warning: can't find symbol '_Z17qRegisterMetaTypeIPbEiPKcPT_N9QtPrivate21MetaTypeDefinedHelperIS3_Xaasr12QMetaTypeId2IS3_EE7Definedntsr12QMetaTypeId2IS3_EE9IsBuiltInEE11DefinedTypeE' in minsymtab
warning: can't find symbol '_Z17qRegisterMetaTypeIPbEiv' in minsymtab
warning: can't find symbol '_Z17qRegisterMetaTypeIxEiPKcPT_N9QtPrivate21MetaTypeDefinedHelperIS2_Xaasr12QMetaTypeId2IS2_EE7Definedntsr12QMetaTypeId2IS2_EE9IsBuiltInEE11DefinedTypeE' in minsymtab
warning: can't find symbol '_Z19DebugMessageHandler9QtMsgTypeRK18QMessageLogContextRK7QString' in minsymtab
warning: can't find symbol '_ZTSFNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEPKcE' in minsymtab
warning: can't find symbol '_ZN16FreespaceChecker16staticMetaObjectE' in minsymtab
warning: can't find symbol '_ZTI16FreespaceChecker' in minsymtab
warning: can't find symbol '_ZTS16FreespaceChecker' in minsymtab
warning: can't find symbol '_ZTV16FreespaceChecker' in minsymtab
warning: can't find symbol '_ZN15TransactionDesc11qt_metacallEN11QMetaObject4CallEiPPv' in minsymtab
warning: can't find symbol '_ZN15TransactionDesc11qt_metacastEPKc' in minsymtab
done.
(gdb) run
Starting program: [...]/src/qt/test/test_bitcoin-qt
[New Thread 0x2803 of process 58382]
[New Thread 0x1a03 of process 58382]
During startup program terminated with signal SIGTRAP, Trace/breakpoint trap.
(gdb)
lldb output might be more useful:
lldb src/qt/test/test_bitcoin-qt
(lldb) target create "src/qt/test/test_bitcoin-qt"
Current executable set to 'src/qt/test/test_bitcoin-qt' (x86_64).
(lldb) run
Process 58456 launched: '[...]/src/qt/test/test_bitcoin-qt' (x86_64)
********* Start testing of AppTests *********
Config: 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))
PASS : AppTests::initTestCase()
QWARN : AppTests::appTests() Backing up GUI settings to "/var/folders/lv/01bvgc7x1fz03w1t8v7g7mrw0000gp/T/test_bitcoin-qt_1518467512_26673/regtest/guisettings.ini.bak"
QWARN : AppTests::appTests() QFont::setPointSizeF: Point size <= 0 (-1.000000), must be greater than 0
QWARN : AppTests::appTests() QFont::setPointSizeF: Point size <= 0 (-1.000000), must be greater than 0
QWARN : AppTests::appTests() QFont::setPointSizeF: Point size <= 0 (-1.000000), must be greater than 0
QWARN : AppTests::appTests() QFont::setPointSizeF: Point size <= 0 (-1.000000), must be greater than 0
QWARN : AppTests::appTests() QFont::setPointSizeF: Point size <= 0 (-1.000000), must be greater than 0
QWARN : AppTests::appTests() QFont::setPointSizeF: Point size <= 0 (-1.000000), must be greater than 0
QWARN : AppTests::appTests() QFont::setPointSizeF: Point size <= 0 (-1.000000), must be greater than 0
QWARN : AppTests::appTests() QFont::setPointSizeF: Point size <= 0 (-1.000000), must be greater than 0
QWARN : AppTests::appTests() QFont::setPointSizeF: Point size <= 0 (-1.000000), must be greater than 0
QWARN : AppTests::appTests() QFont::setPointSizeF: Point size <= 0 (-1.000000), must be greater than 0
QWARN : AppTests::appTests() QFont::setPointSizeF: Point size <= 0 (-1.000000), must be greater than 0
QDEBUG : AppTests::appTests() requestInitialize : Requesting initialize
QDEBUG : AppTests::appTests() initialize : Running initialization in thread
QDEBUG : AppTests::appTests() initializeResult : Initialization result: true
QWARN : AppTests::appTests() Platform customization: "macosx"
QDEBUG : 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")
QDEBUG : AppTests::appTests() "ReportInvalidCertificate: Payment server found an invalid certificate: " "01" ("Izenpe.com") () ()
QDEBUG : 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")
QDEBUG : AppTests::appTests() "ReportInvalidCertificate: Payment server found an invalid certificate: " "01" ("TÜRKTRUST Elektronik Sertifika Hizmet Sağlayıcısı") () ()
QWARN : AppTests::appTests() PaymentServer::LoadRootCAs: Loaded 173 root certificates
Process 58456 stopped
* thread [#1](/bitcoin-bitcoin/1/), queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x8)
frame [#0](/bitcoin-bitcoin/0/): 0x0000000102e92c61 QtWidgets`QWidget::insertAction(QAction*, QAction*) + 33
QtWidgets`QWidget::insertAction:
-> 0x102e92c61 <+33>: movq 0x8(%r14), %r12
0x102e92c65 <+37>: movq 0x1a0(%r12), %rax
0x102e92c6d <+45>: addq $0x1a0, %r12 ; imm = 0x1A0
0x102e92c74 <+52>: movl 0x8(%rax), %edx
Target 0: (test_bitcoin-qt) stopped.
Could you try typing "bt" at the gdb/lldb prompt to get a stack trace?
(lldb) bt
* thread [#1](/bitcoin-bitcoin/1/), queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x8)
* frame [#0](/bitcoin-bitcoin/0/): 0x0000000102e92c61 QtWidgets`QWidget::insertAction(QAction*, QAction*) + 33
frame [#1](/bitcoin-bitcoin/1/): 0x00000001000bdb84 test_bitcoin-qt`BitcoinGUI::createTrayIconMenu(this=0x00000001042125e0) at bitcoingui.cpp:614
frame [#2](/bitcoin-bitcoin/2/): 0x00000001000bd665 test_bitcoin-qt`BitcoinGUI::setClientModel(this=0x00000001042125e0, _clientModel=0x000000010dfb4c30) at bitcoingui.cpp:480
frame [#3](/bitcoin-bitcoin/3/): 0x00000001000b2531 test_bitcoin-qt`BitcoinApplication::initializeResult(this=0x00007ffeefbff8f8, success=true) at bitcoin.cpp:389
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
frame [#5](/bitcoin-bitcoin/5/): 0x0000000102957401 QtCore`QObject::event(QEvent*) + 769
frame [#6](/bitcoin-bitcoin/6/): 0x000000010340d70b QtGui`QGuiApplication::event(QEvent*) + 267
frame [#7](/bitcoin-bitcoin/7/): 0x0000000102e63b33 QtWidgets`QApplication::event(QEvent*) + 883
frame [#8](/bitcoin-bitcoin/8/): 0x0000000102e653bd QtWidgets`QApplicationPrivate::notify_helper(QObject*, QEvent*) + 269
frame [#9](/bitcoin-bitcoin/9/): 0x0000000102e6675a QtWidgets`QApplication::notify(QObject*, QEvent*) + 362
frame [#10](/bitcoin-bitcoin/10/): 0x000000010292e1f8 QtCore`QCoreApplication::notifyInternal2(QObject*, QEvent*) + 168
frame [#11](/bitcoin-bitcoin/11/): 0x000000010292f388 QtCore`QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) + 840
frame [#12](/bitcoin-bitcoin/12/): 0x0000000102982b08 QtCore`QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 72
frame [#13](/bitcoin-bitcoin/13/): 0x000000010448659e libqminimal.dylib`___lldb_unnamed_symbol47$$libqminimal.dylib + 14
frame [#14](/bitcoin-bitcoin/14/): 0x0000000102929dae QtCore`QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 398
frame [#15](/bitcoin-bitcoin/15/): 0x000000010292e8f1 QtCore`QCoreApplication::exec() + 369
frame [#16](/bitcoin-bitcoin/16/): 0x000000010000942a test_bitcoin-qt`AppTests::appTests(this=0x00007ffeefbff8c0) at apptests.cpp:63
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
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
frame [#19](/bitcoin-bitcoin/19/): 0x0000000102cd8e01 QtTest`___lldb_unnamed_symbol11$$QtTest + 1169
frame [#20](/bitcoin-bitcoin/20/): 0x0000000102cd9ac9 QtTest`___lldb_unnamed_symbol13$$QtTest + 777
frame [#21](/bitcoin-bitcoin/21/): 0x0000000102cda9d7 QtTest`___lldb_unnamed_symbol17$$QtTest + 1031
frame [#22](/bitcoin-bitcoin/22/): 0x0000000102cdb557 QtTest`QTest::qRun() + 247
frame [#23](/bitcoin-bitcoin/23/): 0x0000000102cdb1b0 QtTest`QTest::qExec(QObject*, int, char**) + 16
frame [#24](/bitcoin-bitcoin/24/): 0x00000001000222d6 test_bitcoin-qt`main(argc=1, argv=0x00007ffeefbffa18) at test_main.cpp:82
frame [#25](/bitcoin-bitcoin/25/): 0x00007fff798b8115 libdyld.dylib`start + 1
frame [#26](/bitcoin-bitcoin/26/): 0x00007fff798b8115 libdyld.dylib`start + 1
By the way, I can launch QT just fine, no crash.
@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:
* 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)
frame [#0](/bitcoin-bitcoin/0/): 0x00000001018deaf5 QtWidgets`QToolBar::event(QEvent*) + 501
QtWidgets`QToolBar::event:
-> 0x1018deaf5 <+501>: movq (%rbx), %rax
0x1018deaf8 <+504>: movq 0x88(%rax), %r15
0x1018deaff <+511>: leaq 0x2946d9(%rip), %rsi ; "setContentBorderAreaEnabled"
0x1018deb06 <+518>: leaq -0x90(%rbp), %r13
* 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)
frame [#0](/bitcoin-bitcoin/0/): 0x00000001018deaf5 QtWidgets`QToolBar::event(QEvent*) + 501
frame [#1](/bitcoin-bitcoin/1/): 0x000000010173697b QtWidgets`QApplicationPrivate::notify_helper(QObject*, QEvent*) + 251
frame [#2](/bitcoin-bitcoin/2/): 0x00000001017392de QtWidgets`QApplication::notify(QObject*, QEvent*) + 5630
frame [#3](/bitcoin-bitcoin/3/): 0x00000001011774f3 QtCore`QCoreApplication::notifyInternal(QObject*, QEvent*) + 115
frame [#4](/bitcoin-bitcoin/4/): 0x00000001017736e7 QtWidgets`QWidgetPrivate::show_helper() + 423
* frame [#5](/bitcoin-bitcoin/5/): 0x000000010177416c QtWidgets`QWidget::setVisible(bool) + 956
frame [#6](/bitcoin-bitcoin/6/): 0x00000001017738e0 QtWidgets`QWidgetPrivate::showChildren(bool) + 304
frame [#7](/bitcoin-bitcoin/7/): 0x000000010177358c QtWidgets`QWidgetPrivate::show_helper() + 76
frame [#8](/bitcoin-bitcoin/8/): 0x000000010177416c QtWidgets`QWidget::setVisible(bool) + 956
frame [#9](/bitcoin-bitcoin/9/): 0x0000000100038960 test_bitcoin-qt`BitcoinApplication::initializeResult(this=0x00007fff5fbff870, success=<unavailable>) + 1008 at bitcoin.cpp:412
frame [#10](/bitcoin-bitcoin/10/): 0x00000001011a018c QtCore`QObject::event(QEvent*) + 156
frame [#11](/bitcoin-bitcoin/11/): 0x0000000101178d46 QtCore`QCoreApplication::event(QEvent*) + 102
frame [#12](/bitcoin-bitcoin/12/): 0x0000000101df5ece QtGui`QGuiApplication::event(QEvent*) + 270
frame [#13](/bitcoin-bitcoin/13/): 0x0000000101735182 QtWidgets`QApplication::event(QEvent*) + 1122
frame [#14](/bitcoin-bitcoin/14/): 0x000000010173697b QtWidgets`QApplicationPrivate::notify_helper(QObject*, QEvent*) + 251
frame [#15](/bitcoin-bitcoin/15/): 0x00000001017392de QtWidgets`QApplication::notify(QObject*, QEvent*) + 5630
frame [#16](/bitcoin-bitcoin/16/): 0x0000000101178212 QtCore`QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) + 1058
frame [#17](/bitcoin-bitcoin/17/): 0x00000001011c77db QtCore`QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 59
frame [#18](/bitcoin-bitcoin/18/): 0x0000000105063e5e libqminimal.dylib`QUnixEventDispatcherQPA::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 14
frame [#19](/bitcoin-bitcoin/19/): 0x0000000101174c1c QtCore`QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 412
frame [#20](/bitcoin-bitcoin/20/): 0x0000000101177a95 QtCore`QCoreApplication::exec() + 341
frame [#21](/bitcoin-bitcoin/21/): 0x0000000100008708 test_bitcoin-qt`AppTests::appTests(this=<unavailable>) + 360 at apptests.cpp:63
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
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
frame [#24](/bitcoin-bitcoin/24/): 0x0000000100f60124 QtTest`QTest::qInvokeTestMethod(char const*, char const*) + 1444
frame [#25](/bitcoin-bitcoin/25/): 0x0000000100f5b5e0 QtTest`QTest::qExec(QObject*, int, char**) + 1328
frame [#26](/bitcoin-bitcoin/26/): 0x00000001000110ff test_bitcoin-qt`main(argc=<unavailable>, argv=<unavailable>) + 575 at test_main.cpp:82
frame [#27](/bitcoin-bitcoin/27/): 0x00007fff8e98b5ad libdyld.dylib`start + 1
frame [#28](/bitcoin-bitcoin/28/): 0x00007fff8e98b5ad libdyld.dylib`start + 1
thread [#7](/bitcoin-bitcoin/7/): tid = 0x36e172, 0x00007fff9315607a libsystem_kernel.dylib`__select + 10, name = 'QThread'
frame [#0](/bitcoin-bitcoin/0/): 0x00007fff9315607a libsystem_kernel.dylib`__select + 10
frame [#1](/bitcoin-bitcoin/1/): 0x00000001011c57a3 QtCore`qt_safe_select(int, fd_set*, fd_set*, fd_set*, timespec const*) + 547
frame [#2](/bitcoin-bitcoin/2/): 0x00000001011c66b5 QtCore`QEventDispatcherUNIXPrivate::doSelect(QFlags<QEventLoop::ProcessEventsFlag>, timespec*) + 693
frame [#3](/bitcoin-bitcoin/3/): 0x00000001011c788a QtCore`QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 234
frame [#4](/bitcoin-bitcoin/4/): 0x0000000101174c1c QtCore`QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 412
frame [#5](/bitcoin-bitcoin/5/): 0x0000000100fca07e QtCore`QThread::exec() + 110
frame [#6](/bitcoin-bitcoin/6/): 0x0000000100fcdc02 QtCore`QThreadPrivate::start(void*) + 338
frame [#7](/bitcoin-bitcoin/7/): 0x00007fff9721299d libsystem_pthread.dylib`_pthread_body + 131
frame [#8](/bitcoin-bitcoin/8/): 0x00007fff9721291a libsystem_pthread.dylib`_pthread_start + 168
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
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?
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:
Thanks. Just to clarify further, do we know any use case other than running tests that requires QT support with 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.
Rebased f4b25d498233cf2a894fa27616d65f56b99af390 -> 391bd7d0acac733ade77fa37003b6dae8496b9c8 (pr/apptest.13 -> pr/apptest.14) due to conflict with #12610.
Sadly make fails for me on macOS 10.13.3:
make clean
./autogen.sh
./configure --disable-bench --with-miniupnpc=no --with-incompatible-bdb --with-qrencode
make -j5
...
CXXLD test/test_bitcoin_fuzzy
qt/test/apptests.cpp:80:7: error: no member named 'bitdb' in the global namespace
::bitdb.Close();
~~^
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();
Should 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
If I remove those lines 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):
********* Start testing of RPCNestedTests *********
Config: 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))
PASS : RPCNestedTests::initTestCase()
FAIL! : RPCNestedTests::rpcNestedTests() Caught unhandled exception
Loc: [qtestcase.cpp(1836)]
Totals: 1 passed, 1 failed, 0 skipped, 0 blacklisted, 49ms
********* Finished testing of RPCNestedTests *********
libc++abi.dylib: terminating with uncaught exception of type UniValue
Process 99582 stopped
* thread [#1](/bitcoin-bitcoin/1/), queue = 'com.apple.main-thread', stop reason = signal SIGABRT
frame [#0](/bitcoin-bitcoin/0/): 0x00007fff58a7fe3e libsystem_kernel.dylib`__pthread_kill + 10
libsystem_kernel.dylib`__pthread_kill:
-> 0x7fff58a7fe3e <+10>: jae 0x7fff58a7fe48 ; <+20>
0x7fff58a7fe40 <+12>: movq %rax, %rdi
0x7fff58a7fe43 <+15>: jmp 0x7fff58a770b8 ; cerror_nocancel
0x7fff58a7fe48 <+20>: retq
Target 0: (test_bitcoin-qt) stopped.
(lldb) bt
* thread [#1](/bitcoin-bitcoin/1/), queue = 'com.apple.main-thread', stop reason = signal SIGABRT
* frame [#0](/bitcoin-bitcoin/0/): 0x00007fff58a7fe3e libsystem_kernel.dylib`__pthread_kill + 10
frame [#1](/bitcoin-bitcoin/1/): 0x00007fff58bbe150 libsystem_pthread.dylib`pthread_kill + 333
frame [#2](/bitcoin-bitcoin/2/): 0x00007fff589dc312 libsystem_c.dylib`abort + 127
frame [#3](/bitcoin-bitcoin/3/): 0x00007fff569b7f8f libc++abi.dylib`abort_message + 245
frame [#4](/bitcoin-bitcoin/4/): 0x00007fff569b812b libc++abi.dylib`default_terminate_handler() + 265
frame [#5](/bitcoin-bitcoin/5/): 0x00007fff57d42eab libobjc.A.dylib`_objc_terminate() + 105
frame [#6](/bitcoin-bitcoin/6/): 0x00007fff569d37c9 libc++abi.dylib`std::__terminate(void (*)()) + 8
frame [#7](/bitcoin-bitcoin/7/): 0x00007fff569d3478 libc++abi.dylib`__cxa_rethrow + 99
frame [#8](/bitcoin-bitcoin/8/): 0x00000001016d2b1a QtTest`QTest::qRun() + 1722
frame [#9](/bitcoin-bitcoin/9/): 0x00000001016d21b0 QtTest`QTest::qExec(QObject*, int, char**) + 16
frame [#10](/bitcoin-bitcoin/10/): 0x0000000100011978 test_bitcoin-qt`main(argc=<unavailable>, argv=<unavailable>) at test_main.cpp:96 [opt]
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.<!--e57a25ab6845829454e8d69fc972939a-->
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
<!--174a7506f384e20aa4161008e828411d-->
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
qt/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>
This file lacks a copyright message :-)
0 | @@ -0,0 +1,46 @@ 1 | +#ifndef BITCOIN_QT_TEST_APPTESTS_H
This file lacks a copyright message :-)
12 | + 13 | +class AppTests : public QObject 14 | +{ 15 | + Q_OBJECT 16 | +public: 17 | + AppTests(BitcoinApplication& app) : m_app(app) {}
Should be 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?
Could move the first commit to a separate pull request, since that is what needs rebase all the time?
@ryanofsky: interested to pick this up again?
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.