Add test for soong/testing/test_spec.
This CL adds test for test_spec.go and all_test_specs.go (singleton).
Bug: 296873595
Test: m nothing --no-skip-soong-tests -j96
Change-Id: I5010c68512e75d1b9a337c02da86faac15e376fe
diff --git a/testing/Android.bp b/testing/Android.bp
index 85e6a8b..18dccb3 100644
--- a/testing/Android.bp
+++ b/testing/Android.bp
@@ -15,6 +15,7 @@
"all_test_specs.go",
"test_spec.go",
"init.go",
+ "test.go",
],
pluginFor: ["soong_build"],
}
diff --git a/testing/all_test_specs.go b/testing/all_test_specs.go
index 2ecf15f..9d4645b 100644
--- a/testing/all_test_specs.go
+++ b/testing/all_test_specs.go
@@ -21,10 +21,10 @@
var intermediateMetadataPaths android.Paths
ctx.VisitAllModules(func(module android.Module) {
- if !ctx.ModuleHasProvider(module, testSpecProviderKey) {
+ if !ctx.ModuleHasProvider(module, TestSpecProviderKey) {
return
}
- intermediateMetadataPaths = append(intermediateMetadataPaths, ctx.ModuleProvider(module, testSpecProviderKey).(testSpecProviderData).IntermediatePath)
+ intermediateMetadataPaths = append(intermediateMetadataPaths, ctx.ModuleProvider(module, TestSpecProviderKey).(TestSpecProviderData).IntermediatePath)
})
rspFile := android.PathForOutput(ctx, fileContainingFilePaths)
diff --git a/testing/test.go b/testing/test.go
new file mode 100644
index 0000000..44824e4
--- /dev/null
+++ b/testing/test.go
@@ -0,0 +1,21 @@
+// Copyright 2023 Google Inc. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package testing
+
+import (
+ "android/soong/android"
+)
+
+var PrepareForTestWithTestSpecBuildComponents = android.FixtureRegisterWithContext(RegisterBuildComponents)
diff --git a/testing/test_spec.go b/testing/test_spec.go
index 1ad2768..c370f71 100644
--- a/testing/test_spec.go
+++ b/testing/test_spec.go
@@ -78,11 +78,11 @@
}
// Provider published by TestSpec
-type testSpecProviderData struct {
+type TestSpecProviderData struct {
IntermediatePath android.WritablePath
}
-var testSpecProviderKey = blueprint.NewProvider(testSpecProviderData{})
+var TestSpecProviderKey = blueprint.NewProvider(TestSpecProviderData{})
type TestModuleProviderData struct {
}
@@ -120,7 +120,7 @@
android.WriteFileRule(ctx, intermediatePath, string(protoData))
ctx.SetProvider(
- testSpecProviderKey, testSpecProviderData{
+ TestSpecProviderKey, TestSpecProviderData{
IntermediatePath: intermediatePath,
},
)