Support 'test_config' into soong modules

Test: make general-tests
Bug: 110982517
Change-Id: Ib2eab2653fdfce6f699b85c9fbc64558b6d40363
diff --git a/python/androidmk.go b/python/androidmk.go
index 365b422..20861cb 100644
--- a/python/androidmk.go
+++ b/python/androidmk.go
@@ -66,6 +66,11 @@
 			fmt.Fprintln(w, "LOCAL_COMPATIBILITY_SUITE :=",
 				strings.Join(p.binaryDecorator.binaryProperties.Test_suites, " "))
 		}
+		// If the test config has an explicit config specified use it.
+		if p.testProperties.Test_config != nil {
+			fmt.Fprintln(w, "LOCAL_TEST_CONFIG :=",
+				*p.testProperties.Test_config)
+		}
 	})
 	base.subAndroidMk(ret, p.binaryDecorator.pythonInstaller)
 }
diff --git a/python/test.go b/python/test.go
index 825e63c..39326f0 100644
--- a/python/test.go
+++ b/python/test.go
@@ -25,8 +25,20 @@
 	android.RegisterModuleType("python_test", PythonTestFactory)
 }
 
+type TestProperties struct {
+	// the name of the test configuration (for example "AndroidTest.xml") that should be
+	// installed with the module.
+	Test_config *string `android:"arch_variant"`
+}
+
 type testDecorator struct {
 	*binaryDecorator
+
+	testProperties TestProperties
+}
+
+func (test *testDecorator) bootstrapperProps() []interface{} {
+	return append(test.binaryDecorator.bootstrapperProps(), &test.testProperties)
 }
 
 func (test *testDecorator) install(ctx android.ModuleContext, file android.Path) {