diff options
| author | Space Meyer <spm@google.com> | 2022-09-13 15:24:23 +0000 |
|---|---|---|
| committer | Space Meyer <git@the-space.agency> | 2022-10-07 11:11:53 +0200 |
| commit | 79a5963585ac032cd3f390a37b5d276f7f9d0b5c (patch) | |
| tree | 593a2ad8c17be76a25b04654429f1604a565a0a2 /pkg/vcs/linux_test.go | |
| parent | 8a2121976b8020f2006c1a953766af912ba709dd (diff) | |
pkg/bisect: use default compiler during bisection where possible
This allows us to bisect at least recently introduced bugs, where the
manager that found the bug uses a non standard compiler. This is usefull
during development of a new sanitizer for which a compiler with
non-upstreamed patches is required.
Diffstat (limited to 'pkg/vcs/linux_test.go')
| -rw-r--r-- | pkg/vcs/linux_test.go | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/pkg/vcs/linux_test.go b/pkg/vcs/linux_test.go new file mode 100644 index 000000000..1865aa2d6 --- /dev/null +++ b/pkg/vcs/linux_test.go @@ -0,0 +1,50 @@ +// Copyright 2022 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 vcs + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestClangVersion(t *testing.T) { + defaultCompiler := "/some/default/compiler" + binDir := "/some/dir/" + tags := make(map[string]bool) + + // No tags case. + actual := linuxClangPath(tags, binDir, defaultCompiler) + expected := binDir + "llvm-9.0.1/bin/clang" + assert.Equal(t, actual, expected, "unexpected clang path") + + // Recent tag case. + tags["v5.9"] = true + actual = linuxClangPath(tags, binDir, defaultCompiler) + expected = defaultCompiler + assert.Equal(t, actual, expected, "unexpected clang path") +} + +func TestGCCVersion(t *testing.T) { + defaultCompiler := "/some/default/compiler" + binDir := "/some/dir/" + tags := make(map[string]bool) + + // No tags case. + actual := linuxGCCPath(tags, binDir, defaultCompiler) + expected := binDir + "gcc-5.5.0/bin/gcc" + assert.Equal(t, actual, expected, "unexpected gcc path") + + // Somewhat old tag case. + tags["v4.12"] = true + actual = linuxGCCPath(tags, binDir, defaultCompiler) + expected = binDir + "gcc-8.1.0/bin/gcc" + assert.Equal(t, actual, expected, "unexpected gcc path") + + // Recent tag case. + tags["v5.9"] = true + actual = linuxGCCPath(tags, binDir, defaultCompiler) + expected = defaultCompiler + assert.Equal(t, actual, expected, "unexpected gcc path") +} |
