Skip to content

Commit

Permalink
Attach TestKprobeMultiProgramCall to one more function
Browse files Browse the repository at this point in the history
To test the program can be attached to multiple symbols.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
  • Loading branch information
olsajiri committed Dec 18, 2023
1 parent a0abcfd commit 3386955
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions link/kprobe_multi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func TestKprobeMultiProgramCall(t *testing.T) {

// For simplicity, just assert the increment happens with any symbol in the array.
opts := KprobeMultiOptions{
Symbols: []string{"__do_sys_getpid"},
Symbols: []string{"__do_sys_getpid", "__do_sys_gettid"},
}
km, err := KprobeMulti(p, opts)
if err != nil {
Expand All @@ -106,9 +106,10 @@ func TestKprobeMultiProgramCall(t *testing.T) {

// Trigger ebpf program call.
unix.Getpid()
unix.Gettid()

// Assert that the value at index 0 has been updated to 1.
assertMapValueGE(t, m, 0, 1)
assertMapValueGE(t, m, 0, 2)

// Close the link.
if err := km.Close(); err != nil {
Expand All @@ -122,6 +123,7 @@ func TestKprobeMultiProgramCall(t *testing.T) {

// Retrigger the ebpf program call.
unix.Getpid()
unix.Gettid()

// Assert that this time the value has not been updated.
assertMapValue(t, m, 0, 0)
Expand Down

0 comments on commit 3386955

Please sign in to comment.