github.com/google/syzkaller@v0.0.0-20240517125934-c0f1611a36d6/pkg/cover/backend/elf_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 backend
     5  
     6  import (
     7  	"testing"
     8  )
     9  
    10  func TestGetTraceCallbackType(t *testing.T) {
    11  	inputData := map[int][]string{
    12  		TraceCbNone: {
    13  			"foobar",
    14  			"___sanitizer_cov_trace_pc",
    15  		},
    16  		TraceCbPc: {
    17  			"__sanitizer_cov_trace_pc",
    18  			"____sanitizer_cov_trace_pc_veneer",
    19  		},
    20  		TraceCbCmp: {
    21  			"__sanitizer_cov_trace_cmp1",
    22  			"__sanitizer_cov_trace_const_cmp4",
    23  			"____sanitizer_cov_trace_const_cmp4_veneer",
    24  		},
    25  	}
    26  	for expected, names := range inputData {
    27  		for _, name := range names {
    28  			result := getTraceCallbackType(name)
    29  			if result != expected {
    30  				t.Fatalf("getTraceCallbackType(`%v`) unexpectedly returned %v", name, result)
    31  			}
    32  		}
    33  	}
    34  }