コード例 #1
0
ファイル: flags_test.go プロジェクト: liugangnhm/cockroach
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)
		}
	}
}
コード例 #2
0
ファイル: link_test.go プロジェクト: nporsche/cockroach
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)
		}
	}
}
コード例 #3
0
ファイル: link_test.go プロジェクト: kaustubhkurve/cockroach
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)
		}
	}
}