Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Move MakeNoLogFileContext to libtest_util, and use it in bench #21003

Merged
merged 1 commit into from
Mar 4, 2021

Conversation

maflcko
Copy link
Member

@maflcko maflcko commented Jan 25, 2021

To avoid verbose code duplication, which may lead to accidental mishaps https://github.com/bitcoin/bitcoin/pull/20998/files#r563624041.

Also fix a nit I found in #20946 (comment).

@fanquake fanquake added the Tests label Jan 25, 2021
@maflcko maflcko changed the title test: Move MakeNoLogFileContext to common libtest_util, and use it in bench test: Move MakeNoLogFileContext to libtest_util, and use it in bench Jan 25, 2021
@maflcko maflcko closed this Jan 25, 2021
@maflcko maflcko deleted the 2101-benchNoLog branch January 25, 2021 11:33
@maflcko maflcko mentioned this pull request Jan 25, 2021
@maflcko maflcko restored the 2101-benchNoLog branch January 25, 2021 19:17
@maflcko
Copy link
Member Author

maflcko commented Jan 25, 2021

Worked around #21005

@maflcko maflcko reopened this Jan 25, 2021
@DrahtBot
Copy link
Contributor

DrahtBot commented Jan 26, 2021

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

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.

@maflcko
Copy link
Member Author

maflcko commented Feb 11, 2021

Rebased (3x)

@maflcko
Copy link
Member Author

maflcko commented Feb 19, 2021

Rebased (4x)

@maflcko
Copy link
Member Author

maflcko commented Feb 22, 2021

Rebased (5x)

maflcko pushed a commit that referenced this pull request Feb 25, 2021
fae216a scripted-diff: Rename MakeFuzzingContext to MakeNoLogFileContext (MarcoFalke)
fa4fbec scripted-diff: Rename PROVIDE_MAIN_FUNCTION -> PROVIDE_FUZZ_MAIN_FUNCTION (MarcoFalke)

Pull request description:

  Split out two renames from #21003:

  * `PROVIDE_FUZZ_MAIN_FUNCTION`. *Reason*: This in only used by fuzzing, so the name should indicate that.
  * `MakeNoLogFileContext`. *Reason*: Better reflects what the helper does. Also, prepares it to be used in non-fuzz tests in the future.

ACKs for top commit:
  practicalswift:
    cr ACK fae216a: scripted-diff looks correct

Tree-SHA512: e5d347746f5da72b0c86fd4f07ac2e4b3016e88e8c97a830c73bd79d0af6d0245fe7712487fc20344d6cc25958941716c1678124a123930407e3a437265b71df
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Feb 25, 2021
fae216a scripted-diff: Rename MakeFuzzingContext to MakeNoLogFileContext (MarcoFalke)
fa4fbec scripted-diff: Rename PROVIDE_MAIN_FUNCTION -> PROVIDE_FUZZ_MAIN_FUNCTION (MarcoFalke)

Pull request description:

  Split out two renames from bitcoin#21003:

  * `PROVIDE_FUZZ_MAIN_FUNCTION`. *Reason*: This in only used by fuzzing, so the name should indicate that.
  * `MakeNoLogFileContext`. *Reason*: Better reflects what the helper does. Also, prepares it to be used in non-fuzz tests in the future.

ACKs for top commit:
  practicalswift:
    cr ACK fae216a: scripted-diff looks correct

Tree-SHA512: e5d347746f5da72b0c86fd4f07ac2e4b3016e88e8c97a830c73bd79d0af6d0245fe7712487fc20344d6cc25958941716c1678124a123930407e3a437265b71df
@practicalswift
Copy link
Contributor

Concept ACK (2x)

Can be reviewed with --color-moved=dimmed-zebra
Copy link
Member

@fanquake fanquake left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK fa576b4

@@ -15,7 +15,7 @@
namespace {

struct TestBlockAndIndex {
TestingSetup test_setup{};
const std::unique_ptr<const TestingSetup> testing_setup{MakeNoLogFileContext<const TestingSetup>(CBaseChainParams::MAIN)};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems kind of unruly.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unruly

C++ requires this. (You can't use auto for non-static members)

@maflcko
Copy link
Member Author

maflcko commented Mar 3, 2021

@dongcarl Mind to take a look here, as this builds on top of #20946?

@dongcarl
Copy link
Contributor

dongcarl commented Mar 3, 2021

Light Code-Review ACK fa576b4

Looks reasonable. Always good to coalesce these init codepaths.

@fanquake
Copy link
Member

fanquake commented Mar 4, 2021

Failed merged (1x)

This need fixing up post #19203 & #19288:

test/fuzz/socks5.cpp:22:66: error: unknown type name 'BasicTestingSetup'
    static const auto testing_setup = MakeNoLogFileContext<const BasicTestingSetup>();
                                                                 ^
1 error generated.
gmake[2]: *** [Makefile:13693: test/fuzz/fuzz-socks5.o] Error 1
gmake[2]: *** Waiting for unfinished jobs....
test/fuzz/torcontrol.cpp:38:39: error: use of undeclared identifier 'MakeNoLogFileContext'
    static const auto testing_setup = MakeNoLogFileContext<>();
                                      ^
1 error generated.
diff --git a/src/test/fuzz/socks5.cpp b/src/test/fuzz/socks5.cpp
index 123ee042e..72c3e8f71 100644
--- a/src/test/fuzz/socks5.cpp
+++ b/src/test/fuzz/socks5.cpp
@@ -6,6 +6,7 @@
 #include <test/fuzz/FuzzedDataProvider.h>
 #include <test/fuzz/fuzz.h>
 #include <test/fuzz/util.h>
+#include <test/util/setup_common.h>
 
 #include <cstdint>
 #include <string>
diff --git a/src/test/fuzz/torcontrol.cpp b/src/test/fuzz/torcontrol.cpp
index b7a42ea7f..a8e69dee3 100644
--- a/src/test/fuzz/torcontrol.cpp
+++ b/src/test/fuzz/torcontrol.cpp
@@ -5,6 +5,7 @@
 #include <test/fuzz/FuzzedDataProvider.h>
 #include <test/fuzz/fuzz.h>
 #include <test/fuzz/util.h>
+#include <test/util/setup_common.h>
 #include <torcontrol.h>
 
 #include <cstdint>

@maflcko
Copy link
Member Author

maflcko commented Mar 4, 2021

Not going to invalidate the precious reviews over an unrelated issue. Fixed in #21358, which can go in first.

@fanquake fanquake merged commit 83bdbbd into bitcoin:master Mar 4, 2021
@maflcko maflcko deleted the 2101-benchNoLog branch March 4, 2021 15:32
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Mar 4, 2021
… and use it in bench

fa576b4 Move MakeNoLogFileContext to common libtest_util, and use it in bench (MarcoFalke)

Pull request description:

  To avoid verbose code duplication, which may lead to accidental mishaps https://github.com/bitcoin/bitcoin/pull/20998/files#r563624041.

  Also fix a nit I found in bitcoin#20946 (comment).

ACKs for top commit:
  dongcarl:
    Light Code-Review ACK fa576b4
  fanquake:
    ACK fa576b4

Tree-SHA512: d39ac9c0957813ebb20ed13bd25a8ef8469377ce2651245638bd761c796feac2a17e30dd16f1e5c8db57737fb918c81d56a3d784c33258275e426a1b11e69eb2
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Aug 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants