aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/csource/csource_test.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2020-04-29 15:31:23 +0200
committerDmitry Vyukov <dvyukov@google.com>2020-04-29 16:32:33 +0200
commit3b93a8e0034a8109125737a9019e6e787f81ec2b (patch)
tree70da3f3111a10b3127c3acb0e4c0ab2b12618334 /pkg/csource/csource_test.go
parent08bed8d76911c9f004a2997c550687351faa52ce (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/csource_test.go')
-rw-r--r--pkg/csource/csource_test.go20
1 files changed, 1 insertions, 19 deletions
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()