diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2019-11-07 06:42:10 +0100 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2019-11-07 11:07:00 +0100 |
| commit | f15876118387bb9e4c079f29d06394b36e393180 (patch) | |
| tree | 5730e7f61ebfb89d905c9ac14d3e6a4edf3fbd14 /pkg/csource/csource_test.go | |
| parent | b17cbe9d11b229e3fa944ddbe4aad061e254b77f (diff) | |
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.
Diffstat (limited to 'pkg/csource/csource_test.go')
| -rw-r--r-- | pkg/csource/csource_test.go | 8 |
1 files changed, 8 insertions, 0 deletions
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 <stdio.h> +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() |
