t.Skip("skipping because cgo not enabled")
}
- tg := testgo(t)
- defer tg.cleanup()
- tg.run("test", "-short", "-cover", "./testdata/cgocover")
- data := tg.getStdout() + tg.getStderr()
- checkCoverage(tg, data)
+ for _, dir := range []string{"cgocover", "cgocover2", "cgocover3", "cgocover4"} {
+ t.Run(dir, func(t *testing.T) {
+ tg := testgo(t)
+ defer tg.cleanup()
+ tg.setenv("GOPATH", filepath.Join(tg.pwd(), "testdata"))
+ tg.run("test", "-short", "-cover", dir)
+ data := tg.getStdout() + tg.getStderr()
+ checkCoverage(tg, data)
+ })
+ }
}
func TestCgoDependsOnSyscall(t *testing.T) {
if err != nil {
return nil, nil, nil, err
}
- if len(ptest.GoFiles) > 0 {
+ if len(ptest.GoFiles)+len(ptest.CgoFiles) > 0 {
pmain.imports = append(pmain.imports, ptest)
t.ImportTest = true
}