mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-03 09:56:38 -05:00
Fix unregister_all_during_call cleanup
Use TestingSetup fixture to fix unregister_all_during_call test not calling UnregisterBackgroundSignalScheduler, which could trigger an assert in RegisterBackgroundSignalScheduler when called in later tests Failure reported by fanquake <fanquake@gmail.com> https://github.com/bitcoin/bitcoin/pull/18551#issuecomment-610974251
This commit is contained in:
parent
1f70185a80
commit
13d2a33537
1 changed files with 2 additions and 5 deletions
|
@ -3,14 +3,14 @@
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
#include <boost/test/unit_test.hpp>
|
#include <boost/test/unit_test.hpp>
|
||||||
|
|
||||||
#include <consensus/validation.h>
|
#include <consensus/validation.h>
|
||||||
#include <primitives/block.h>
|
#include <primitives/block.h>
|
||||||
#include <scheduler.h>
|
#include <scheduler.h>
|
||||||
|
#include <test/util/setup_common.h>
|
||||||
#include <util/check.h>
|
#include <util/check.h>
|
||||||
#include <validationinterface.h>
|
#include <validationinterface.h>
|
||||||
|
|
||||||
BOOST_AUTO_TEST_SUITE(validationinterface_tests)
|
BOOST_FIXTURE_TEST_SUITE(validationinterface_tests, TestingSetup)
|
||||||
|
|
||||||
class TestInterface : public CValidationInterface
|
class TestInterface : public CValidationInterface
|
||||||
{
|
{
|
||||||
|
@ -43,9 +43,6 @@ public:
|
||||||
BOOST_AUTO_TEST_CASE(unregister_all_during_call)
|
BOOST_AUTO_TEST_CASE(unregister_all_during_call)
|
||||||
{
|
{
|
||||||
bool destroyed = false;
|
bool destroyed = false;
|
||||||
|
|
||||||
CScheduler scheduler;
|
|
||||||
GetMainSignals().RegisterBackgroundSignalScheduler(scheduler);
|
|
||||||
RegisterSharedValidationInterface(std::make_shared<TestInterface>(
|
RegisterSharedValidationInterface(std::make_shared<TestInterface>(
|
||||||
[&] {
|
[&] {
|
||||||
// First call should decrements reference count 2 -> 1
|
// First call should decrements reference count 2 -> 1
|
||||||
|
|
Loading…
Add table
Reference in a new issue