Ejemplo n.º 1
0
func TestNoLinkForbidden(t *testing.T) {
	defer leaktest.AfterTest(t)()
	if build.Default.GOPATH == "" {
		t.Skip("GOPATH isn't set")
	}

	imports, err := testutils.TransitiveImports("github.com/cockroachdb/cockroach", true)
	if err != nil {
		t.Fatal(err)
	}

	for _, forbidden := range []string{
		"testing", // defines flags
		"github.com/cockroachdb/cockroach/security/securitytest", // contains certificates
	} {
		if _, ok := imports[forbidden]; ok {
			t.Errorf("The cockroach binary includes %s, which is forbidden", forbidden)
		}
	}
}
Ejemplo n.º 2
0
func TestNoLinkForbidden(t *testing.T) {
	defer leaktest.AfterTest(t)
	if build.Default.GOPATH == "" {
		t.Skip("GOPATH isn't set")
	}

	imports, err := testutils.TransitiveImports("github.com/cockroachdb/cockroach/sql/driver", false)
	if err != nil {
		t.Fatal(err)
	}

	for _, forbidden := range []string{
		"C",       // cross compilation
		"testing", // defines flags
		"github.com/cockroachdb/cockroach/util/log", // defines flags
	} {
		if _, ok := imports[forbidden]; ok {
			t.Errorf("sql/driver includes %s, which is forbidden", forbidden)
		}
	}
}
Ejemplo n.º 3
0
func TestNoLinkForbidden(t *testing.T) {
	defer leaktest.AfterTest(t)
	if build.Default.GOPATH == "" {
		t.Skip("GOPATH isn't set")
	}

	// TODO(pmattis): Pass false instead of true for the cgo parameter once
	// rpc/codec can be compiled without the c-lz4 and c-snappy dependencies.
	imports, err := testutils.TransitiveImports("github.com/cockroachdb/cockroach/sql/driver", true)
	if err != nil {
		t.Fatal(err)
	}

	for _, forbidden := range []string{
		"C",       // cross compilation
		"testing", // defines flags
		"github.com/cockroachdb/cockroach/util/log", // defines flags
	} {
		if _, ok := imports[forbidden]; ok {
			t.Errorf("sql/driver includes %s, which is forbidden", forbidden)
		}
	}
}