| 1 | package ebpf |
| 2 | |
| 3 | import ( |
| 4 | "testing" |
| 5 | |
| 6 | "github.com/go-quicktest/qt" |
| 7 | |
| 8 | "github.com/cilium/ebpf/internal/testutils" |
| 9 | ) |
| 10 | |
| 11 | func TestSanitizeName(t *testing.T) { |
| 12 | for input, want := range map[string]string{ |
| 13 | "test": "test", |
| 14 | "": "", |
| 15 | "a-b": "ab", |
| 16 | "yeah so": "yeahso", |
| 17 | "dot.": "dot.", |
| 18 | "Capital": "Capital", |
| 19 | "t_est": "t_est", |
| 20 | "hörnchen": "hrnchen", |
| 21 | } { |
| 22 | qt.Assert(t, qt.Equals(sanitizeName(input, -1), want), qt.Commentf("input: %s", input)) |
| 23 | } |
| 24 | } |
| 25 | |
| 26 | func TestHaveBatchAPI(t *testing.T) { |
| 27 | testutils.CheckFeatureTest(t, haveBatchAPI) |
| 28 | } |
| 29 | |
| 30 | func TestHaveObjName(t *testing.T) { |
| 31 | testutils.CheckFeatureTest(t, haveObjName) |
| 32 | } |
| 33 | |
| 34 | func TestObjNameAllowsDot(t *testing.T) { |
| 35 | testutils.CheckFeatureTest(t, objNameAllowsDot) |
| 36 | } |
| 37 | |
| 38 | func TestHaveNestedMaps(t *testing.T) { |
| 39 | testutils.CheckFeatureTest(t, haveNestedMaps) |
| 40 | } |
| 41 | |
| 42 | func TestHaveMapMutabilityModifiers(t *testing.T) { |
| 43 | testutils.CheckFeatureTest(t, haveMapMutabilityModifiers) |
| 44 | } |
| 45 | |
| 46 | func TestHaveMmapableMaps(t *testing.T) { |
| 47 | testutils.CheckFeatureTest(t, haveMmapableMaps) |
| 48 | } |
| 49 | |
| 50 | func TestHaveInnerMaps(t *testing.T) { |
| 51 | testutils.CheckFeatureTest(t, haveInnerMaps) |
| 52 | } |
| 53 | |
| 54 | func TestHaveProbeReadKernel(t *testing.T) { |
| 55 | testutils.CheckFeatureTest(t, haveProbeReadKernel) |
| 56 | } |
| 57 | |
| 58 | func TestHaveBPFToBPFCalls(t *testing.T) { |
| 59 | testutils.CheckFeatureTest(t, haveBPFToBPFCalls) |
| 60 | } |
| 61 | |
| 62 | func TestHaveSyscallWrapper(t *testing.T) { |
| 63 | testutils.CheckFeatureTest(t, haveSyscallWrapper) |
| 64 | } |
| 65 | |
| 66 | func TestHaveProgramExtInfos(t *testing.T) { |
| 67 | testutils.CheckFeatureTest(t, haveProgramExtInfos) |
| 68 | } |