Create out/soong/packaging directory and put a placeholder manifest
file in it.

This CL creates a manifest file under
out/soong/packaging/<suite>/<suite>.json

The content currently only contains the name of the test suite.
Further works will actually build the dependencies and generate
full manifest.

Change-Id: I0e69cd364e0a3a84159a5e4d2d21edd9fe2fdca1
Bug: 372945132
diff --git a/android/paths.go b/android/paths.go
index bf2c3a0..96fa056 100644
--- a/android/paths.go
+++ b/android/paths.go
@@ -2057,6 +2057,10 @@
 	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
diff --git a/tradefed_modules/test_suite.go b/tradefed_modules/test_suite.go
index 8ab194d..a6c2727 100644
--- a/tradefed_modules/test_suite.go
+++ b/tradefed_modules/test_suite.go
@@ -15,6 +15,8 @@
 package tradefed_modules
 
 import (
+	"fmt"
+
 	"android/soong/android"
 )
 
@@ -42,7 +44,10 @@
 }
 
 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 {
diff --git a/tradefed_modules/test_suite_test.go b/tradefed_modules/test_suite_test.go
index f9e9da0..647ba4d 100644
--- a/tradefed_modules/test_suite_test.go
+++ b/tradefed_modules/test_suite_test.go
@@ -21,7 +21,7 @@
 
 func TestTestSuites(t *testing.T) {
 	t.Parallel()
-	android.GroupFixturePreparers(
+	ctx := android.GroupFixturePreparers(
 		java.PrepareForTestWithJavaDefaultModules,
 		android.FixtureRegisterWithContext(RegisterTestSuiteBuildComponents),
 	).RunTestWithBp(t, `
@@ -44,4 +44,10 @@
 			]
 		}
 	`)
+	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)
+	}
 }