scripted-diff: Use bpf_cflags

-BEGIN VERIFY SCRIPT-

 ren() { sed --regexp-extended -i "s/$1/$2/g" $( git grep --extended-regexp -l "$1" ) ; }

 ren 'cflags=\["-Wno-error=implicit-function-declaration"\]' 'cflags=bpf_cflags()'

-END VERIFY SCRIPT-

Github-Pull: #32336
Rebased-From: facb9b327b
This commit is contained in:
MarcoFalke
2025-04-24 10:26:11 +02:00
committed by fanquake
parent 4ed5c34abb
commit 3665310808
5 changed files with 16 additions and 16 deletions

View File

@@ -176,7 +176,7 @@ class CoinSelectionTracepointTest(BitcoinTestFramework):
ctx.enable_probe(probe="coin_selection:normal_create_tx_internal", fn_name="trace_normal_create_tx")
ctx.enable_probe(probe="coin_selection:attempting_aps_create_tx", fn_name="trace_attempt_aps")
ctx.enable_probe(probe="coin_selection:aps_create_tx_internal", fn_name="trace_aps_create_tx")
self.bpf = BPF(text=coinselection_tracepoints_program, usdt_contexts=[ctx], debug=0, cflags=["-Wno-error=implicit-function-declaration"])
self.bpf = BPF(text=coinselection_tracepoints_program, usdt_contexts=[ctx], debug=0, cflags=bpf_cflags())
self.log.info("Prepare wallets")
self.generate(self.nodes[0], 101)

View File

@@ -169,7 +169,7 @@ class MempoolTracepointTest(BitcoinTestFramework):
node = self.nodes[0]
ctx = USDT(pid=node.process.pid)
ctx.enable_probe(probe="mempool:added", fn_name="trace_added")
bpf = BPF(text=MEMPOOL_TRACEPOINTS_PROGRAM, usdt_contexts=[ctx], debug=0, cflags=["-Wno-error=implicit-function-declaration"])
bpf = BPF(text=MEMPOOL_TRACEPOINTS_PROGRAM, usdt_contexts=[ctx], debug=0, cflags=bpf_cflags())
def handle_added_event(_, data, __):
events.append(bpf["added_events"].event(data))
@@ -206,7 +206,7 @@ class MempoolTracepointTest(BitcoinTestFramework):
node = self.nodes[0]
ctx = USDT(pid=node.process.pid)
ctx.enable_probe(probe="mempool:removed", fn_name="trace_removed")
bpf = BPF(text=MEMPOOL_TRACEPOINTS_PROGRAM, usdt_contexts=[ctx], debug=0, cflags=["-Wno-error=implicit-function-declaration"])
bpf = BPF(text=MEMPOOL_TRACEPOINTS_PROGRAM, usdt_contexts=[ctx], debug=0, cflags=bpf_cflags())
def handle_removed_event(_, data, __):
events.append(bpf["removed_events"].event(data))
@@ -252,7 +252,7 @@ class MempoolTracepointTest(BitcoinTestFramework):
node = self.nodes[0]
ctx = USDT(pid=node.process.pid)
ctx.enable_probe(probe="mempool:replaced", fn_name="trace_replaced")
bpf = BPF(text=MEMPOOL_TRACEPOINTS_PROGRAM, usdt_contexts=[ctx], debug=0, cflags=["-Wno-error=implicit-function-declaration"])
bpf = BPF(text=MEMPOOL_TRACEPOINTS_PROGRAM, usdt_contexts=[ctx], debug=0, cflags=bpf_cflags())
def handle_replaced_event(_, data, __):
event = ctypes.cast(data, ctypes.POINTER(MempoolReplaced)).contents
@@ -305,7 +305,7 @@ class MempoolTracepointTest(BitcoinTestFramework):
self.log.info("Hooking into mempool:rejected tracepoint...")
ctx = USDT(pid=node.process.pid)
ctx.enable_probe(probe="mempool:rejected", fn_name="trace_rejected")
bpf = BPF(text=MEMPOOL_TRACEPOINTS_PROGRAM, usdt_contexts=[ctx], debug=0, cflags=["-Wno-error=implicit-function-declaration"])
bpf = BPF(text=MEMPOOL_TRACEPOINTS_PROGRAM, usdt_contexts=[ctx], debug=0, cflags=bpf_cflags())
def handle_rejected_event(_, data, __):
events.append(bpf["rejected_events"].event(data))

View File

