rust: Add require_root and vendor install base

Adds the require_root property to rust_test modules so that tests can
run as root. Also adds an install base to allow vendor tests to install
to a different path, otherwise installs to 'unrestricted' like cc_test.

Bug: 200602232
Test: test with require_root: true runs as root
Test: test installed to new base directory
Change-Id: Ifa716871ff87471f0c0caff7af558d47db85ccd1
This commit is contained in:
Ivan Lozano
2021-09-21 10:49:13 -04:00
parent 1b15345ac9
commit ba2226164c
2 changed files with 25 additions and 6 deletions

View File

@@ -227,17 +227,17 @@ func AutoGenPythonBinaryHostTestConfig(ctx android.ModuleContext, testConfigProp
}
func AutoGenRustTestConfig(ctx android.ModuleContext, testConfigProp *string,
testConfigTemplateProp *string, testSuites []string, config []Config, autoGenConfig *bool) android.Path {
testConfigTemplateProp *string, testSuites []string, config []Config, autoGenConfig *bool, testInstallBase string) android.Path {
path, autogenPath := testConfigPath(ctx, testConfigProp, testSuites, autoGenConfig, testConfigTemplateProp)
if autogenPath != nil {
templatePath := getTestConfigTemplate(ctx, testConfigTemplateProp)
if templatePath.Valid() {
autogenTemplate(ctx, autogenPath, templatePath.String(), config, "")
autogenTemplate(ctx, autogenPath, templatePath.String(), config, testInstallBase)
} else {
if ctx.Device() {
autogenTemplate(ctx, autogenPath, "${RustDeviceTestConfigTemplate}", config, "")
autogenTemplate(ctx, autogenPath, "${RustDeviceTestConfigTemplate}", config, testInstallBase)
} else {
autogenTemplate(ctx, autogenPath, "${RustHostTestConfigTemplate}", config, "")
autogenTemplate(ctx, autogenPath, "${RustHostTestConfigTemplate}", config, testInstallBase)
}
}
return autogenPath