diff options
author | 0xb10c <0xb10c@gmail.com> | 2022-07-01 13:08:49 +0200 |
---|---|---|
committer | 0xb10c <0xb10c@gmail.com> | 2022-07-02 14:37:29 +0200 |
commit | 220a5a2841172a07d6d7849596316f0e0933e272 (patch) | |
tree | efe8740f871ae1c0291f5790e9b459c7bdab0174 | |
parent | 4129c1375430dbfe8dd414868c43fceb3d091fc3 (diff) | |
download | bitcoin-220a5a2841172a07d6d7849596316f0e0933e272.tar.xz |
test: hook into PID in tracing tests
This makes sure to NOT hook into other bitcoind binaries run in
paralell in the test framework. We only want to trace the intended
binary.
In interface_usdt_utxocache.py:
While testing the utxocache flush with pruning, bitcoind is
restarted and we need to hook into the new PID again.
-rwxr-xr-x | test/functional/interface_usdt_net.py | 2 | ||||
-rwxr-xr-x | test/functional/interface_usdt_utxocache.py | 15 | ||||
-rwxr-xr-x | test/functional/interface_usdt_validation.py | 2 |
3 files changed, 14 insertions, 5 deletions
diff --git a/test/functional/interface_usdt_net.py b/test/functional/interface_usdt_net.py index 9522cd8c59..2235da702b 100755 --- a/test/functional/interface_usdt_net.py +++ b/test/functional/interface_usdt_net.py @@ -109,7 +109,7 @@ class NetTracepointTest(BitcoinTestFramework): self.log.info( "hook into the net:inbound_message and net:outbound_message tracepoints") - ctx = USDT(path=str(self.options.bitcoind)) + ctx = USDT(pid=self.nodes[0].process.pid) ctx.enable_probe(probe="net:inbound_message", fn_name="trace_inbound_message") ctx.enable_probe(probe="net:outbound_message", diff --git a/test/functional/interface_usdt_utxocache.py b/test/functional/interface_usdt_utxocache.py index f48ff9699d..61587197ef 100755 --- a/test/functional/interface_usdt_utxocache.py +++ b/test/functional/interface_usdt_utxocache.py @@ -173,7 +173,7 @@ class UTXOCacheTracepointTest(BitcoinTestFramework): invalid_tx.vin[0].prevout.hash = int(block_1_coinbase_txid, 16) self.log.info("hooking into the utxocache:uncache tracepoint") - ctx = USDT(path=str(self.options.bitcoind)) + ctx = USDT(pid=self.nodes[0].process.pid) ctx.enable_probe(probe="utxocache:uncache", fn_name="trace_utxocache_uncache") bpf = BPF(text=utxocache_changes_program, usdt_contexts=[ctx], debug=0) @@ -238,7 +238,7 @@ class UTXOCacheTracepointTest(BitcoinTestFramework): self.log.info( "hook into the utxocache:add and utxocache:spent tracepoints") - ctx = USDT(path=str(self.options.bitcoind)) + ctx = USDT(pid=self.nodes[0].process.pid) ctx.enable_probe(probe="utxocache:add", fn_name="trace_utxocache_add") ctx.enable_probe(probe="utxocache:spent", fn_name="trace_utxocache_spent") @@ -334,7 +334,7 @@ class UTXOCacheTracepointTest(BitcoinTestFramework): self.log.info("test the utxocache:flush tracepoint API") self.log.info("hook into the utxocache:flush tracepoint") - ctx = USDT(path=str(self.options.bitcoind)) + ctx = USDT(pid=self.nodes[0].process.pid) ctx.enable_probe(probe="utxocache:flush", fn_name="trace_utxocache_flush") bpf = BPF(text=utxocache_flushes_program, usdt_contexts=[ctx], debug=0) @@ -373,6 +373,7 @@ class UTXOCacheTracepointTest(BitcoinTestFramework): self.stop_node(0) bpf.perf_buffer_poll(timeout=200) + bpf.cleanup() self.log.info("check that we don't expect additional flushes") assert_equal(0, len(expected_flushes)) @@ -381,6 +382,14 @@ class UTXOCacheTracepointTest(BitcoinTestFramework): self.log.info("restart the node with -prune") self.start_node(0, ["-fastprune=1", "-prune=1"]) + self.log.info("test the utxocache:flush tracepoint API with pruning") + self.log.info("hook into the utxocache:flush tracepoint") + ctx = USDT(pid=self.nodes[0].process.pid) + ctx.enable_probe(probe="utxocache:flush", + fn_name="trace_utxocache_flush") + bpf = BPF(text=utxocache_flushes_program, usdt_contexts=[ctx], debug=0) + bpf["utxocache_flush"].open_perf_buffer(handle_utxocache_flush) + BLOCKS_TO_MINE = 350 self.log.info(f"mine {BLOCKS_TO_MINE} blocks to be able to prune") self.generate(self.wallet, BLOCKS_TO_MINE) diff --git a/test/functional/interface_usdt_validation.py b/test/functional/interface_usdt_validation.py index d11809273b..fb1a91b914 100755 --- a/test/functional/interface_usdt_validation.py +++ b/test/functional/interface_usdt_validation.py @@ -94,7 +94,7 @@ class ValidationTracepointTest(BitcoinTestFramework): expected_blocks = list() self.log.info("hook into the validation:block_connected tracepoint") - ctx = USDT(path=str(self.options.bitcoind)) + ctx = USDT(pid=self.nodes[0].process.pid) ctx.enable_probe(probe="validation:block_connected", fn_name="trace_block_connected") bpf = BPF(text=validation_blockconnected_program, |