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

Commit a37ef683 authored by Jingwen Chen's avatar Jingwen Chen Committed by Gerrit Code Review
Browse files

Merge "bp2build: Convert cc_test.test_options.tags to cc_test.tags"

parents 31327e9a fbff97a8
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -917,6 +917,8 @@ type CommonAttributes struct {
	Name string
	// Data mapped from: Required
	Data bazel.LabelListAttribute

	Tags bazel.StringListAttribute
}

// constraintAttributes represents Bazel attributes pertaining to build constraints,
+24 −0
Original line number Diff line number Diff line
@@ -148,3 +148,27 @@ cc_test {
		},
	})
}

func TestCcTest_TestOptions_Tags(t *testing.T) {
	runCcTestTestCase(t, ccTestBp2buildTestCase{
		description: "cc test with test_options.tags converted to tags",
		blueprint: `
cc_test {
    name: "mytest",
    host_supported: true,
    srcs: ["test.cpp"],
    test_options: { tags: ["no-remote"] },
}
`,
		targets: []testBazelTarget{
			{"cc_test", "mytest", AttrNameToString{
				"tags":           `["no-remote"]`,
				"local_includes": `["."]`,
				"srcs":           `["test.cpp"]`,
				"gtest":          "True",
				"isolated":       "True",
			},
			},
		},
	})
}
+3 −0
Original line number Diff line number Diff line
@@ -659,6 +659,7 @@ func testBinaryBp2build(ctx android.TopDownMutatorContext, m *Module) {
	testBinaryAttrs.binaryAttributes = binaryBp2buildAttrs(ctx, m)

	var data bazel.LabelListAttribute
	var tags bazel.StringListAttribute

	testBinaryProps := m.GetArchVariantProperties(ctx, &TestBinaryProperties{})
	for axis, configToProps := range testBinaryProps {
@@ -670,6 +671,7 @@ func testBinaryBp2build(ctx android.TopDownMutatorContext, m *Module) {
				combinedData.Append(android.BazelLabelForModuleDeps(ctx, p.Data_bins))
				combinedData.Append(android.BazelLabelForModuleDeps(ctx, p.Data_libs))
				data.SetSelectValue(axis, config, combinedData)
				tags.SetSelectValue(axis, config, p.Test_options.Tags)
			}
		}
	}
@@ -690,6 +692,7 @@ func testBinaryBp2build(ctx android.TopDownMutatorContext, m *Module) {
		android.CommonAttributes{
			Name: m.Name(),
			Data: data,
			Tags: tags,
		},
		&testBinaryAttrs)
}