-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathdetect_test.go
107 lines (88 loc) · 2.62 KB
/
detect_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
package ainur
import (
"testing"
)
func TestVoidLinuxNano(t *testing.T) {
if result := MustExamine("testdata/nano_voidlinux"); result != "GCC 7.2.0" {
t.Errorf("Expected GCC 7.2.0, got %s", result)
}
}
func TestArchLinuxLs(t *testing.T) {
if result := MustExamine("testdata/ls_archlinux"); result != "GCC 7.1.1" {
t.Errorf("Expected GCC 7.1.1, got %s", result)
}
}
func TestClang(t *testing.T) {
if result := MustExamine("testdata/clang_hello"); result != "Clang 8.2.1" {
t.Errorf("Expected Clang 8.2.1, got %s", result)
}
}
func TestTCC(t *testing.T) {
if result := MustExamine("testdata/tcc_hello"); result != "TCC" {
t.Errorf("Expected TCC, got %s", result)
}
}
func TestRustStripped(t *testing.T) {
if result := MustExamine("testdata/rust_hello_stripped"); result != "Rust (GCC 8.1.0)" {
t.Errorf("Expected Rust (GCC 8.1.0), got %s", result)
}
}
func TestRust(t *testing.T) {
if result := MustExamine("testdata/rust_hello"); result != "Rust 1.27.0-nightly" {
t.Errorf("Expected Rust 1.27.0-nightly, got %s", result)
}
}
func TestGo(t *testing.T) {
if result := MustExamine("testdata/go_hello"); result != "Go 1.20.1" {
t.Errorf("Expected Go 1.20.1, got %s", result)
}
}
func TestRust2(t *testing.T) {
if result := MustExamine("testdata/bat"); result != "Rust (GCC 8.2.1)" {
t.Errorf("Expected Rust (GCC 8.2.1), got %s", result)
}
}
func TestD(t *testing.T) {
if result := MustExamine("testdata/dmd"); result != "DMD" {
t.Errorf("Expected DMD, got %s", result)
}
}
func TestGCC1(t *testing.T) {
if result := MustExamine("testdata/afl-analyze"); result != "GCC 7.2.0" {
t.Errorf("Expected GCC 7.2.0, got %s", result)
}
}
func TestPowerPC(t *testing.T) {
if result := MustExamine("testdata/e500v2"); result != "GCC 4.7.2" {
t.Errorf("Expected GCC 4.7.2, got %s", result)
}
}
func TestPowerPC2(t *testing.T) {
if result := MustExamine("testdata/e500v2_gcc8"); result != "GCC 8.3.0" {
t.Errorf("Expected GCC 8.3.0, got %s", result)
}
}
func TestGCC2(t *testing.T) {
if result := MustExamine("testdata/gcc820"); result != "GCC 8.2.0" {
t.Errorf("Expected GCC 8.2.0, got %s", result)
}
}
func TestGHC(t *testing.T) {
if result := MustExamine("testdata/ghc"); result != "GHC 8.6.2" {
t.Errorf("Expected GHC 8.6.2, got %s", result)
}
}
func TestPowerPC3(t *testing.T) {
if result := MustExamine("testdata/nc_e500v2"); result != "unknown" {
t.Errorf("Expected unknown, got %s", result)
}
}
var doNotOptimiseString string
func BenchmarkVoidLinux(b *testing.B) {
b.ReportAllocs()
var result string
for n := 0; n < b.N; n++ {
result = MustExamine("testdata/nano_voidlinux")
}
doNotOptimiseString = result
}