-
Notifications
You must be signed in to change notification settings - Fork 267
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: add regression test for #567 #569
Conversation
How to test this: Find your own way. Don't let me misguide you. don't click here
--- i/src/qt/optionsmodel.cpp
+++ w/src/qt/optionsmodel.cpp
@@ -168,13 +168,13 @@ void OptionsModel::Init(bool resetSettings)
//
// OptionsModel::Init()
// this method, can flip -listen from 1 to 0 if fListen=false
//
// AppInitParameterInteraction()
// error if -listen=0 and -listenonion=1
- gArgs.SoftSetBoolArg("-listenonion", false);
+ //gArgs.SoftSetBoolArg("-listenonion", false);
}
if (!settings.contains("server")) {
settings.setValue("server", false);
}
if (!gArgs.SoftSetBoolArg("-server", settings.value("server").toBool())) { and observe the test failing:
--- i/src/qt/test/optiontests.cpp
+++ w/src/qt/test/optiontests.cpp
@@ -47,14 +47,14 @@ void OptionTests::parametersInteraction()
const bool expected{false};
QVERIFY(gArgs.IsArgSet("-listen"));
QCOMPARE(gArgs.GetBoolArg("-listen", !expected), expected);
- QVERIFY(gArgs.IsArgSet("-listenonion"));
- QCOMPARE(gArgs.GetBoolArg("-listenonion", !expected), expected);
+ //QVERIFY(gArgs.IsArgSet("-listenonion"));
+ //QCOMPARE(gArgs.GetBoolArg("-listenonion", !expected), expected);
QVERIFY(AppInitParameterInteraction(gArgs));
// cleanup
settings.remove("fListen");
QVERIFY(!settings.contains("fListen")); and observe the second check failing:
|
Concept ACK |
I am puzzled why on
While on my computer and on 😕 |
Thank you for following up with this! 🥳
This is mysterious, but actually less mysterious than it appears at first, because of a terrible error message on the following line that checks if one directory exists ( Lines 828 to 829 in f4e5d70
I think this error just happens if tests run in a different order, and I would try adding a |
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.
ACK cb018e7 modulo the macOS CI
Note that reverting #568 and running ./src/qt/test/test_bitcoin-qt
also prints a couple of Error: Cannot set -listen=0 together with -listenonion=1
messages in the RPCNestedTests and WalletTests output, though the tests don't fail outright.
I could be missing a command line argument to do this, but added the following to make it easier to see if any test failures happened:
--- a/src/qt/test/test_main.cpp
+++ b/src/qt/test/test_main.cpp
@@ -112,6 +112,10 @@ int main(int argc, char* argv[])
fInvalid = true;
}
#endif
+ if (fInvalid) {
+ qWarning("\nThere were errors in some of the tests above.\n");
+ } else {
+ qDebug("\nAll tests executed successfully.\n");
+ }
gArgs.LockSettings([&](util::Settings& s) { | ||
s.forced_settings.erase("listen"); | ||
s.forced_settings.erase("listenonion"); | ||
}); |
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.
Added asserts here as a sanity check, maybe good to add in case the defaults in test_main.cpp
change.
void OptionTests::parametersInteraction()
{
+ QVERIFY(gArgs.IsArgSet("-listen"));
+ QVERIFY(gArgs.IsArgSet("-listenonion"));
gArgs.LockSettings([&](util::Settings& s) {
s.forced_settings.erase("listen");
s.forced_settings.erase("listenonion");
}
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.
The test unsets those options, so it does not care or rely that they are set when it starts. Thus I think those checks are not necessary. I.e. the test will still work even if those options are not set when it starts.
A followup to bitcoin-core#568 Co-authored-by: Jon Atack <[email protected]>
Invalidates ACK from @jonatack Thanks for the suggestion, @ryanofsky! I added just @jonatack I look up the exit status of the test executable ( |
ACK cae12fc provided the CI is happy |
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.
reACK 4d4dca4 only change since my last review is the addition of a comment for the added test |
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.
ACK 4d4dca4
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.
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.
ACK 4d4dca4
- The added test seems logically sound and is written in a very easy-to-understand manner.
- I was able to verify that:
- The test ran successfully on the PR branch.
- The test failed when the changes done in options: flip listenonion to false if not listening #568 were reverted.
- I also like the comments added along with the changes done in options: flip listenonion to false if not listening #568. These help the code reader understand the reasoning behind writing the code the way it is written.
Unfortunately, the
|
Add a test that would fail, should #567 resurface.
Also, add a comment and dedup a long expression.