|
1 | 1 | #!/usr/bin/env python3
|
2 |
| -# Copyright (c) 2022 The Bitcoin Core developers |
| 2 | +# Copyright (c) 2022-present The Bitcoin Core developers |
3 | 3 | # Distributed under the MIT software license, see the accompanying
|
4 | 4 | # file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
5 | 5 |
|
|
15 | 15 | pass
|
16 | 16 | from test_framework.messages import COIN
|
17 | 17 | from test_framework.test_framework import BitcoinTestFramework
|
18 |
| -from test_framework.util import assert_equal |
| 18 | +from test_framework.util import ( |
| 19 | + assert_equal, |
| 20 | + bpf_cflags, |
| 21 | +) |
19 | 22 | from test_framework.wallet import MiniWallet
|
20 | 23 |
|
21 | 24 | utxocache_changes_program = """
|
@@ -175,7 +178,7 @@ def test_uncache(self):
|
175 | 178 | ctx = USDT(pid=self.nodes[0].process.pid)
|
176 | 179 | ctx.enable_probe(probe="utxocache:uncache",
|
177 | 180 | fn_name="trace_utxocache_uncache")
|
178 |
| - bpf = BPF(text=utxocache_changes_program, usdt_contexts=[ctx], debug=0, cflags=["-Wno-error=implicit-function-declaration"]) |
| 181 | + bpf = BPF(text=utxocache_changes_program, usdt_contexts=[ctx], debug=0, cflags=bpf_cflags()) |
179 | 182 |
|
180 | 183 | # The handle_* function is a ctypes callback function called from C. When
|
181 | 184 | # we assert in the handle_* function, the AssertError doesn't propagate
|
@@ -244,7 +247,7 @@ def test_add_spent(self):
|
244 | 247 | ctx.enable_probe(probe="utxocache:add", fn_name="trace_utxocache_add")
|
245 | 248 | ctx.enable_probe(probe="utxocache:spent",
|
246 | 249 | fn_name="trace_utxocache_spent")
|
247 |
| - bpf = BPF(text=utxocache_changes_program, usdt_contexts=[ctx], debug=0, cflags=["-Wno-error=implicit-function-declaration"]) |
| 250 | + bpf = BPF(text=utxocache_changes_program, usdt_contexts=[ctx], debug=0, cflags=bpf_cflags()) |
248 | 251 |
|
249 | 252 | # The handle_* function is a ctypes callback function called from C. When
|
250 | 253 | # we assert in the handle_* function, the AssertError doesn't propagate
|
@@ -333,7 +336,7 @@ def test_flush(self):
|
333 | 336 | ctx = USDT(pid=self.nodes[0].process.pid)
|
334 | 337 | ctx.enable_probe(probe="utxocache:flush",
|
335 | 338 | fn_name="trace_utxocache_flush")
|
336 |
| - bpf = BPF(text=utxocache_flushes_program, usdt_contexts=[ctx], debug=0, cflags=["-Wno-error=implicit-function-declaration"]) |
| 339 | + bpf = BPF(text=utxocache_flushes_program, usdt_contexts=[ctx], debug=0, cflags=bpf_cflags()) |
337 | 340 |
|
338 | 341 | # The handle_* function is a ctypes callback function called from C. When
|
339 | 342 | # we assert in the handle_* function, the AssertError doesn't propagate
|
@@ -390,7 +393,7 @@ def handle_utxocache_flush(_, data, __):
|
390 | 393 | ctx = USDT(pid=self.nodes[0].process.pid)
|
391 | 394 | ctx.enable_probe(probe="utxocache:flush",
|
392 | 395 | fn_name="trace_utxocache_flush")
|
393 |
| - bpf = BPF(text=utxocache_flushes_program, usdt_contexts=[ctx], debug=0, cflags=["-Wno-error=implicit-function-declaration"]) |
| 396 | + bpf = BPF(text=utxocache_flushes_program, usdt_contexts=[ctx], debug=0, cflags=bpf_cflags()) |
394 | 397 | bpf["utxocache_flush"].open_perf_buffer(handle_utxocache_flush)
|
395 | 398 |
|
396 | 399 | self.log.info(f"prune blockchain to trigger a flush for pruning")
|
|
0 commit comments