@@ -286,7 +286,7 @@ class NetTracepointTest(BitcoinTestFramework):
fn_name="trace_inbound_message")
ctx.enable_probe(probe="net:outbound_message",
fn_name="trace_outbound_message")
bpf = BPF(text=net_tracepoints_program, usdt_contexts=[ctx], debug=0, cflags=["-Wno-error=implicit-function-declaration"])
bpf = BPF(text=net_tracepoints_program, usdt_contexts=[ctx], debug=0, cflags=bpf_cflags())
EXPECTED_INOUTBOUND_VERSION_MSG = 1
checked_inbound_version_msg = 0
@@ -344,7 +344,7 @@ class NetTracepointTest(BitcoinTestFramework):
ctx = USDT(pid=self.nodes[0].process.pid)
ctx.enable_probe(probe="net:inbound_connection",
fn_name="trace_inbound_connection")
bpf = BPF(text=net_tracepoints_program, usdt_contexts=[ctx], debug=0, cflags=["-Wno-error=implicit-function-declaration"])
bpf = BPF(text=net_tracepoints_program, usdt_contexts=[ctx], debug=0, cflags=bpf_cflags())
inbound_connections = []
EXPECTED_INBOUND_CONNECTIONS = 2
@@ -381,7 +381,7 @@ class NetTracepointTest(BitcoinTestFramework):
ctx = USDT(pid=self.nodes[0].process.pid)
ctx.enable_probe(probe="net:outbound_connection",
fn_name="trace_outbound_connection")
bpf = BPF(text=net_tracepoints_program, usdt_contexts=[ctx], debug=0, cflags=["-Wno-error=implicit-function-declaration"])
bpf = BPF(text=net_tracepoints_program, usdt_contexts=[ctx], debug=0, cflags=bpf_cflags())
# that the handle_* function succeeds.
EXPECTED_OUTBOUND_CONNECTIONS = 2
@@ -422,7 +422,7 @@ class NetTracepointTest(BitcoinTestFramework):
ctx = USDT(pid=self.nodes[0].process.pid)
ctx.enable_probe(probe="net:evicted_inbound_connection",
fn_name="trace_evicted_inbound_connection")
bpf = BPF(text=net_tracepoints_program, usdt_contexts=[ctx], debug=0, cflags=["-Wno-error=implicit-function-declaration"])
bpf = BPF(text=net_tracepoints_program, usdt_contexts=[ctx], debug=0, cflags=bpf_cflags())
EXPECTED_EVICTED_CONNECTIONS = 2
evicted_connections = []
@@ -459,7 +459,7 @@ class NetTracepointTest(BitcoinTestFramework):
ctx = USDT(pid=self.nodes[0].process.pid)
ctx.enable_probe(probe="net:misbehaving_connection",
fn_name="trace_misbehaving_connection")
bpf = BPF(text=net_tracepoints_program, usdt_contexts=[ctx], debug=0, cflags=["-Wno-error=implicit-function-declaration"])
bpf = BPF(text=net_tracepoints_program, usdt_contexts=[ctx], debug=0, cflags=bpf_cflags())
EXPECTED_MISBEHAVING_CONNECTIONS = 2
misbehaving_connections = []
@@ -493,7 +493,7 @@ class NetTracepointTest(BitcoinTestFramework):
ctx = USDT(pid=self.nodes[0].process.pid)
ctx.enable_probe(probe="net:closed_connection",
fn_name="trace_closed_connection")
bpf = BPF(text=net_tracepoints_program, usdt_contexts=[ctx], debug=0, cflags=["-Wno-error=implicit-function-declaration"])
bpf = BPF(text=net_tracepoints_program, usdt_contexts=[ctx], debug=0, cflags=bpf_cflags())
EXPECTED_CLOSED_CONNECTIONS = 2
closed_connections = []

View File

@@ -184,7 +184,7 @@ class UTXOCacheTracepointTest(BitcoinTestFramework):
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, cflags=["-Wno-error=implicit-function-declaration"])
bpf = BPF(text=utxocache_changes_program, usdt_contexts=[ctx], debug=0, cflags=bpf_cflags())
# The handle_* function is a ctypes callback function called from C. When
# we assert in the handle_* function, the AssertError doesn't propagate
@@ -253,7 +253,7 @@ class UTXOCacheTracepointTest(BitcoinTestFramework):
ctx.enable_probe(probe="utxocache:add", fn_name="trace_utxocache_add")
ctx.enable_probe(probe="utxocache:spent",
fn_name="trace_utxocache_spent")
bpf = BPF(text=utxocache_changes_program, usdt_contexts=[ctx], debug=0, cflags=["-Wno-error=implicit-function-declaration"])
bpf = BPF(text=utxocache_changes_program, usdt_contexts=[ctx], debug=0, cflags=bpf_cflags())
# The handle_* function is a ctypes callback function called from C. When
# we assert in the handle_* function, the AssertError doesn't propagate
@@ -342,7 +342,7 @@ class UTXOCacheTracepointTest(BitcoinTestFramework):
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, cflags=["-Wno-error=implicit-function-declaration"])
bpf = BPF(text=utxocache_flushes_program, usdt_contexts=[ctx], debug=0, cflags=bpf_cflags())
# The handle_* function is a ctypes callback function called from C. When
# we assert in the handle_* function, the AssertError doesn't propagate
@@ -399,7 +399,7 @@ class UTXOCacheTracepointTest(BitcoinTestFramework):
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, cflags=["-Wno-error=implicit-function-declaration"])
bpf = BPF(text=utxocache_flushes_program, usdt_contexts=[ctx], debug=0, cflags=bpf_cflags())
bpf["utxocache_flush"].open_perf_buffer(handle_utxocache_flush)
self.log.info("prune blockchain to trigger a flush for pruning")

View File

@@ -99,7 +99,7 @@ class ValidationTracepointTest(BitcoinTestFramework):
ctx.enable_probe(probe="validation:block_connected",
fn_name="trace_block_connected")
bpf = BPF(text=validation_blockconnected_program,
usdt_contexts=[ctx], debug=0, cflags=["-Wno-error=implicit-function-declaration"])
usdt_contexts=[ctx], debug=0, cflags=bpf_cflags())
def handle_blockconnected(_, data, __):
event = ctypes.cast(data, ctypes.POINTER(Block)).contents