Skip to content

Commit 2c44391

Browse files
fanquakevijaydasmp
authored andcommitted
Merge bitcoin#28629: test: fix usdt undeclared function errors on mantis
4077e43 test: fix usdt undeclared function errors on mantis (willcl-ark) Pull request description: This is one way to fix bitcoin#28600 Recently usage of undeclared functions became an error rather than a warning, in C2x. https://reviews.llvm.org/D122983?id=420290 This change has migrated into the build tools of Ubuntu 23.10 which now causes the USDT tests to fail to compile, see bitcoin#28600 I think there are various potential fixes: 1. Manually declare the functions we use 2. Fix imports so that manual declarations aren't needed 3. Revert the new C2X behaviour and don't error on implicit function declarations I would have preferred solution 2, but I believe this will require changes to the upstream bcc package. Having played with the imports I can get things working in a standalone C program, using system headers, but when building the program from a python context as we do in the test it uses its own headers (bundled with the python lib) rather than the system ones, and manually importing (some) system headers results in definition mismatches. I also investigated explicitly importing required headers from the package, which use paths like `#import </virtual/bcc/bcc_helpers.h>`, but this seems more obtuse and brittle than simply ignoring the warning. Therefore I think that until the upstream python pacakge fixes their declarations, we should fix this by setting `-Wno-error=implicit-function-declaration` for the tracing programs. cc maflcko 0xB10C ACKs for top commit: maflcko: lgtm ACK 4077e43 Tree-SHA512: 8368bb1155e920a95db128dc893267f8dab64f1ae53f6d63c6d9294e2e4e92bef8515e3697e9113228bedc51c0afdbc5bbcf558c119bf0eb3293dc2ced86b435
1 parent 95339a4 commit 2c44391

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

test/functional/interface_usdt_net.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def __repr__(self):
114114
fn_name="trace_inbound_message")
115115
ctx.enable_probe(probe="net:outbound_message",
116116
fn_name="trace_outbound_message")
117-
bpf = BPF(text=net_tracepoints_program, usdt_contexts=[ctx], debug=0)
117+
bpf = BPF(text=net_tracepoints_program, usdt_contexts=[ctx], debug=0, cflags=["-Wno-error=implicit-function-declaration"])
118118

119119
# The handle_* function is a ctypes callback function called from C. When
120120
# we assert in the handle_* function, the AssertError doesn't propagate

test/functional/interface_usdt_utxocache.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ def test_uncache(self):
177177
ctx = USDT(path=str(self.options.bitcoind))
178178
ctx.enable_probe(probe="utxocache:uncache",
179179
fn_name="trace_utxocache_uncache")
180-
bpf = BPF(text=utxocache_changes_program, usdt_contexts=[ctx], debug=0)
180+
bpf = BPF(text=utxocache_changes_program, usdt_contexts=[ctx], debug=0, cflags=["-Wno-error=implicit-function-declaration"])
181181

182182
# The handle_* function is a ctypes callback function called from C. When
183183
# we assert in the handle_* function, the AssertError doesn't propagate
@@ -243,7 +243,7 @@ def test_add_spent(self):
243243
ctx.enable_probe(probe="utxocache:add", fn_name="trace_utxocache_add")
244244
ctx.enable_probe(probe="utxocache:spent",
245245
fn_name="trace_utxocache_spent")
246-
bpf = BPF(text=utxocache_changes_program, usdt_contexts=[ctx], debug=0)
246+
bpf = BPF(text=utxocache_changes_program, usdt_contexts=[ctx], debug=0, cflags=["-Wno-error=implicit-function-declaration"])
247247

248248
# The handle_* function is a ctypes callback function called from C. When
249249
# we assert in the handle_* function, the AssertError doesn't propagate
@@ -338,7 +338,7 @@ def test_flush(self):
338338
ctx = USDT(path=str(self.options.bitcoind))
339339
ctx.enable_probe(probe="utxocache:flush",
340340
fn_name="trace_utxocache_flush")
341-
bpf = BPF(text=utxocache_flushes_program, usdt_contexts=[ctx], debug=0)
341+
bpf = BPF(text=utxocache_flushes_program, usdt_contexts=[ctx], debug=0, cflags=["-Wno-error=implicit-function-declaration"])
342342

343343
# The handle_* function is a ctypes callback function called from C. When
344344
# we assert in the handle_* function, the AssertError doesn't propagate

test/functional/interface_usdt_validation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def __repr__(self):
9898
ctx.enable_probe(probe="validation:block_connected",
9999
fn_name="trace_block_connected")
100100
bpf = BPF(text=validation_blockconnected_program,
101-
usdt_contexts=[ctx], debug=0)
101+
usdt_contexts=[ctx], debug=0, cflags=["-Wno-error=implicit-function-declaration"])
102102

103103
def handle_blockconnected(_, data, __):
104104
nonlocal expected_blocks, blocks_checked

0 commit comments

Comments
 (0)