Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e2f45d3e authored by Rupert Shuttleworth's avatar Rupert Shuttleworth Committed by Gerrit Code Review
Browse files

Merge "Move some implicitly shared testing code for bp2build into testing.go."

parents 40aa4363 06559d07
Loading
Loading
Loading
Loading
+8 −19
Original line number Diff line number Diff line
@@ -324,11 +324,11 @@ custom {
		ctx.RegisterForBazelConversion()

		_, errs := ctx.ParseFileList(dir, []string{"Android.bp"})
		if Errored(t, "", errs) {
		if errored(t, "", errs) {
			continue
		}
		_, errs = ctx.ResolveDependencies(config)
		if Errored(t, "", errs) {
		if errored(t, "", errs) {
			continue
		}

@@ -925,11 +925,11 @@ genrule {
		ctx.RegisterForBazelConversion()

		_, errs := ctx.ParseFileList(dir, toParse)
		if Errored(t, testCase.description, errs) {
		if errored(t, testCase.description, errs) {
			continue
		}
		_, errs = ctx.ResolveDependencies(config)
		if Errored(t, testCase.description, errs) {
		if errored(t, testCase.description, errs) {
			continue
		}

@@ -957,17 +957,6 @@ genrule {
	}
}

func Errored(t *testing.T, desc string, errs []error) bool {
	t.Helper()
	if len(errs) > 0 {
		for _, err := range errs {
			t.Errorf("%s: %s", desc, err)
		}
		return true
	}
	return false
}

type bp2buildMutator = func(android.TopDownMutatorContext)

func TestBp2BuildInlinesDefaults(t *testing.T) {
@@ -1483,11 +1472,11 @@ filegroup {
		ctx.RegisterForBazelConversion()

		_, errs := ctx.ParseFileList(dir, toParse)
		if Errored(t, testCase.description, errs) {
		if errored(t, testCase.description, errs) {
			continue
		}
		_, errs = ctx.ResolveDependencies(config)
		if Errored(t, testCase.description, errs) {
		if errored(t, testCase.description, errs) {
			continue
		}

@@ -1606,11 +1595,11 @@ func TestGlobExcludeSrcs(t *testing.T) {
		ctx.RegisterForBazelConversion()

		_, errs := ctx.ParseFileList(dir, toParse)
		if Errored(t, testCase.description, errs) {
		if errored(t, testCase.description, errs) {
			continue
		}
		_, errs = ctx.ResolveDependencies(config)
		if Errored(t, testCase.description, errs) {
		if errored(t, testCase.description, errs) {
			continue
		}

+0 −2
Original line number Diff line number Diff line
@@ -22,8 +22,6 @@ import (
	"testing"
)

var buildDir string

func setUp() {
	var err error
	buildDir, err = ioutil.TempDir("", "bazel_queryview_test")
+2 −2
Original line number Diff line number Diff line
@@ -617,11 +617,11 @@ cc_library {
		ctx.RegisterForBazelConversion()

		_, errs := ctx.ParseFileList(dir, toParse)
		if Errored(t, testCase.description, errs) {
		if errored(t, testCase.description, errs) {
			continue
		}
		_, errs = ctx.ResolveDependencies(config)
		if Errored(t, testCase.description, errs) {
		if errored(t, testCase.description, errs) {
			continue
		}

+2 −2
Original line number Diff line number Diff line
@@ -385,11 +385,11 @@ cc_library_headers {
		ctx.RegisterForBazelConversion()

		_, errs := ctx.ParseFileList(dir, toParse)
		if Errored(t, testCase.description, errs) {
		if errored(t, testCase.description, errs) {
			continue
		}
		_, errs = ctx.ResolveDependencies(config)
		if Errored(t, testCase.description, errs) {
		if errored(t, testCase.description, errs) {
			continue
		}

+2 −2
Original line number Diff line number Diff line
@@ -1132,11 +1132,11 @@ cc_library_static {
		ctx.RegisterForBazelConversion()

		_, errs := ctx.ParseFileList(dir, toParse)
		if Errored(t, testCase.description, errs) {
		if errored(t, testCase.description, errs) {
			continue
		}
		_, errs = ctx.ResolveDependencies(config)
		if Errored(t, testCase.description, errs) {
		if errored(t, testCase.description, errs) {
			continue
		}

Loading