From f15876118387bb9e4c079f29d06394b36e393180 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Thu, 7 Nov 2019 06:42:10 +0100 Subject: pkg/csource: don't run tests if compiler is broken Test presence of a working compiler before running any tests for a target. This helps to make tests pass even if some cross-compilers are not installed properly. --- pkg/csource/csource_test.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'pkg/csource/csource_test.go') diff --git a/pkg/csource/csource_test.go b/pkg/csource/csource_test.go index 64f92d31b..64fd1e936 100644 --- a/pkg/csource/csource_test.go +++ b/pkg/csource/csource_test.go @@ -43,6 +43,14 @@ func TestGenerate(t *testing.T) { if _, err := exec.LookPath(sysTarget.CCompiler); err != nil { t.Skipf("no target compiler %v", sysTarget.CCompiler) } + bin, err := Build(target, []byte(` +#include +int main() { printf("Hello, World!\n"); } +`)) + if err != nil { + t.Skipf("target compiler is broken: %v", err) + } + os.Remove(bin) full := !checked[target.OS] checked[target.OS] = true t.Parallel() -- cgit mrf-deployment