mirror of
https://github.com/reactos/syzkaller.git
synced 2024-11-24 03:49:45 +00:00
37 lines
910 B
Go
37 lines
910 B
Go
// 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 build
|
|
|
|
import (
|
|
"os/exec"
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestCompilerIdentity(t *testing.T) {
|
|
t.Parallel()
|
|
for _, compiler := range []string{"gcc", "clang", "bazel"} {
|
|
compiler := compiler
|
|
t.Run(compiler, func(t *testing.T) {
|
|
t.Parallel()
|
|
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)
|
|
})
|
|
}
|
|
}
|