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.
This commit is contained in:
Alessandro Arzilli
2021-08-04 23:12:15 +02:00
committed by GitHub
parent f95340ae1b
commit 4e242098f8

View File

@ -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) {