blob: 18d7936d031e6e8b39db499961f6394e545905df (
plain)
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
|
// Copyright 2017 syzkaller project authors. All rights reserved.
// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
package kernel
import (
"os/exec"
"strings"
"testing"
)
func TestCompilerIdentity(t *testing.T) {
compiler := "gcc"
if _, err := exec.LookPath(compiler); err != nil {
t.Skipf("compiler '%v' is not found: %v", compiler, err)
}
id, err := CompilerIdentity(compiler)
if err != nil {
t.Fatalf("failed: %v", err)
}
if len(id) == 0 {
t.Fatalf("identity is empty")
}
if strings.Contains(id, "\n") {
t.Fatalf("identity contains a new line")
}
// We don't know what's the right answer,
// so just print it for manual inspection.
t.Logf("id: '%v'", id)
}
|