Add android_ravenwood_test build rule

Modeled after android_robolectric_test.

Bug: 292141694
Test: m nothing --no-skip-soong-tests
Test: m hoststubgen ravenwood-runtime tradefed atest && atest-dev HostStubGenTest-framework-test
Merged-in: Ibef8953db45b86264c8a827868793b42f8f2d6ab
Change-Id: Ibef8953db45b86264c8a827868793b42f8f2d6ab
This commit is contained in:
Makoto Onuki
2023-10-20 10:42:47 -07:00
parent 55a829d74c
commit 4a9869d066
5 changed files with 325 additions and 1 deletions

View File

@@ -24,6 +24,7 @@ func testSuiteFilesFactory() Singleton {
type testSuiteFiles struct {
robolectric WritablePath
ravenwood WritablePath
}
type TestSuiteModule interface {
@@ -47,12 +48,15 @@ func (t *testSuiteFiles) GenerateBuildActions(ctx SingletonContext) {
})
t.robolectric = robolectricTestSuite(ctx, files["robolectric-tests"])
ctx.Phony("robolectric-tests", t.robolectric)
t.ravenwood = ravenwoodTestSuite(ctx, files["ravenwood-tests"])
ctx.Phony("ravenwood-tests", t.ravenwood)
}
func (t *testSuiteFiles) MakeVars(ctx MakeVarsContext) {
ctx.DistForGoal("robolectric-tests", t.robolectric)
ctx.DistForGoal("ravenwood-tests", t.ravenwood)
}
func robolectricTestSuite(ctx SingletonContext, files map[string]InstallPaths) WritablePath {
@@ -74,3 +78,23 @@ func robolectricTestSuite(ctx SingletonContext, files map[string]InstallPaths) W
return outputFile
}
func ravenwoodTestSuite(ctx SingletonContext, files map[string]InstallPaths) WritablePath {
var installedPaths InstallPaths
for _, module := range SortedKeys(files) {
installedPaths = append(installedPaths, files[module]...)
}
testCasesDir := pathForInstall(ctx, ctx.Config().BuildOS, X86, "testcases")
outputFile := PathForOutput(ctx, "packaging", "ravenwood-tests.zip")
rule := NewRuleBuilder(pctx, ctx)
rule.Command().BuiltTool("soong_zip").
FlagWithOutput("-o ", outputFile).
FlagWithArg("-P ", "host/testcases").
FlagWithArg("-C ", testCasesDir.String()).
FlagWithRspFileInputList("-r ", outputFile.ReplaceExtension(ctx, "rsp"), installedPaths.Paths()).
Flag("-sha256")
rule.Build("ravenwood_tests_zip", "ravenwood-tests.zip")
return outputFile
}