Skip to content

Conversation

@adamjonas
Copy link
Member

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.

@maflcko
Copy link
Member

maflcko commented Feb 26, 2019

utACK 2e957b6ccaa41d13190bc5197865979f5f5265bf

Good to split up the overly large wallet_basic tests into independent tests, that are easier to debug in case of failure.

Copy link
Member

@maflcko maflcko left a 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

Copy link
Contributor

@jnewbery jnewbery left a 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.

@maflcko
Copy link
Member

maflcko commented Feb 26, 2019

re-utACK 2fa85eb

@jnewbery
Copy link
Contributor

ACK 2fa85eb. Nice work!

@practicalswift
Copy link
Contributor

Concept ACK

What an excellent first-time contribution! Hope I'll see more contributions from you going forward! :-)

@DrahtBot
Copy link
Contributor

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Coverage

Coverage Change (pull 15485, 26ffd3c77fd871825d20a2cdd07528770b04dacd) Reference (master, d88f7f8)
Lines +0.0231 % 87.3445 %
Functions +0.0147 % 84.7625 %
Branches +0.0069 % 51.4908 %

Updated at: 2019-02-26T21:19:47.481840.

@fanquake fanquake added the Tests label Feb 26, 2019
assert_greater_than(memory['used'], 0)
assert_greater_than(memory['free'], 0)
assert_greater_than(memory['total'], 0)
assert_greater_than(memory['locked'], 0)
Copy link
Member

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

Copy link
Contributor

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
Copy link
Contributor

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 :-)

Copy link
Member Author

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.

@maflcko maflcko merged commit f13ad1c into bitcoin:master Mar 1, 2019
maflcko pushed a commit that referenced this pull request Mar 1, 2019
…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
@adamjonas adamjonas deleted the test_rpc_misc branch October 21, 2019 19:46
deadalnix pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Mar 31, 2020
…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
ftrader pushed a commit to bitcoin-cash-node/bitcoin-cash-node that referenced this pull request Aug 17, 2020
…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
PastaPastaPasta added a commit to dashpay/dash that referenced this pull request Sep 16, 2021
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Dec 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants