Page MenuHomePhabricator

test: Seed test RNG context for each test case, print seed
ClosedPublic

Authored by PiRK on Sat, Oct 17, 12:52.

Details

Reviewers
deadalnix
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Restricted Project
Commits
rABCee2ce03e6d98: test: Seed test RNG context for each test case, print seed
Summary

Debugging failing unit tests is hard if the failure is non-deterministic and the seed is not known.

Fix that by printing the seed and making it possible to set the seed from outside.

Backport of Core PR16978

Test Plan

ninja && ninja check

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Owners added a reviewer: Restricted Owners Package.Sat, Oct 17, 12:52
PiRK requested review of this revision.Sat, Oct 17, 12:52

Snippet of first build failure:

[397/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/networkstyle.cpp.o
[398/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/bitcoinaddressvalidator.cpp.o
[399/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/notificator.cpp.o
[400/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/modaloverlay.cpp.o
[401/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/bantablemodel.cpp.o
[402/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/clientmodel.cpp.o
[403/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/platformstyle.cpp.o
[404/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/qvalidatedlineedit.cpp.o
[405/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/qvaluecombobox.cpp.o
[406/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/guiutil.cpp.o
[407/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/bitcoingui.cpp.o
[408/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/bitcoin-qt-base_autogen/mocs_compilation.cpp.o
[409/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/bitcoin.cpp.o
[410/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/bitcoinamountfield.cpp.o
[411/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/qrc_bitcoin.cpp.o
[412/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/optionsdialog.cpp.o
[413/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/trafficgraphwidget.cpp.o
[414/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/utilitydialog.cpp.o
[415/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/optionsmodel.cpp.o
[416/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/coincontroltreewidget.cpp.o
[417/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/splashscreen.cpp.o
[418/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/createwalletdialog.cpp.o
[419/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/intro.cpp.o
[420/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/askpassphrasedialog.cpp.o
[421/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/rpcconsole.cpp.o
[422/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/openuridialog.cpp.o
[423/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/peertablemodel.cpp.o
[424/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/addressbookpage.cpp.o
[425/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/qrimagewidget.cpp.o
[426/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/addresstablemodel.cpp.o
[427/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/coincontroldialog.cpp.o
[428/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/editaddressdialog.cpp.o
[429/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/transactiondescdialog.cpp.o
[430/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/transactionfilterproxy.cpp.o
[431/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/recentrequeststablemodel.cpp.o
[432/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/receiverequestdialog.cpp.o
[433/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/sendcoinsentry.cpp.o
[434/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/receivecoinsdialog.cpp.o
[435/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/transactionrecord.cpp.o
[436/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/sendcoinsdialog.cpp.o
[437/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/signverifymessagedialog.cpp.o
[438/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/overviewpage.cpp.o
[439/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/paymentrequestplus.cpp.o
[440/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/walletmodeltransaction.cpp.o
[441/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/walletview.cpp.o
[442/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/walletcontroller.cpp.o
[443/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/walletframe.cpp.o
[444/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/qrc_bitcoin_locale.cpp.o
[445/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/transactionview.cpp.o
[446/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/paymentserver.cpp.o
[447/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/transactiontablemodel.cpp.o
[448/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/transactiondesc.cpp.o
[449/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/walletmodel.cpp.o
[450/484] Linking CXX static library src/qt/libbitcoin-qt-base.a
[451/484] Automatic MOC for target bitcoin-qt
[452/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt.dir/bitcoin-qt_autogen/mocs_compilation.cpp.o
[453/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt.dir/main.cpp.o
[454/484] Linking CXX executable src/qt/bitcoin-qt
ninja: build stopped: cannot make progress due to previous errors.
Build build-clang-tidy failed with exit code 1
deadalnix requested changes to this revision.Sat, Oct 17, 14:18
deadalnix added a subscriber: deadalnix.
deadalnix added inline comments.
src/test/util/setup_common.cpp
53 ↗(On Diff #24756)

braces

This revision now requires changes to proceed.Sat, Oct 17, 14:18

address feedback: missing braces

Snippet of first build failure:

[397/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/networkstyle.cpp.o
[398/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/notificator.cpp.o
[399/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/bitcoinaddressvalidator.cpp.o
[400/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/modaloverlay.cpp.o
[401/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/bantablemodel.cpp.o
[402/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/platformstyle.cpp.o
[403/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/clientmodel.cpp.o
[404/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/qvalidatedlineedit.cpp.o
[405/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/qvaluecombobox.cpp.o
[406/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/guiutil.cpp.o
[407/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/bitcoin.cpp.o
[408/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/bitcoingui.cpp.o
[409/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/bitcoin-qt-base_autogen/mocs_compilation.cpp.o
[410/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/qrc_bitcoin.cpp.o
[411/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/bitcoinamountfield.cpp.o
[412/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/optionsmodel.cpp.o
[413/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/optionsdialog.cpp.o
[414/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/trafficgraphwidget.cpp.o
[415/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/utilitydialog.cpp.o
[416/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/splashscreen.cpp.o
[417/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/coincontroltreewidget.cpp.o
[418/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/createwalletdialog.cpp.o
[419/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/intro.cpp.o
[420/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/askpassphrasedialog.cpp.o
[421/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/openuridialog.cpp.o
[422/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/qrimagewidget.cpp.o
[423/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/rpcconsole.cpp.o
[424/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/addresstablemodel.cpp.o
[425/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/addressbookpage.cpp.o
[426/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/peertablemodel.cpp.o
[427/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/coincontroldialog.cpp.o
[428/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/editaddressdialog.cpp.o
[429/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/transactionfilterproxy.cpp.o
[430/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/receiverequestdialog.cpp.o
[431/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/transactiondescdialog.cpp.o
[432/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/recentrequeststablemodel.cpp.o
[433/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/receivecoinsdialog.cpp.o
[434/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/sendcoinsentry.cpp.o
[435/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/transactionrecord.cpp.o
[436/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/sendcoinsdialog.cpp.o
[437/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/signverifymessagedialog.cpp.o
[438/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/walletmodeltransaction.cpp.o
[439/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/paymentrequestplus.cpp.o
[440/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/overviewpage.cpp.o
[441/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/walletview.cpp.o
[442/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/walletcontroller.cpp.o
[443/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/qrc_bitcoin_locale.cpp.o
[444/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/walletframe.cpp.o
[445/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/transactionview.cpp.o
[446/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/paymentserver.cpp.o
[447/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/transactiontablemodel.cpp.o
[448/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/transactiondesc.cpp.o
[449/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/walletmodel.cpp.o
[450/484] Linking CXX static library src/qt/libbitcoin-qt-base.a
[451/484] Automatic MOC for target bitcoin-qt
[452/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt.dir/bitcoin-qt_autogen/mocs_compilation.cpp.o
[453/484] Building CXX object src/qt/CMakeFiles/bitcoin-qt.dir/main.cpp.o
[454/484] Linking CXX executable src/qt/bitcoin-qt
ninja: build stopped: cannot make progress due to previous errors.
Build build-clang-tidy failed with exit code 1
deadalnix requested changes to this revision.Sat, Oct 17, 14:46

Make sure you look at the clang tidy build.

src/test/util/setup_common.cpp
64 ↗(On Diff #24758)

You need to put braces here as well.

This revision now requires changes to proceed.Sat, Oct 17, 14:46

Make sure you look at the clang tidy build.

Sorry I will pay more attention next time. Fixed.

Edit: ignore the inline comment, it's a left-over from a draft that I accidentaly published with this reply.

src/test/util/setup_common.cpp
53 ↗(On Diff #24756)
This revision is now accepted and ready to land.Sat, Oct 17, 16:04