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 |
jonatack
left a comment
There was a problem hiding this comment.
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.
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.
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 |
|
reACK 4d4dca4 only change since my last review is the addition of a comment for the added test |
shaavan
left a comment
There was a problem hiding this comment.
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 #568 were reverted.
- I also like the comments added along with the changes done in #568. These help the code reader understand the reasoning behind writing the code the way it is written.
|
Unfortunately, the |
, merge bitcoin-core/gui#408, #398, #434, #439, #319, #404, #569, #576, #618, #620, #631, #591, partial bitcoin#23757 (qt backports: part 3) 0cb2724 merge bitcoin-core/gui#591: Add tests for `tableView` in `AddressBookPage` dialog (Kittywhiskers Van Gogh) 6bf4854 partial bitcoin#23757: fix GUI not loading on Qt 5.15 (Kittywhiskers Van Gogh) 75a1016 merge bitcoin-core/gui#631: Disallow encryption of watchonly wallets (Kittywhiskers Van Gogh) 18d1523 merge bitcoin-core/gui#620: Replace `QRegExp` with `QRegularExpression` (Kittywhiskers Van Gogh) 6e4eee0 merge bitcoin-core/gui#618: Add `transactionoverviewwidget.cpp` source file (Kittywhiskers Van Gogh) b25f165 merge bitcoin-core/gui#576: Add qt unit test runner summary (Kittywhiskers Van Gogh) aec2927 merge bitcoin-core/gui#569: add regression test for bitcoin-core/gui#567 (Kittywhiskers Van Gogh) f9b7614 merge bitcoin#24498: Avoid crash on startup if int specified in settings.json (Kittywhiskers Van Gogh) 40b09dd merge bitcoin#24375: Do not use `LocalTestingSetup` in getarg_tests test file (Kittywhiskers Van Gogh) 817a95a merge bitcoin#24041: Restore GetIntArg saturating behavior (Kittywhiskers Van Gogh) d451246 merge bitcoin-core/gui#404: Fix various edge case bugs in QValidatedLineEdit (Kittywhiskers Van Gogh) c02483c merge bitcoin-core/gui#319: Paste button in Open URI dialog (Kittywhiskers Van Gogh) 3db335f merge bitcoin-core/gui#439: Do not show unused widgets at startup (Kittywhiskers Van Gogh) 33da874 merge bitcoin-core/gui#434: Keep InitExecutor in main gui thread (Kittywhiskers Van Gogh) 3f9dca5 merge bitcoin-core/gui#398: Pass WalletModel object to the WalletView constructor (Kittywhiskers Van Gogh) 9e58f8c merge bitcoin-core/gui#408: Add missing mnemonics in menu bar options (Kittywhiskers Van Gogh) Pull request description: ## Additional Information | `develop` (0972dfe) | This PR | | ------------------------------------------------------------ | ------------------------------------------------------------ | |  |  | |  |  | ## Breaking Changes * The menu bar mnemonic (highlighted in **bold**) for "Open wallet **c**onfiguration file" has been reassigned to "Load PSBT from **c**lipboard…". The replacement mnemonic is "Open **w**allet configuration file". ## Checklist - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas **(note: N/A)** - [x] I have added or updated relevant unit/integration/functional/e2e tests - [x] I have made corresponding changes to the documentation **(note: N/A)** - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_ ACKs for top commit: UdjinM6: re-utACK 0cb2724 PastaPastaPasta: utACK 0cb2724 Tree-SHA512: 8039d4a8676b3f680f3aab63a22e2412794a7744440139111377915891597c98d1a68d9ceccecec4afb3e87fff4e1a023565f469de0f205cf764b9666342ccd1
Add a test that would fail, should #567 resurface.
Also, add a comment and dedup a long expression.