Skip to content
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

Merged
merged 2 commits into from Mar 1, 2019

Conversation

@adamjonas
Copy link
Member

@adamjonas adamjonas commented Feb 26, 2019

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.
@MarcoFalke
Copy link
Member

@MarcoFalke MarcoFalke commented Feb 26, 2019

utACK 2e957b6

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

@MarcoFalke MarcoFalke left a comment

Oops, one assert issue I missed

test/functional/rpc_misc.py Outdated Show resolved Hide resolved
test/functional/rpc_misc.py Outdated Show resolved Hide resolved
Copy link
Member

@jnewbery jnewbery left a comment

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.

test/functional/rpc_misc.py Outdated Show resolved Hide resolved
test/functional/rpc_misc.py Outdated Show resolved Hide resolved
test/functional/rpc_misc.py Outdated Show resolved Hide resolved
test/functional/rpc_misc.py Outdated Show resolved Hide resolved
@MarcoFalke
Copy link
Member

@MarcoFalke MarcoFalke commented Feb 26, 2019

re-utACK 2fa85eb

@jnewbery
Copy link
Member

@jnewbery jnewbery commented Feb 26, 2019

ACK 2fa85eb. Nice work!

@practicalswift
Copy link
Contributor

@practicalswift practicalswift commented Feb 26, 2019

Concept ACK

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

@DrahtBot
Copy link
Contributor

@DrahtBot DrahtBot commented Feb 26, 2019

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

Coverage

Coverage Change (pull 15485, 26ffd3c) 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

@MarcoFalke MarcoFalke Feb 28, 2019

This fails on appveyor:

                                   AssertionError: 0 <= 0

Copy link
Member

@jnewbery jnewbery Feb 28, 2019

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

@practicalswift practicalswift Feb 28, 2019

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

@adamjonas adamjonas Mar 1, 2019

Thanks for flagging @practicalswift. I was looking for other examples of xml libraries and this precedent that I tried to follow.

@MarcoFalke MarcoFalke merged commit f13ad1c into bitcoin:master Mar 1, 2019
2 checks passed
MarcoFalke added a commit that referenced this issue 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 Oct 21, 2019
deadalnix pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this issue 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 added a commit to bitcoin-cash-node/bitcoin-cash-node that referenced this issue 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
ogabrielides added a commit to ogabrielides/dash that referenced this issue Sep 14, 2021
ogabrielides added a commit to ogabrielides/dash that referenced this issue Sep 15, 2021
ogabrielides added a commit to ogabrielides/dash that referenced this issue Sep 15, 2021
ogabrielides added a commit to ogabrielides/dash that referenced this issue Sep 16, 2021
… 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

6 participants