diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2018-07-25 10:44:45 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2018-07-25 10:44:45 +0200 |
| commit | ad155aa4289990cd08c77c0e4e5ecc4d63df6ff3 (patch) | |
| tree | 3a2b62147bac29b572ba6cb6475b56d489a5ccf4 /pkg/csource | |
| parent | e0c1bcbabc5e9037b9a265204dc70c5188909dbc (diff) | |
pkg/csource: say what compiler is missing
Diffstat (limited to 'pkg/csource')
| -rw-r--r-- | pkg/csource/build.go | 5 | ||||
| -rw-r--r-- | pkg/csource/csource_test.go | 7 |
2 files changed, 5 insertions, 7 deletions
diff --git a/pkg/csource/build.go b/pkg/csource/build.go index 3befa092d..391d437a1 100644 --- a/pkg/csource/build.go +++ b/pkg/csource/build.go @@ -5,7 +5,6 @@ package csource import ( "bytes" - "errors" "fmt" "io/ioutil" "os" @@ -30,7 +29,7 @@ func build(target *prog.Target, src []byte, file string) (string, error) { sysTarget := targets.Get(target.OS, target.Arch) compiler := sysTarget.CCompiler if _, err := exec.LookPath(compiler); err != nil { - return "", ErrNoCompiler + return "", fmt.Errorf("no target compiler %v", compiler) } // We call the binary syz-executor because it sometimes shows in bug titles, // and we don't want 2 different bugs for when a crash is triggered during fuzzing and during repro. @@ -70,8 +69,6 @@ func build(target *prog.Target, src []byte, file string) (string, error) { return bin, nil } -var ErrNoCompiler = errors.New("no target compiler") - // Format reformats C source using clang-format. func Format(src []byte) ([]byte, error) { stdout, stderr := new(bytes.Buffer), new(bytes.Buffer) diff --git a/pkg/csource/csource_test.go b/pkg/csource/csource_test.go index 584bc4606..359c05264 100644 --- a/pkg/csource/csource_test.go +++ b/pkg/csource/csource_test.go @@ -7,6 +7,7 @@ import ( "fmt" "math/rand" "os" + "strings" "testing" "time" @@ -88,10 +89,10 @@ func testOne(t *testing.T, p *prog.Prog, opts Options) { t.Fatalf("%v", err) } bin, err := Build(p.Target, src) - if err == ErrNoCompiler { - t.Skip(err) - } if err != nil { + if strings.Contains(err.Error(), "no target compiler") { + t.Skip(err) + } t.Logf("opts: %+v\nprogram:\n%s\n", opts, p.Serialize()) t.Fatalf("%v", err) } |
