@@ -220,22 +220,20 @@ if run_root_tests
220220 end
221221 end
222222 @test_skip " uprobe"
223- #= FIXME
224- @testset "uprobe" begin
225- up = UProbe(+, Tuple{Int,Int}) do regs
226- return 0
227- end
228- API.load(up)
229- API.unload(up)
230- @testset "retprobe" begin
231- up = UProbe(+, Tuple{Int,Int}; retprobe=true) do regs
232- return 0
233- end
234- API.load(up)
235- API.unload(up)
236- end
237- end
238- =#
223+ # @testset "uprobe" begin
224+ # up = UProbe(+, Tuple{Int,Int}) do regs
225+ # return 0
226+ # end
227+ # API.load(up)
228+ # API.unload(up)
229+ # @testset "retprobe" begin
230+ # up = UProbe(+, Tuple{Int,Int}; retprobe=true) do regs
231+ # return 0
232+ # end
233+ # API.load(up)
234+ # API.unload(up)
235+ # end
236+ # end
239237 @testset " tracepoint" begin
240238 p = Tracepoint (" clk" , " clk_enable" ) do regs
241239 return 0
@@ -456,14 +454,13 @@ if run_root_tests
456454 # TODO : get_current_comm
457455 @testset " get_stackid" begin
458456 # from BCC's stackcount
459- # FIXME : { i64, i32 } causes verifier errors
460457 struct StackKey
461- tgid:: UInt64
458+ tgid:: UInt32
462459 sid:: Clong
463460 end
464461 kp = KProbe (" ksys_write" ; license= " GPL" ) do x
465- stacks = RT. RTMap (;name= " stacks" ,maptype= API. BPF_MAP_TYPE_STACK_TRACE,keytype= UInt32,valuetype= NTuple{API. PERF_MAX_STACK_DEPTH,UInt64},maxentries= 100 )
466- counts = RT. RTMap (;name= " counts" ,maptype= API. BPF_MAP_TYPE_HASH,keytype= StackKey,valuetype= UInt32,maxentries= 100 )
462+ stacks = RT. RTMap (;name= " stacks" ,maptype= API. BPF_MAP_TYPE_STACK_TRACE,keytype= UInt32,valuetype= NTuple{API. PERF_MAX_STACK_DEPTH,UInt64},maxentries= 10000 )
463+ counts = RT. RTMap (;name= " counts" ,maptype= API. BPF_MAP_TYPE_HASH,keytype= StackKey,valuetype= UInt32,maxentries= 10000 )
467464 pid, tgid = RT. get_current_pid_tgid ()
468465 sid = RT. get_stackid (x, stacks, 0 )
469466 key = StackKey (tgid, sid)
@@ -475,17 +472,14 @@ if run_root_tests
475472 stacks = Host. hostmap (API. findmap (kp. obj, " stacks" ); K= UInt32, V= NTuple{API. PERF_MAX_STACK_DEPTH,UInt64})
476473 counts = Host. hostmap (API. findmap (kp. obj, " counts" ); K= StackKey, V= UInt32)
477474 write (test_io, " 1" ); flush (test_io)
478- @test length (counts) > 0
479- key = nothing
480- for k in keys (counts)
481- if k. tgid == getpid ()
482- key = k
483- break
484- end
485- end
486- @test key != = nothing
475+ ks = collect (keys (counts))
476+ @test length (ks) > 0
477+ key = first (ks)
478+ # TODO : Should we be able to find a key with getpid() == key.tgid?
487479 @test haskey (counts, key)
480+ # TODO : This is potentially racy
488481 @test haskey (stacks, key. sid)
482+ @test occursin (" ksys_write" , Host. stack_to_string (stacks[key. sid]))
489483 end
490484 end
491485 end
0 commit comments