aboutsummaryrefslogtreecommitdiff
path: root/test/functional/interface_usdt_validation.py
diff options
context:
space:
mode:
authorfanquake <fanquake@gmail.com>2023-09-10 14:06:17 +0100
committerfanquake <fanquake@gmail.com>2023-09-10 14:10:16 +0100
commitc5a63ea56f8347139bd84e1669b378ecfb234c3c (patch)
treebcff7efe1e14c318f23b7575ce150c538ed012e9 /test/functional/interface_usdt_validation.py
parente25af11225d9d94ecf7068bf7a9a359268786fbe (diff)
parent9f55773a370a0d039e727445ccee6b84e05f562a (diff)
Merge bitcoin/bitcoin#27944: test: various USDT functional test cleanups (27831 follow-ups)
9f55773a370a0d039e727445ccee6b84e05f562a test: refactor: usdt_mempool: store all events (stickies-v) bc432704505eb165dd86de39ea3434c6fb7a2514 test: refactor: remove unnecessary nonlocal (stickies-v) 326db63a6819813db55ba0d01ab4fe80f7a0d818 test: log sanity check assertion failures (stickies-v) f5525ad6808df6afc38e5c6e4767ab577e30629c test: store utxocache events (stickies-v) f1b99ac94fb77340c4d3a5b4bbc3df28009bc773 test: refactor: deduplicate handle_utxocache_* logic (stickies-v) ad90ba36bd930f00753643cd1fe0af72d1c828c2 test: refactor: rename inbound to is_inbound (stickies-v) afc0224cdbe73e326addf5fb98a3e95d941f2104 test: refactor: remove unnecessary blocks_checked counter (stickies-v) Pull request description: Various cleanups to the USDT functional tests, largely (but not exclusively) follow-ups to https://github.com/bitcoin/bitcoin/pull/27831#pullrequestreview-1491438045. Except for slightly different logging behaviour in "test: store utxocache events" and "test: log sanity check assertion failures", this is a refactor PR, removing unnecessary code and (imo) making it more readable and maintainable. The rationale for each change is in the corresponding commit message. Note: except for "test: store utxocache events" (which relies on its parent, and I separated into two commits because we may want the parent but not the child), all commits are stand-alone and I'm okay with dropping one/multiple commits if they turn out to be controversial or undesired. ACKs for top commit: 0xB10C: ACK 9f55773a370a0d039e727445ccee6b84e05f562a. Reviewed the code and ran the USDT interface tests. I stepped through the commits and think all changes are reasonable. Tree-SHA512: 6c37a0265b6c26d4f9552a056a690b8f86f7304bd33b4419febd8b17369cf6af799cb87c16df35d0c2a1b839ad31de24661d4384eafa88816c2051c522fd3bf5
Diffstat (limited to 'test/functional/interface_usdt_validation.py')
-rwxr-xr-xtest/functional/interface_usdt_validation.py5
1 files changed, 1 insertions, 4 deletions
diff --git a/test/functional/interface_usdt_validation.py b/test/functional/interface_usdt_validation.py
index f9d9b525cd..e29b2c46eb 100755
--- a/test/functional/interface_usdt_validation.py
+++ b/test/functional/interface_usdt_validation.py
@@ -86,7 +86,6 @@ class ValidationTracepointTest(BitcoinTestFramework):
self.duration)
BLOCKS_EXPECTED = 2
- blocks_checked = 0
expected_blocks = dict()
events = []
@@ -98,11 +97,9 @@ class ValidationTracepointTest(BitcoinTestFramework):
usdt_contexts=[ctx], debug=0)
def handle_blockconnected(_, data, __):
- nonlocal events, blocks_checked
event = ctypes.cast(data, ctypes.POINTER(Block)).contents
self.log.info(f"handle_blockconnected(): {event}")
events.append(event)
- blocks_checked += 1
bpf["block_connected"].open_perf_buffer(
handle_blockconnected)
@@ -127,7 +124,7 @@ class ValidationTracepointTest(BitcoinTestFramework):
# only plausibility checks
assert event.duration > 0
del expected_blocks[block_hash]
- assert_equal(BLOCKS_EXPECTED, blocks_checked)
+ assert_equal(BLOCKS_EXPECTED, len(events))
assert_equal(0, len(expected_blocks))
bpf.cleanup()