Debian Codegraph @

internal/tracefs/uprobe_test.go

raw symbols SCIP
1 package tracefs
2
3 import (
4 "fmt"
5 "testing"
6 )
7
8 func TestUprobeToken(t *testing.T) {
9 tests := []struct {
10 args ProbeArgs
11 expected string
12 }{
13 {ProbeArgs{Path: "/bin/bash"}, "/bin/bash:0x0"},
14 {ProbeArgs{Path: "/bin/bash", Offset: 1}, "/bin/bash:0x1"},
15 {ProbeArgs{Path: "/bin/bash", Offset: 65535}, "/bin/bash:0xffff"},
16 {ProbeArgs{Path: "/bin/bash", Offset: 65536}, "/bin/bash:0x10000"},
17 {ProbeArgs{Path: "/bin/bash", Offset: 1, RefCtrOffset: 1}, "/bin/bash:0x1(0x1)"},
18 {ProbeArgs{Path: "/bin/bash", Offset: 1, RefCtrOffset: 65535}, "/bin/bash:0x1(0xffff)"},
19 }
20
21 for i, tt := range tests {
22 t.Run(fmt.Sprint(i), func(t *testing.T) {
23 po := UprobeToken(tt.args)
24 if tt.expected != po {
25 t.Errorf("Expected path:offset to be '%s', got '%s'", tt.expected, po)
26 }
27 })
28 }
29 }