github.com/cilium/ebpf@v0.15.1-0.20240517100537-8079b37aa138/syscalls_test.go (about) 1 package ebpf 2 3 import ( 4 "strings" 5 "testing" 6 7 "github.com/cilium/ebpf/internal/testutils" 8 ) 9 10 func TestObjNameCharacters(t *testing.T) { 11 for in, valid := range map[string]bool{ 12 "test": true, 13 "": true, 14 "a-b": false, 15 "yeah so": false, 16 "dot.": objNameAllowsDot() == nil, 17 "Capital": true, 18 } { 19 result := strings.IndexFunc(in, invalidBPFObjNameChar) == -1 20 if result != valid { 21 t.Errorf("Name '%s' classified incorrectly", in) 22 } 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 }