github.com/google/syzkaller@v0.0.0-20240517125934-c0f1611a36d6/syz-fuzzer/fuzzer_test.go (about) 1 // Copyright 2024 syzkaller project authors. All rights reserved. 2 // Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. 3 4 package main 5 6 import ( 7 "testing" 8 9 "github.com/google/syzkaller/pkg/ipc" 10 "github.com/google/syzkaller/pkg/signal" 11 "github.com/stretchr/testify/assert" 12 ) 13 14 func TestFilterProgInfo(t *testing.T) { 15 max := signal.FromRaw([]uint32{5, 6, 7}, 0) 16 mask := signal.FromRaw([]uint32{2, 4, 6, 8}, 0) 17 info := ipc.ProgInfo{ 18 Calls: []ipc.CallInfo{ 19 { 20 Signal: []uint32{1, 2, 3, 5, 6}, 21 Cover: []uint32{1, 2, 3}, 22 }, 23 { 24 Signal: []uint32{2, 3, 4, 6, 7}, 25 Cover: []uint32{2, 3, 4}, 26 }, 27 }, 28 Extra: ipc.CallInfo{ 29 Signal: []uint32{3, 4, 5}, 30 Cover: []uint32{3, 4, 5}, 31 }, 32 } 33 diffMaxSignal(&info, max, mask, 1) 34 assert.Equal(t, ipc.ProgInfo{ 35 Calls: []ipc.CallInfo{ 36 { 37 Signal: []uint32{1, 2, 3}, 38 Cover: []uint32{1, 2, 3}, 39 }, 40 { 41 Signal: []uint32{2, 3, 4, 6}, 42 Cover: []uint32{2, 3, 4}, 43 }, 44 }, 45 Extra: ipc.CallInfo{ 46 Signal: []uint32{3, 4}, 47 Cover: []uint32{3, 4, 5}, 48 }, 49 }, info) 50 }