Skip to content

Commit

Permalink
vmtests: fix TestTracepointLoadFormat
Browse files Browse the repository at this point in the history
This is a trivial test to check the parsing of tracepoint info.
Unfortunately, there are minor changes between versions so we need to
account for that.

Signed-off-by: Kornilios Kourtis <kornilios@isovalent.com>
  • Loading branch information
kkourt committed Oct 20, 2023
1 parent 4c34c97 commit 4510a5d
Showing 1 changed file with 7 additions and 16 deletions.
23 changes: 7 additions & 16 deletions pkg/tracepoint/tracepoint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,26 +25,17 @@ func TestTracepointLoadFormat(t *testing.T) {

// the standard does not specify if char is signed or not
// historically, it's signed on amd64 and unsigned on arm64
// NB: it seems to also be true for bpf-next, which currently is 6.6
isCharSigned := true
if runtime.GOARCH == "arm64" {
if runtime.GOARCH == "arm64" || !kernels.MinKernelVersion("6.6") {
isCharSigned = false
}

var commField FieldFormat
if kernels.MinKernelVersion("5.17.0") {
commField = FieldFormat{
FieldStr: "char comm[TASK_COMM_LEN]",
Offset: 12,
Size: 16,
IsSigned: isCharSigned,
}
} else {
commField = FieldFormat{
FieldStr: "char comm[16]",
Offset: 12,
Size: 16,
IsSigned: isCharSigned,
}
commField := FieldFormat{
FieldStr: "char comm[16]",
Offset: 12,
Size: 16,
IsSigned: isCharSigned,
}

fields := []FieldFormat{
Expand Down

0 comments on commit 4510a5d

Please sign in to comment.