Merge "Autogen python test config."
This commit is contained in:
commit
73f160bb39
|
@ -285,6 +285,7 @@ bootstrap_go_package {
|
||||||
deps: [
|
deps: [
|
||||||
"blueprint",
|
"blueprint",
|
||||||
"soong-android",
|
"soong-android",
|
||||||
|
"soong-tradefed",
|
||||||
],
|
],
|
||||||
srcs: [
|
srcs: [
|
||||||
"python/androidmk.go",
|
"python/androidmk.go",
|
||||||
|
|
|
@ -70,6 +70,11 @@ func (p *testDecorator) AndroidMk(base *Module, ret *android.AndroidMkData) {
|
||||||
if p.testProperties.Test_config != nil {
|
if p.testProperties.Test_config != nil {
|
||||||
fmt.Fprintln(w, "LOCAL_TEST_CONFIG :=",
|
fmt.Fprintln(w, "LOCAL_TEST_CONFIG :=",
|
||||||
*p.testProperties.Test_config)
|
*p.testProperties.Test_config)
|
||||||
|
} else {
|
||||||
|
if p.testConfig != nil {
|
||||||
|
fmt.Fprintln(w, "LOCAL_FULL_TEST_CONFIG :=",
|
||||||
|
p.testConfig.String())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
base.subAndroidMk(ret, p.binaryDecorator.pythonInstaller)
|
base.subAndroidMk(ret, p.binaryDecorator.pythonInstaller)
|
||||||
|
|
|
@ -16,6 +16,7 @@ package python
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"android/soong/android"
|
"android/soong/android"
|
||||||
|
"android/soong/tradefed"
|
||||||
)
|
)
|
||||||
|
|
||||||
// This file contains the module types for building Python test.
|
// This file contains the module types for building Python test.
|
||||||
|
@ -29,12 +30,18 @@ type TestProperties struct {
|
||||||
// the name of the test configuration (for example "AndroidTest.xml") that should be
|
// the name of the test configuration (for example "AndroidTest.xml") that should be
|
||||||
// installed with the module.
|
// installed with the module.
|
||||||
Test_config *string `android:"arch_variant"`
|
Test_config *string `android:"arch_variant"`
|
||||||
|
|
||||||
|
// the name of the test configuration template (for example "AndroidTestTemplate.xml") that
|
||||||
|
// should be installed with the module.
|
||||||
|
Test_config_template *string `android:"arch_variant"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type testDecorator struct {
|
type testDecorator struct {
|
||||||
*binaryDecorator
|
*binaryDecorator
|
||||||
|
|
||||||
testProperties TestProperties
|
testProperties TestProperties
|
||||||
|
|
||||||
|
testConfig android.Path
|
||||||
}
|
}
|
||||||
|
|
||||||
func (test *testDecorator) bootstrapperProps() []interface{} {
|
func (test *testDecorator) bootstrapperProps() []interface{} {
|
||||||
|
@ -42,6 +49,9 @@ func (test *testDecorator) bootstrapperProps() []interface{} {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (test *testDecorator) install(ctx android.ModuleContext, file android.Path) {
|
func (test *testDecorator) install(ctx android.ModuleContext, file android.Path) {
|
||||||
|
test.testConfig = tradefed.AutoGenPythonBinaryHostTestConfig(ctx, test.testProperties.Test_config,
|
||||||
|
test.testProperties.Test_config_template)
|
||||||
|
|
||||||
test.binaryDecorator.pythonInstaller.dir = "nativetest"
|
test.binaryDecorator.pythonInstaller.dir = "nativetest"
|
||||||
test.binaryDecorator.pythonInstaller.dir64 = "nativetest64"
|
test.binaryDecorator.pythonInstaller.dir64 = "nativetest64"
|
||||||
|
|
||||||
|
|
|
@ -118,6 +118,22 @@ func AutoGenJavaTestConfig(ctx android.ModuleContext, testConfigProp *string, te
|
||||||
return path
|
return path
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func AutoGenPythonBinaryHostTestConfig(ctx android.ModuleContext, testConfigProp *string,
|
||||||
|
testConfigTemplateProp *string) android.Path {
|
||||||
|
|
||||||
|
path, autogenPath := testConfigPath(ctx, testConfigProp)
|
||||||
|
if autogenPath != nil {
|
||||||
|
templatePath := getTestConfigTemplate(ctx, testConfigTemplateProp)
|
||||||
|
if templatePath.Valid() {
|
||||||
|
autogenTemplate(ctx, autogenPath, templatePath.String())
|
||||||
|
} else {
|
||||||
|
autogenTemplate(ctx, autogenPath, "${PythonBinaryHostTestConfigTemplate}")
|
||||||
|
}
|
||||||
|
return autogenPath
|
||||||
|
}
|
||||||
|
return path
|
||||||
|
}
|
||||||
|
|
||||||
var autogenInstrumentationTest = pctx.StaticRule("autogenInstrumentationTest", blueprint.RuleParams{
|
var autogenInstrumentationTest = pctx.StaticRule("autogenInstrumentationTest", blueprint.RuleParams{
|
||||||
Command: "${AutoGenTestConfigScript} $out $in ${EmptyTestConfig} $template",
|
Command: "${AutoGenTestConfigScript} $out $in ${EmptyTestConfig} $template",
|
||||||
CommandDeps: []string{
|
CommandDeps: []string{
|
||||||
|
|
|
@ -30,6 +30,7 @@ func init() {
|
||||||
pctx.SourcePathVariable("NativeBenchmarkTestConfigTemplate", "build/make/core/native_benchmark_test_config_template.xml")
|
pctx.SourcePathVariable("NativeBenchmarkTestConfigTemplate", "build/make/core/native_benchmark_test_config_template.xml")
|
||||||
pctx.SourcePathVariable("NativeHostTestConfigTemplate", "build/make/core/native_host_test_config_template.xml")
|
pctx.SourcePathVariable("NativeHostTestConfigTemplate", "build/make/core/native_host_test_config_template.xml")
|
||||||
pctx.SourcePathVariable("NativeTestConfigTemplate", "build/make/core/native_test_config_template.xml")
|
pctx.SourcePathVariable("NativeTestConfigTemplate", "build/make/core/native_test_config_template.xml")
|
||||||
|
pctx.SourcePathVariable("PythonBinaryHostTestConfigTemplate", "build/make/core/python_binary_host_test_config_template.xml")
|
||||||
|
|
||||||
pctx.SourcePathVariable("EmptyTestConfig", "build/make/core/empty_test_config.xml")
|
pctx.SourcePathVariable("EmptyTestConfig", "build/make/core/empty_test_config.xml")
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,7 @@ func makeVarsProvider(ctx android.MakeVarsContext) {
|
||||||
ctx.Strict("NATIVE_BENCHMARK_TEST_CONFIG_TEMPLATE", "${NativeBenchmarkTestConfigTemplate}")
|
ctx.Strict("NATIVE_BENCHMARK_TEST_CONFIG_TEMPLATE", "${NativeBenchmarkTestConfigTemplate}")
|
||||||
ctx.Strict("NATIVE_HOST_TEST_CONFIG_TEMPLATE", "${NativeHostTestConfigTemplate}")
|
ctx.Strict("NATIVE_HOST_TEST_CONFIG_TEMPLATE", "${NativeHostTestConfigTemplate}")
|
||||||
ctx.Strict("NATIVE_TEST_CONFIG_TEMPLATE", "${NativeTestConfigTemplate}")
|
ctx.Strict("NATIVE_TEST_CONFIG_TEMPLATE", "${NativeTestConfigTemplate}")
|
||||||
|
ctx.Strict("PYTHON_BINARY_HOST_TEST_CONFIG_TEMPLATE", "${PythonBinaryHostTestConfigTemplate}")
|
||||||
|
|
||||||
ctx.Strict("EMPTY_TEST_CONFIG", "${EmptyTestConfig}")
|
ctx.Strict("EMPTY_TEST_CONFIG", "${EmptyTestConfig}")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue