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

zeek@ has been tagging unit tests that cannot run on RBE with
"no-remote". While we don't yet have RBE support with standalone `b
test` yet, we can make sure to propagate the tags now.

Bug: 236973602

Test: new unit test
Change-Id: I6d0648f184626bb01c657068804f99ffb82907a3
diff --git a/android/module.go b/android/module.go
index 5908233..d1441f2 100644
--- a/android/module.go
+++ b/android/module.go
@@ -917,6 +917,8 @@
 	Name string
 	// Data mapped from: Required
 	Data bazel.LabelListAttribute
+
+	Tags bazel.StringListAttribute
 }
 
 // constraintAttributes represents Bazel attributes pertaining to build constraints,
diff --git a/bp2build/cc_test_conversion_test.go b/bp2build/cc_test_conversion_test.go
index 9b7748f..8c2d30d 100644
--- a/bp2build/cc_test_conversion_test.go
+++ b/bp2build/cc_test_conversion_test.go
@@ -148,3 +148,27 @@
 		},
 	})
 }
+
+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",
+			},
+			},
+		},
+	})
+}
diff --git a/cc/test.go b/cc/test.go
index 28a0e5e..715c537 100644
--- a/cc/test.go
+++ b/cc/test.go
@@ -659,6 +659,7 @@
 	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 @@
 				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 @@
 		android.CommonAttributes{
 			Name: m.Name(),
 			Data: data,
+			Tags: tags,
 		},
 		&testBinaryAttrs)
 }