(t *testing.T)
| 669 | } |
| 670 | |
| 671 | func TestProgramSpecCompatible(t *testing.T) { |
| 672 | arr := createMap(t, Array, 2) |
| 673 | |
| 674 | spec := &ProgramSpec{ |
| 675 | Type: SocketFilter, |
| 676 | Instructions: asm.Instructions{ |
| 677 | asm.LoadImm(asm.R0, -1, asm.DWord), |
| 678 | asm.LoadMapPtr(asm.R1, arr.FD()), |
| 679 | asm.Mov.Imm32(asm.R0, 0), |
| 680 | asm.Return(), |
| 681 | }, |
| 682 | License: "MIT", |
| 683 | } |
| 684 | |
| 685 | prog := mustNewProgram(t, spec, nil) |
| 686 | |
| 687 | info, err := prog.Info() |
| 688 | testutils.SkipIfNotSupported(t, err) |
| 689 | qt.Assert(t, qt.IsNil(err)) |
| 690 | |
| 691 | err = spec.Compatible(info) |
| 692 | testutils.SkipIfNotSupportedOnOS(t, err) |
| 693 | qt.Assert(t, qt.IsNil(err)) |
| 694 | } |
| 695 | |
| 696 | func TestProgramAttachToKernel(t *testing.T) { |
| 697 | // See https://github.com/torvalds/linux/commit/290248a5b7d829871b3ea3c62578613a580a1744 |
nothing calls this directly
no test coverage detected
searching dependent graphs…