1 // Copyright 2016 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
10 "golang.org/x/net/bpf"
13 func TestVMLoadExtensionNotImplemented(t *testing.T) {
14 _, _, err := testVM(t, []bpf.Instruction{
20 if errStr(err) != "extension 100 not implemented" {
21 t.Fatalf("unexpected error: %v", err)
25 func TestVMLoadExtensionExtLen(t *testing.T) {
26 vm, done, err := testVM(t, []bpf.Instruction{
33 t.Fatalf("failed to load BPF program: %v", err)
37 out, err := vm.Run([]byte{
38 0xff, 0xff, 0xff, 0xff,
39 0xff, 0xff, 0xff, 0xff,
43 t.Fatalf("unexpected error while running program: %v", err)
45 if want, got := 4, out; want != got {
46 t.Fatalf("unexpected number of output bytes:\n- want: %d\n- got: %d",