-
Notifications
You must be signed in to change notification settings - Fork 36.3k
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
add rpc_misc.py, mv test getmemoryinfo, add test mallocinfo #15485
Conversation
utACK 2e957b6 Good to split up the overly large |
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.
Oops, one assert issue I missed
2e957b6
to
8032a97
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.
Looks great. Thanks for doing this.
You'll need to update the file mode bits so this is executable. Run chmod 755 rpc_misc.py
, then commit the file and push.
I've left some style nits inline. Up to you whether you take them or not.
8032a97
to
2fa85eb
Compare
re-utACK 2fa85eb |
ACK 2fa85eb. Nice work! |
Concept ACK What an excellent first-time contribution! Hope I'll see more contributions from you going forward! :-) |
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Coverage
Updated at: 2019-02-26T21:19:47.481840. |
test/functional/rpc_misc.py
Outdated
assert_greater_than(memory['used'], 0) | ||
assert_greater_than(memory['free'], 0) | ||
assert_greater_than(memory['total'], 0) | ||
assert_greater_than(memory['locked'], 0) |
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.
This fails on appveyor:
AssertionError: 0 <= 0
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.
See assert_greater_than_or_equal()
# Distributed under the MIT software license, see the accompanying | ||
# file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||
"""Test RPC misc output.""" | ||
import xml.etree.ElementTree as ET |
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.
Worth being aware of regarding the security of xml.etree.ElementTree
:
Warning The xml.etree.ElementTree module is not secure against maliciously constructed data. If you need to parse untrusted or unauthenticated data see XML vulnerabilities.
We'll only be parsing trusted data from what I can think of, so likely not a problem in the testing code :-)
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.
Thanks for flagging @practicalswift. I was looking for other examples of xml libraries and this precedent that I tried to follow.
…info f13ad1c modify test for memory locked in case locking pages failed at some point (Adam Jonas) 2fa85eb add rpc_misc.py, mv test getmemoryinfo, add test mallocinfo (Adam Jonas) Pull request description: Creating the `rpc_misc.py` functional test file to add space for adding tests to a file that doesn't have a lot of coverage. - Removing the `getmemoryinfo()` smoke test from wallet basic rather than moving it to keep the wallet decoupled. Feel like testing for reasonable memory allocation values should suffice. - Adding coverage for `mallocinfo()`. Introduced standard lib XML parser since the function exports an XML string that describes the current state of the memory-allocation implementation in the caller. Tree-SHA512: ced30115622916c88d1e729969ee331272ec9f2881eb36dee4bb7331bf633a6810a57fed63a0cfaf86de698edb5162e6a035efd07c89ece1df56b69d61288072
…info Summary: f13ad1cae0 modify test for memory locked in case locking pages failed at some point (Adam Jonas) 2fa85ebd1c add rpc_misc.py, mv test getmemoryinfo, add test mallocinfo (Adam Jonas) Pull request description: Creating the `rpc_misc.py` functional test file to add space for adding tests to a file that doesn't have a lot of coverage. - Removing the `getmemoryinfo()` smoke test from wallet basic rather than moving it to keep the wallet decoupled. Feel like testing for reasonable memory allocation values should suffice. - Adding coverage for `mallocinfo()`. Introduced standard lib XML parser since the function exports an XML string that describes the current state of the memory-allocation implementation in the caller. Tree-SHA512: ced30115622916c88d1e729969ee331272ec9f2881eb36dee4bb7331bf633a6810a57fed63a0cfaf86de698edb5162e6a035efd07c89ece1df56b69d61288072 Backport of Core [[bitcoin/bitcoin#15485 | PR15485]] Test Plan: ninja check-functional Verify `rpc_misc.py` is run and passes. Reviewers: O1 Bitcoin ABC, #bitcoin_abc, deadalnix Reviewed By: O1 Bitcoin ABC, #bitcoin_abc, deadalnix Differential Revision: https://reviews.bitcoinabc.org/D5626
…info Summary: f13ad1cae0 modify test for memory locked in case locking pages failed at some point (Adam Jonas) 2fa85ebd1c add rpc_misc.py, mv test getmemoryinfo, add test mallocinfo (Adam Jonas) Pull request description: Creating the `rpc_misc.py` functional test file to add space for adding tests to a file that doesn't have a lot of coverage. - Removing the `getmemoryinfo()` smoke test from wallet basic rather than moving it to keep the wallet decoupled. Feel like testing for reasonable memory allocation values should suffice. - Adding coverage for `mallocinfo()`. Introduced standard lib XML parser since the function exports an XML string that describes the current state of the memory-allocation implementation in the caller. Tree-SHA512: ced30115622916c88d1e729969ee331272ec9f2881eb36dee4bb7331bf633a6810a57fed63a0cfaf86de698edb5162e6a035efd07c89ece1df56b69d61288072 Backport of Core [[bitcoin/bitcoin#15485 | PR15485]] Test Plan: ninja check-functional Verify `rpc_misc.py` is run and passes. Reviewers: O1 Bitcoin ABC, #bitcoin_abc, deadalnix Reviewed By: O1 Bitcoin ABC, #bitcoin_abc, deadalnix Differential Revision: https://reviews.bitcoinabc.org/D5626
… mallocinfo f13ad1c modify test for memory locked in case locking pages failed at some point (Adam Jonas) 2fa85eb add rpc_misc.py, mv test getmemoryinfo, add test mallocinfo (Adam Jonas) Pull request description: Creating the `rpc_misc.py` functional test file to add space for adding tests to a file that doesn't have a lot of coverage. - Removing the `getmemoryinfo()` smoke test from wallet basic rather than moving it to keep the wallet decoupled. Feel like testing for reasonable memory allocation values should suffice. - Adding coverage for `mallocinfo()`. Introduced standard lib XML parser since the function exports an XML string that describes the current state of the memory-allocation implementation in the caller. Tree-SHA512: ced30115622916c88d1e729969ee331272ec9f2881eb36dee4bb7331bf633a6810a57fed63a0cfaf86de698edb5162e6a035efd07c89ece1df56b69d61288072
Creating the
rpc_misc.py
functional test file to add space for adding tests to a file that doesn't have a lot of coverage.getmemoryinfo()
smoke test from wallet basic rather than moving it to keep the wallet decoupled. Feel like testing for reasonable memory allocation values should suffice.mallocinfo()
. Introduced standard lib XML parser since the function exports an XML string that describes the current state of the memory-allocation implementation in the caller.