summaryrefslogtreecommitdiff
path: root/java/code_metadata_test.go
diff options
context:
space:
mode:
author Colin Cross <ccross@android.com> 2024-01-02 19:44:52 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2024-01-02 19:44:52 +0000
commita3759f98a63eb2ab4e0c6620d2e27d3434ee6ec0 (patch)
tree005d4dc8d8c8b0b178467f18a959b31cb7f2a8dd /java/code_metadata_test.go
parent64c9e0ce6e4aa183b2fae40a18e3e5435c49229d (diff)
parent31a674571e53f12dffb97698e65b9eee6ae0ebbc (diff)
Merge "Write raw files to disk instead of the ninja file" into main
Diffstat (limited to 'java/code_metadata_test.go')
-rw-r--r--java/code_metadata_test.go19
1 files changed, 5 insertions, 14 deletions
diff --git a/java/code_metadata_test.go b/java/code_metadata_test.go
index 509e70112..0ef348afe 100644
--- a/java/code_metadata_test.go
+++ b/java/code_metadata_test.go
@@ -25,12 +25,10 @@ func TestCodeMetadata(t *testing.T) {
}`
result := runCodeMetadataTest(t, android.FixtureExpectsNoErrors, bp)
- module := result.ModuleForTests(
- "module-name", "",
- ).Module().(*soongTesting.CodeMetadataModule)
+ module := result.ModuleForTests("module-name", "")
// Check that the provider has the right contents
- data, _ := android.SingletonModuleProvider(result, module, soongTesting.CodeMetadataProviderKey)
+ data, _ := android.SingletonModuleProvider(result, module.Module(), soongTesting.CodeMetadataProviderKey)
if !strings.HasSuffix(
data.IntermediatePath.String(), "/intermediateCodeMetadata.pb",
) {
@@ -40,13 +38,8 @@ func TestCodeMetadata(t *testing.T) {
)
}
- buildParamsSlice := module.BuildParamsForTests()
- var metadata = ""
- for _, params := range buildParamsSlice {
- if params.Rule.String() == "android/soong/android.writeFile" {
- metadata = params.Args["content"]
- }
- }
+ metadata := android.ContentFromFileRuleForTests(t, result.TestContext,
+ module.Output(data.IntermediatePath.String()))
metadataList := make([]*code_metadata_internal_proto.CodeMetadataInternal_TargetOwnership, 0, 2)
teamId := "12345"
@@ -63,9 +56,7 @@ func TestCodeMetadata(t *testing.T) {
CodeMetadataMetadata := code_metadata_internal_proto.CodeMetadataInternal{TargetOwnershipList: metadataList}
protoData, _ := proto.Marshal(&CodeMetadataMetadata)
- rawData := string(protoData)
- formattedData := strings.ReplaceAll(rawData, "\n", "\\n")
- expectedMetadata := "'" + formattedData + "\\n'"
+ expectedMetadata := string(protoData)
if metadata != expectedMetadata {
t.Errorf(