-
Notifications
You must be signed in to change notification settings - Fork 37.7k
test: Pass ArgsManager into getarg_tests #18926
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: Pass ArgsManager into getarg_tests #18926
Conversation
2503118
to
af069fc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code review ACK af069fc. This change seems good and is an improvement, but I left a suggestion to use a unique ArgsManager for each test case instead of a shared one.
af069fc
to
a2efd77
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Concept ACK. Thanks for switching the tests away from using gArgs
this could badly interfere with later tests and cause hard to debug run-time issues
Currently gArgs and argsman are aliases for each other, but long term gArgs will be removed from the Setup*Args helpers, to avoid conflicts in how gArgs is used. See bitcoin#18926 and bitcoin#18662 -BEGIN VERIFY SCRIPT- sed -i -e 's/gArgs.Add/argsman.Add/g' ./src/init.cpp -END VERIFY SCRIPT-
45b309d
to
c5ee239
Compare
c5ee239
to
03ca212
Compare
42ba156
to
ff003a6
Compare
This is ready for re-review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost-ACK
…d args manager and put it into the getarg_tests namespace
-BEGIN VERIFY SCRIPT- sed -i 's/\<gArgs\>/m_args/g' src/test/getarg_tests.cpp -END VERIFY SCRIPT-
ff003a6
to
f871f15
Compare
ACK f871f15 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code review ACK f871f15. Changes look good and thanks for updating. In future would recommend using clang-format-diff and following coding style notes, because it's atypical to indent namespace content, or indent protected keywords or put spaces around ::. Also it's fragile to define test setup class in a namespace, but test setup methods outside of the namespace and inside the test fixture instead. Would be simpler to just define the testing setup completely before using it without a namespace like:
bitcoin/src/test/rpc_tests.cpp
Line 23 in 8ad5f1c
class RPCTestingSetup : public TestingSetup |
No need to change anything though, this is already better
If someone want to fix the "namespace issue" in a follow-up, the same should probably be done in the other test case too: #18926 (comment) |
f871f15 scripted-diff: replace gArgs with argsman (glowang) 357f02b Create a local class inherited from BasicTestingSetup with a localized args manager and put it into the getarg_tests namespace (glowang) Pull request description: Replaced the global argsManager gArgs with a locally defined one in getarg_tests. This is to avoid confusion in arg settings between the test's ArgsManager and the bitcoin#18804 ACKs for top commit: MarcoFalke: ACK f871f15 ryanofsky: Code review ACK f871f15. Changes look good and thanks for updating. In future would recommend using clang-format-diff and following [coding style](https://github.com/bitcoin/bitcoin/blob/master/doc/developer-notes.md#coding-style-c) notes, because it's atypical to indent namespace content, or indent protected keywords or put spaces around ::. Also it's fragile to define test setup class in a namespace, but test setup methods outside of the namespace and inside the test fixture instead. Would be simpler to just define the testing setup completely before using it without a namespace like: https://github.com/bitcoin/bitcoin/blob/8ad5f1c376fe99eeccac2696ac0e18e662323a4d/src/test/rpc_tests.cpp#L23 and it would have been a slightly smaller change too. Tree-SHA512: 016594639396d60667fadec8ea80ef7af634fbb2014c704f02406fe3251c5362757c21f1763d8bdb94ca4a3026ab9dc786a92a9a934efc8cd807655d9deee779
… args 8ed9002 refactor: use local argsmanager in CRegTestParams (Ivan Metlushko) 9b20f66 scripted-diff: Replace gArgs with local argsman (Ivan Metlushko) a316e9c refactor: add unused ArgsManager to replace gArgs (Ivan Metlushko) Pull request description: Rationale: reduce use of gArgs to decouple code and simplify future maintenance and easier unit testing. This PR is continuation of work started in #18926 and #18662 It covers only places that register args in ArgsManager with `AddArgs()` or `AddHiddenArgs()`. Closes #19511 ACKs for top commit: MarcoFalke: ACK 8ed9002 👛 Tree-SHA512: 7e6ba8e8357a48833c71e9c3942a769acb3d93bdcc6748a8ef2b7c4461a2499419b60896abf1d8b6bf8e88ee2590284cdd5da64220243ac22375300bcb8fe3e8
Summary: ``` Replaced the global argsManager gArgs with a locally defined one in getarg_tests. This is to avoid confusion in arg settings between the test's ArgsManager and the #18804 ``` Backport of core [[bitcoin/bitcoin#18926 | PR18926]]. This overrides the changes from D4462 which achieved the same goal. Test Plan: ninja check Reviewers: #bitcoin_abc, majcosta Reviewed By: #bitcoin_abc, majcosta Differential Revision: https://reviews.bitcoinabc.org/D8643
Replaced the global argsManager gArgs with a locally defined one in getarg_tests. This is to avoid confusion in arg settings between the test's ArgsManager and the #18804