Loading android/paths.go +4 −0 Original line number Diff line number Diff line Loading @@ -2092,6 +2092,10 @@ func PathForMainlineSdksInstall(ctx PathContext, paths ...string) InstallPath { return base.Join(ctx, paths...) } func PathForSuiteInstall(ctx PathContext, suite string, pathComponents ...string) InstallPath { return pathForPartitionInstallDir(ctx, "test_suites", "test_suites", false).Join(ctx, suite).Join(ctx, pathComponents...) } func InstallPathToOnDevicePath(ctx PathContext, path InstallPath) string { rel := Rel(ctx, strings.TrimSuffix(path.PartitionDir(), path.partition), path.String()) return "/" + rel Loading tradefed_modules/test_suite.go +6 −1 Original line number Diff line number Diff line Loading @@ -15,6 +15,8 @@ package tradefed_modules import ( "fmt" "android/soong/android" ) Loading Loading @@ -42,7 +44,10 @@ type testSuiteModule struct { } func (t *testSuiteModule) GenerateAndroidBuildActions(ctx android.ModuleContext) { // TODO(hwj): Implement this. suiteName := ctx.ModuleName() manifestPath := android.PathForSuiteInstall(ctx, suiteName, suiteName+".json") android.WriteFileRule(ctx, manifestPath, fmt.Sprintf(`{"name": %q}`, suiteName)) ctx.Phony(suiteName, manifestPath) } func TestSuiteFactory() android.Module { Loading tradefed_modules/test_suite_test.go +7 −1 Original line number Diff line number Diff line Loading @@ -21,7 +21,7 @@ import ( func TestTestSuites(t *testing.T) { t.Parallel() android.GroupFixturePreparers( ctx := android.GroupFixturePreparers( java.PrepareForTestWithJavaDefaultModules, android.FixtureRegisterWithContext(RegisterTestSuiteBuildComponents), ).RunTestWithBp(t, ` Loading @@ -44,4 +44,10 @@ func TestTestSuites(t *testing.T) { ] } `) manifestPath := ctx.ModuleForTests("my-suite", "").Output("out/soong/test_suites/my-suite/my-suite.json") got := android.ContentFromFileRuleForTests(t, ctx.TestContext, manifestPath) want := `{"name": "my-suite"}` + "\n" if got != want { t.Errorf("my-suite.json content was %q, want %q", got, want) } } Loading
android/paths.go +4 −0 Original line number Diff line number Diff line Loading @@ -2092,6 +2092,10 @@ func PathForMainlineSdksInstall(ctx PathContext, paths ...string) InstallPath { return base.Join(ctx, paths...) } func PathForSuiteInstall(ctx PathContext, suite string, pathComponents ...string) InstallPath { return pathForPartitionInstallDir(ctx, "test_suites", "test_suites", false).Join(ctx, suite).Join(ctx, pathComponents...) } func InstallPathToOnDevicePath(ctx PathContext, path InstallPath) string { rel := Rel(ctx, strings.TrimSuffix(path.PartitionDir(), path.partition), path.String()) return "/" + rel Loading
tradefed_modules/test_suite.go +6 −1 Original line number Diff line number Diff line Loading @@ -15,6 +15,8 @@ package tradefed_modules import ( "fmt" "android/soong/android" ) Loading Loading @@ -42,7 +44,10 @@ type testSuiteModule struct { } func (t *testSuiteModule) GenerateAndroidBuildActions(ctx android.ModuleContext) { // TODO(hwj): Implement this. suiteName := ctx.ModuleName() manifestPath := android.PathForSuiteInstall(ctx, suiteName, suiteName+".json") android.WriteFileRule(ctx, manifestPath, fmt.Sprintf(`{"name": %q}`, suiteName)) ctx.Phony(suiteName, manifestPath) } func TestSuiteFactory() android.Module { Loading
tradefed_modules/test_suite_test.go +7 −1 Original line number Diff line number Diff line Loading @@ -21,7 +21,7 @@ import ( func TestTestSuites(t *testing.T) { t.Parallel() android.GroupFixturePreparers( ctx := android.GroupFixturePreparers( java.PrepareForTestWithJavaDefaultModules, android.FixtureRegisterWithContext(RegisterTestSuiteBuildComponents), ).RunTestWithBp(t, ` Loading @@ -44,4 +44,10 @@ func TestTestSuites(t *testing.T) { ] } `) manifestPath := ctx.ModuleForTests("my-suite", "").Output("out/soong/test_suites/my-suite/my-suite.json") got := android.ContentFromFileRuleForTests(t, ctx.TestContext, manifestPath) want := `{"name": "my-suite"}` + "\n" if got != want { t.Errorf("my-suite.json content was %q, want %q", got, want) } }