diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2020-04-29 15:31:23 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2020-04-29 16:32:33 +0200 |
| commit | 3b93a8e0034a8109125737a9019e6e787f81ec2b (patch) | |
| tree | 70da3f3111a10b3127c3acb0e4c0ab2b12618334 /pkg/csource | |
| parent | 08bed8d76911c9f004a2997c550687351faa52ce (diff) | |
sys/targets: better detection for missing/broken cross-compilers
1. Detect when compiler is present, but is not functioning
(can't build a simple program, common for Linux distros).
2. Be more strict with skipping tests due to missing/broken compilers on CI
(on CI they should work, so fail loudly if not).
3. Dedup this logic across syz-env and pkg/csource tests.
4. Add better error reporting for syz-env.
Fixes #1606
Diffstat (limited to 'pkg/csource')
| -rw-r--r-- | pkg/csource/build.go | 4 | ||||
| -rw-r--r-- | pkg/csource/csource_test.go | 20 |
2 files changed, 1 insertions, 23 deletions
diff --git a/pkg/csource/build.go b/pkg/csource/build.go index 56d5487a8..1269987e5 100644 --- a/pkg/csource/build.go +++ b/pkg/csource/build.go @@ -8,7 +8,6 @@ import ( "fmt" "io/ioutil" "os" - "os/exec" "runtime" "github.com/google/syzkaller/pkg/osutil" @@ -37,9 +36,6 @@ func BuildFile(target *prog.Target, src string) (string, error) { func build(target *prog.Target, src []byte, file string, warn bool) (string, error) { sysTarget := targets.Get(target.OS, target.Arch) compiler := sysTarget.CCompiler - if _, err := exec.LookPath(compiler); err != nil { - 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. bin, err := osutil.TempFile("syz-executor") diff --git a/pkg/csource/csource_test.go b/pkg/csource/csource_test.go index 59ca230b6..78145c8fa 100644 --- a/pkg/csource/csource_test.go +++ b/pkg/csource/csource_test.go @@ -8,7 +8,6 @@ import ( "io/ioutil" "math/rand" "os" - "os/exec" "path/filepath" "regexp" "runtime" @@ -33,26 +32,9 @@ func TestGenerate(t *testing.T) { continue } t.Run(target.OS+"/"+target.Arch, func(t *testing.T) { - if target.OS == "linux" && target.Arch == "arm64" { - // Episodically fails on travis with: - // collect2: error: ld terminated with signal 11 [Segmentation fault] - t.Skip("broken") - } - if target.OS == "test" && target.PtrSize == 4 { - // The same reason as linux/32. - t.Skip("broken") - } - if _, err := exec.LookPath(sysTarget.CCompiler); err != nil { - t.Skipf("no target compiler %v", sysTarget.CCompiler) - } - bin, err := Build(target, []byte(` -#include <stdio.h> -int main() { printf("Hello, World!\n"); } -`)) - if err != nil { + if err := sysTarget.BrokenCrossCompiler; err != "" { t.Skipf("target compiler is broken: %v", err) } - os.Remove(bin) full := !checked[target.OS] checked[target.OS] = true t.Parallel() |
