From 4e242098f8f2ffe6b80a5422bf4340ef370c651e Mon Sep 17 00:00:00 2001 From: Alessandro Arzilli Date: Wed, 4 Aug 2021 23:12:15 +0200 Subject: [PATCH] tests: check presence of gcc for cgo tests (#2644) The install of gcc sometimes fails on our CI, it is not an error if the tests for cgo can not run because there's no C compiler. --- pkg/proc/test/support.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/proc/test/support.go b/pkg/proc/test/support.go index 3ce431d0..6b0f12ed 100644 --- a/pkg/proc/test/support.go +++ b/pkg/proc/test/support.go @@ -367,7 +367,11 @@ var hasCgo = func() bool { if err != nil { panic(err) } - return strings.TrimSpace(string(out)) == "1" + if strings.TrimSpace(string(out)) != "1" { + return false + } + _, err = exec.LookPath("gcc") + return err == nil }() func MustHaveCgo(t *testing.T) {