-
Notifications
You must be signed in to change notification settings - Fork 38.8k
qa: Functional test improvements #30463
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
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code CoverageFor detailed information about the code coverage, see the test coverage report. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update. ConflictsReviewers, 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. |
|
The first commit could be split up as a scripted-diff? Also, formatting: diff --git a/test/functional/interface_http.py b/test/functional/interface_http.py
index 567aa33cbe..dbdceb52d1 100755
--- a/test/functional/interface_http.py
+++ b/test/functional/interface_http.py
@@ -109 +109 @@ if __name__ == '__main__':
- HTTPBasicsTest(__file__).main ()
+ HTTPBasicsTest(__file__).main()
--
diff --git a/test/functional/rpc_getchaintips.py b/test/functional/rpc_getchaintips.py
index 65a9583c22..1bd4413ce1 100755
--- a/test/functional/rpc_getchaintips.py
+++ b/test/functional/rpc_getchaintips.py
@@ -61 +61 @@ if __name__ == '__main__':
- GetChainTipsTest(__file__).main ()
+ GetChainTipsTest(__file__).main() |
-BEGIN VERIFY SCRIPT- sed -i -e 's/\s*().main\s*()/(__file__).main()/' $(git ls-files test/functional/*.py) sed -i -e 's/def __init__(self)/def __init__(self, test_file)/' test/functional/test_framework/test_framework.py -END VERIFY SCRIPT-
In CMake-based build system (1) `config.ini` is created in the build directory, and (2) `cache` must also be created in the same directory. This change enables running individual functional tests from the build directory.
Thanks! Implemented. |
I don't think this is true. This is a bugfix. Previously one could not run the tests in the autotools out-of-source build dir: After this fix, it is possible.
|
|
Concept ACK on the behavior changes and the bugfix, but please properly describe the changes. |
That's true. But I did not consider this case as it requires a manual creation of a symlink to a test, which Autottols do not do, but CMake does. |
|
In any case, creating the symlinks seems like a good way to test this, no? |
|
Tested with the steps I provided. tested ACK a8e3af1 🎨 Show signatureSignature: |
Sure thing. The PR description has been updated. |
|
Friendly ping @stickies-v :) |
stickies-v
left a comment
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 a8e3af1
I'm able to run individual tests from an out-of-source build with the instructions provided. I tried running a bunch of other tests than wallet_disable too, including all the ones that reference __file__ and those seem to work fine too.
|
Discussions are resolved and this seems rfm with two reviews? |
|
ACK a8e3af1, tested with the steps in op |
…#30463) bd7ce05 test: fix `TestShell` initialization (late follow-up for #30463) (Sebastian Falbesoner) Pull request description: Creating a `TestShell` instance as stated in the [docs](https://github.com/bitcoin/bitcoin/blob/master/test/functional/test-shell.md) currently fails on master: ``` $ python3 Python 3.10.13 (main, Mar 15 2024, 07:36:23) [Clang 16.0.6 ] on openbsd7 Type "help", "copyright", "credits" or "license" for more information. >>> import sys >>> sys.path.insert(0, "/home/thestack/bitcoin/test/functional") >>> from test_framework.test_shell import TestShell >>> test = TestShell().setup(num_nodes=2, setup_clean_chain=True) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/thestack/bitcoin/test/functional/test_framework/test_shell.py", line 70, in __new__ TestShell.instance = TestShell.__TestShell() TypeError: BitcoinTestFramework.__init__() missing 1 required positional argument: 'test_file' ``` Since #30463, BitcoinTestFramework instances expect the path of the calling test at construction, in order to find shared data like the configuration (config.ini) and the cache. Note that in contrast to actual functional tests, we can't simply pass `__file__` here, as the test shell module sits within the `test_framework` subfolder, so we have to navigate up to the parent directory and append some dummy test file name. On the long-term we should probably add some TestShell instantation smoke-test to detect issues like this early. As I'm not too familiar with the CI I'm not sure what is a good way to achieve this (a functional test obviously can't be used, as that's already a BitcoinTestFramework test in itself), but happy to take suggestions. ACKs for top commit: ismaelsadeeq: Tested ACK bd7ce05 danielabrozzoni: tACK bd7ce05 brunoerg: ACK bd7ce05 Tree-SHA512: c3a2365e2cda48a233ee724673c490787981354914f33e10eadbbad9c68e8403d84c5551229a611401e743886539de380ba4bfcb77032b6c85731e3bbe962dc1
Github-Pull: bitcoin#30714 Rebased-From: bd7ce05
b2a1379 depends: build libevent with -D_GNU_SOURCE (fanquake) 199bb09 test: fixing failing system_tests/run_command under some Locales (Jadi) 342baab test: Avoid intermittent timeout in p2p_headers_sync_with_minchainwork.py (MarcoFalke) 5577d5a test: fix `TestShell` initialization (late follow-up for #30463) (Sebastian Falbesoner) Pull request description: Backports: * #30714 * #30743 * #30761 * #30788 ACKs for top commit: willcl-ark: ACK b2a1379 achow101: ACK b2a1379 stickies-v: ACK b2a1379 Tree-SHA512: bf08ac0c613395def974a1b287345d4a64edc066c14f8c9f0184478b0e33e48333760eeb6e96b6b5fbafbb21b40d01875e3f526213a2734e226b2e111d71f3a3
This PR includes changes split from #30454. They improve the functional test framework, allowing users to run individual functional tests from the build directory in the new CMake-based build system.
This functionality is not available for out-of-source builds using the current Autotools-based build system, which always requires write permissions for the source directory. Nevertheless, this PR can be tested as suggested in #30463 (comment):
The last command fails on the master branch:
and succeeds with this PR.