Skip to content

Commit

Permalink
elf_reader_test: enable test_sk_assign.o, handle iproute2 map
Browse files Browse the repository at this point in the history
Fixes #469

Signed-off-by: Timo Beckers <timo@isovalent.com>
  • Loading branch information
ti-mo committed Jan 21, 2022
1 parent 1946eef commit 71eff55
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions elf_reader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"errors"
"flag"
"fmt"
"io"
"os"
"path/filepath"
"strings"
Expand Down Expand Up @@ -653,8 +654,6 @@ func TestLibBPFCompat(t *testing.T) {
testutils.Files(t, files, func(t *testing.T, path string) {
file := filepath.Base(path)
switch file {
case "test_sk_assign.o":
t.Skip("Skipping due to incompatible struct bpf_map_def")
case "test_map_in_map.o", "test_map_in_map.linked3.o",
"test_select_reuseport_kern.o", "test_select_reuseport_kern.linked3.o":
t.Skip("Skipping due to missing InnerMap in map definition")
Expand All @@ -674,6 +673,17 @@ func TestLibBPFCompat(t *testing.T) {
t.Fatalf("Can't read %s: %s", file, err)
}

switch file {
case "test_sk_assign.o":
// Test contains a legacy iproute2 bpf_elf_map definition.
for _, m := range spec.Maps {
if m.Extra.Len() == 0 {
t.Fatalf("Expected extra bytes in map %s", m.Name)
}
_, _ = io.Copy(io.Discard, &m.Extra)
}
}

var opts CollectionOptions
for _, mapSpec := range spec.Maps {
if mapSpec.Pinning != PinNone {
Expand Down

0 comments on commit 71eff55

Please sign in to comment.