test_module_config for sh_test
[retry reverted 45dca5c8cc538392edbde4ee1077fc86509b2e38 after rebase]
Implemented test_module_config for sh_tests.
There are some shell tests that have 130 cc_binaries and they get
duplicated in the vts .zip. test_module_config allows deduping for
lowmem and hwasan use cases freeing a 1 G in the zip.
Moved some of the knowledge about constructing the make rules back to
the provider.
I haven't tried this for cc_test or rust_test, but I think it will be
similar to sh_test if we ever need it.
There is currently only one usecase for using test_module_config with
sh_test (and none for cc_ or rust_)
Also added "extra_test_configs" to sh_test
Sample bp file.
test_module_config {
name: "vts_ltp_tmc",
base: "vts_ltp_test_x86_64",
test_suites: [
"general-tests",
"vts"
],
options: [
{name: "is-low-mem", value: "false"},
{name: "is-hwasan", value: "true"},
],
}
Test: go test ./
Test: m vts_ltp_test_x86_64_hwasan
Test: atest vts_ltp_test_x86_64_hwasan
Test: m vts # inspect the zip for symlinks
Test: CtsAppTestCases_android_server_am
Test: atest -c -v vts_ltp_test_x86_64:vts_ltp_test_x86_64_hwa
Change-Id: I208797f97e3448bcff7434630adfd7476fc275f9
diff --git a/java/app.go b/java/app.go
index 94c9e5b..0939d17 100644
--- a/java/app.go
+++ b/java/app.go
@@ -1465,8 +1465,9 @@
a.data = append(a.data, android.PathsForModuleSrc(ctx, a.testProperties.Device_common_data)...)
a.data = append(a.data, android.PathsForModuleSrc(ctx, a.testProperties.Device_first_data)...)
a.data = append(a.data, android.PathsForModuleSrc(ctx, a.testProperties.Device_first_prefer32_data)...)
+
android.SetProvider(ctx, tradefed.BaseTestProviderKey, tradefed.BaseTestProviderData{
- InstalledFiles: a.data,
+ TestcaseRelDataFiles: testcaseRel(a.data),
OutputFile: a.OutputFile(),
TestConfig: a.testConfig,
HostRequiredModuleNames: a.HostRequiredModuleNames(),
@@ -1474,6 +1475,8 @@
IsHost: false,
LocalCertificate: a.certificate.AndroidMkString(),
IsUnitTest: Bool(a.testProperties.Test_options.Unit_test),
+ MkInclude: "$(BUILD_SYSTEM)/soong_app_prebuilt.mk",
+ MkAppClass: "APPS",
})
android.SetProvider(ctx, android.TestOnlyProviderKey, android.TestModuleInformation{
TestOnly: true,
@@ -1482,6 +1485,14 @@
}
+func testcaseRel(paths android.Paths) []string {
+ relPaths := []string{}
+ for _, p := range paths {
+ relPaths = append(relPaths, p.Rel())
+ }
+ return relPaths
+}
+
func (a *AndroidTest) FixTestConfig(ctx android.ModuleContext, testConfig android.Path) android.Path {
if testConfig == nil {
return nil
diff --git a/java/java.go b/java/java.go
index 1d572fa..078f578 100644
--- a/java/java.go
+++ b/java/java.go
@@ -1557,14 +1557,16 @@
j.Test.generateAndroidBuildActionsWithConfig(ctx, configs)
android.SetProvider(ctx, tradefed.BaseTestProviderKey, tradefed.BaseTestProviderData{
- InstalledFiles: j.data,
- OutputFile: j.outputFile,
- TestConfig: j.testConfig,
- RequiredModuleNames: j.RequiredModuleNames(ctx),
- TestSuites: j.testProperties.Test_suites,
- IsHost: true,
- LocalSdkVersion: j.sdkVersion.String(),
- IsUnitTest: Bool(j.testProperties.Test_options.Unit_test),
+ TestcaseRelDataFiles: testcaseRel(j.data),
+ OutputFile: j.outputFile,
+ TestConfig: j.testConfig,
+ RequiredModuleNames: j.RequiredModuleNames(ctx),
+ TestSuites: j.testProperties.Test_suites,
+ IsHost: true,
+ LocalSdkVersion: j.sdkVersion.String(),
+ IsUnitTest: Bool(j.testProperties.Test_options.Unit_test),
+ MkInclude: "$(BUILD_SYSTEM)/soong_java_prebuilt.mk",
+ MkAppClass: "JAVA_LIBRARIES",
})
}
diff --git a/sh/sh_binary.go b/sh/sh_binary.go
index 853f3d3..320e97f 100644
--- a/sh/sh_binary.go
+++ b/sh/sh_binary.go
@@ -15,6 +15,7 @@
package sh
import (
+ "fmt"
"path/filepath"
"strings"
@@ -164,6 +165,9 @@
// Test options.
Test_options android.CommonTestOptions
+
+ // a list of extra test configuration files that should be installed with the module.
+ Extra_test_configs []string `android:"path,arch_variant"`
}
type ShBinary struct {
@@ -186,8 +190,9 @@
installDir android.InstallPath
- data []android.DataPath
- testConfig android.Path
+ data []android.DataPath
+ testConfig android.Path
+ extraTestConfigs android.Paths
dataModules map[string]android.Path
}
@@ -471,6 +476,7 @@
HostTemplate: "${ShellTestConfigTemplate}",
})
+ s.extraTestConfigs = android.PathsForModuleSrc(ctx, s.testProperties.Extra_test_configs)
s.dataModules = make(map[string]android.Path)
ctx.VisitDirectDeps(func(dep android.Module) {
depTag := ctx.OtherModuleDependencyTag(dep)
@@ -510,6 +516,27 @@
installedData := ctx.InstallTestData(s.installDir, s.data)
s.installedFile = ctx.InstallExecutable(s.installDir, s.outputFilePath.Base(), s.outputFilePath, installedData...)
+
+ mkEntries := s.AndroidMkEntries()[0]
+ android.SetProvider(ctx, tradefed.BaseTestProviderKey, tradefed.BaseTestProviderData{
+ TestcaseRelDataFiles: addArch(ctx.Arch().ArchType.String(), installedData.Paths()),
+ OutputFile: s.outputFilePath,
+ TestConfig: s.testConfig,
+ TestSuites: s.testProperties.Test_suites,
+ IsHost: false,
+ IsUnitTest: Bool(s.testProperties.Test_options.Unit_test),
+ MkInclude: mkEntries.Include,
+ MkAppClass: mkEntries.Class,
+ InstallDir: s.installDir,
+ })
+}
+
+func addArch(archType string, paths android.Paths) []string {
+ archRelPaths := []string{}
+ for _, p := range paths {
+ archRelPaths = append(archRelPaths, fmt.Sprintf("%s/%s", archType, p.Rel()))
+ }
+ return archRelPaths
}
func (s *ShTest) InstallInData() bool {
@@ -533,6 +560,9 @@
entries.AddStrings("LOCAL_TEST_DATA_BINS", s.testProperties.Data_bins...)
}
entries.SetBoolIfTrue("LOCAL_COMPATIBILITY_PER_TESTCASE_DIRECTORY", Bool(s.testProperties.Per_testcase_directory))
+ if len(s.extraTestConfigs) > 0 {
+ entries.AddStrings("LOCAL_EXTRA_FULL_TEST_CONFIGS", s.extraTestConfigs.Strings()...)
+ }
s.testProperties.Test_options.SetAndroidMkEntries(entries)
},
diff --git a/sh/sh_binary_test.go b/sh/sh_binary_test.go
index 5a50439..28f997d 100644
--- a/sh/sh_binary_test.go
+++ b/sh/sh_binary_test.go
@@ -176,6 +176,22 @@
android.AssertBoolEquals(t, "LOCAL_IS_UNIT_TEST", true, actualData)
}
+func TestShTestExtraTestConfig(t *testing.T) {
+ result, _ := testShBinary(t, `
+ sh_test {
+ name: "foo",
+ src: "test.sh",
+ filename: "test.sh",
+ extra_test_configs: ["config1.xml", "config2.xml"],
+ }
+ `)
+
+ mod := result.ModuleForTests("foo", "android_arm64_armv8-a").Module().(*ShTest)
+ entries := android.AndroidMkEntriesForTest(t, result, mod)[0]
+ actualData := entries.EntryMap["LOCAL_EXTRA_FULL_TEST_CONFIGS"]
+ android.AssertStringPathsRelativeToTopEquals(t, "extra_configs", result.Config(), []string{"config1.xml", "config2.xml"}, actualData)
+}
+
func TestShTestHost_dataDeviceModules(t *testing.T) {
ctx, config := testShBinary(t, `
sh_test_host {
diff --git a/tradefed/providers.go b/tradefed/providers.go
index 0abac12..0ae841d 100644
--- a/tradefed/providers.go
+++ b/tradefed/providers.go
@@ -9,8 +9,8 @@
// Data that test_module_config[_host] modules types will need from
// their dependencies to write out build rules and AndroidMkEntries.
type BaseTestProviderData struct {
- // data files and apps for android_test
- InstalledFiles android.Paths
+ // data files and apps installed for tests, relative to testcases dir.
+ TestcaseRelDataFiles []string
// apk for android_test
OutputFile android.Path
// Either handwritten or generated TF xml.
@@ -28,6 +28,12 @@
LocalCertificate string
// Indicates if the base module was a unit test.
IsUnitTest bool
+ // The .mk file is used AndroidMkEntries for base (soong_java_prebuilt, etc.)
+ MkInclude string
+ // The AppClass to use for the AndroidMkEntries for the base.
+ MkAppClass string
+ // value for LOCAL_MODULE_PATH. The directory where the module is installed.
+ InstallDir android.InstallPath
}
var BaseTestProviderKey = blueprint.NewProvider[BaseTestProviderData]()
diff --git a/tradefed_modules/Android.bp b/tradefed_modules/Android.bp
index 67d91b2..a765a05 100644
--- a/tradefed_modules/Android.bp
+++ b/tradefed_modules/Android.bp
@@ -9,6 +9,7 @@
"blueprint",
"soong-android",
"soong-java",
+ "soong-sh",
"soong-tradefed",
],
srcs: [
diff --git a/tradefed_modules/test_module_config.go b/tradefed_modules/test_module_config.go
index 5c13d64..988352c 100644
--- a/tradefed_modules/test_module_config.go
+++ b/tradefed_modules/test_module_config.go
@@ -196,7 +196,7 @@
module := &testModuleConfigModule{}
module.AddProperties(&module.tradefedProperties)
- android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon)
+ android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
android.InitDefaultableModule(module)
return module
@@ -216,13 +216,28 @@
// Implements android.AndroidMkEntriesProvider
var _ android.AndroidMkEntriesProvider = (*testModuleConfigModule)(nil)
+func (m *testModuleConfigModule) nativeExtraEntries(entries *android.AndroidMkEntries) {
+ // TODO(ron) provider for suffix and STEM?
+ entries.SetString("LOCAL_MODULE_SUFFIX", "")
+ // Should the stem and path use the base name or our module name?
+ entries.SetString("LOCAL_MODULE_STEM", m.provider.OutputFile.Rel())
+ entries.SetPath("LOCAL_MODULE_PATH", m.provider.InstallDir)
+}
+
+func (m *testModuleConfigModule) javaExtraEntries(entries *android.AndroidMkEntries) {
+ // The app_prebuilt_internal.mk files try create a copy of the OutputFile as an .apk.
+ // Normally, this copies the "package.apk" from the intermediate directory here.
+ // To prevent the copy of the large apk and to prevent confusion with the real .apk we
+ // link to, we set the STEM here to a bogus name and we set OutputFile to a small file (our manifest).
+ // We do this so we don't have to add more conditionals to base_rules.mk
+ // soong_java_prebult has the same issue for .jars so use this in both module types.
+ entries.SetString("LOCAL_MODULE_STEM", fmt.Sprintf("UNUSED-%s", *m.Base))
+ entries.SetString("LOCAL_MODULE_TAGS", "tests")
+}
+
func (m *testModuleConfigModule) AndroidMkEntries() []android.AndroidMkEntries {
- appClass := "APPS"
- include := "$(BUILD_SYSTEM)/soong_app_prebuilt.mk"
- if m.isHost {
- appClass = "JAVA_LIBRARIES"
- include = "$(BUILD_SYSTEM)/soong_java_prebuilt.mk"
- }
+ appClass := m.provider.MkAppClass
+ include := m.provider.MkInclude
return []android.AndroidMkEntries{{
Class: appClass,
OutputFile: android.OptionalPathForPath(m.manifest),
@@ -231,7 +246,6 @@
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
entries.SetPath("LOCAL_FULL_TEST_CONFIG", m.testConfig)
- entries.SetString("LOCAL_MODULE_TAGS", "tests")
entries.SetString("LOCAL_TEST_MODULE_CONFIG_BASE", *m.Base)
if m.provider.LocalSdkVersion != "" {
entries.SetString("LOCAL_SDK_VERSION", m.provider.LocalSdkVersion)
@@ -244,13 +258,11 @@
entries.AddCompatibilityTestSuites(m.tradefedProperties.Test_suites...)
entries.AddStrings("LOCAL_HOST_REQUIRED_MODULES", m.provider.HostRequiredModuleNames...)
- // The app_prebuilt_internal.mk files try create a copy of the OutputFile as an .apk.
- // Normally, this copies the "package.apk" from the intermediate directory here.
- // To prevent the copy of the large apk and to prevent confusion with the real .apk we
- // link to, we set the STEM here to a bogus name and we set OutputFile to a small file (our manifest).
- // We do this so we don't have to add more conditionals to base_rules.mk
- // soong_java_prebult has the same issue for .jars so use this in both module types.
- entries.SetString("LOCAL_MODULE_STEM", fmt.Sprintf("UNUSED-%s", *m.Base))
+ if m.provider.MkAppClass == "NATIVE_TESTS" {
+ m.nativeExtraEntries(entries)
+ } else {
+ m.javaExtraEntries(entries)
+ }
// In normal java/app modules, the module writes LOCAL_COMPATIBILITY_SUPPORT_FILES
// and then base_rules.mk ends up copying each of those dependencies from .intermediates to the install directory.
@@ -357,16 +369,19 @@
// FrameworksServicesTests
// └── x86_64
// └── FrameworksServicesTests.apk
- symlinkName := fmt.Sprintf("%s/%s", ctx.DeviceConfig().DeviceArch(), baseApk.Base())
- // Only android_test, not java_host_test puts the output in the DeviceArch dir.
- if m.provider.IsHost || ctx.DeviceConfig().DeviceArch() == "" {
- // testcases/CtsDevicePolicyManagerTestCases
- // ├── CtsDevicePolicyManagerTestCases.jar
- symlinkName = baseApk.Base()
+ if m.provider.MkAppClass != "NATIVE_TESTS" {
+ symlinkName := fmt.Sprintf("%s/%s", ctx.DeviceConfig().DeviceArch(), baseApk.Base())
+ // Only android_test, not java_host_test puts the output in the DeviceArch dir.
+ if m.provider.IsHost || ctx.DeviceConfig().DeviceArch() == "" {
+ // testcases/CtsDevicePolicyManagerTestCases
+ // ├── CtsDevicePolicyManagerTestCases.jar
+ symlinkName = baseApk.Base()
+ }
+
+ target := installedBaseRelativeToHere(symlinkName, *m.tradefedProperties.Base)
+ installedApk := ctx.InstallAbsoluteSymlink(installDir, symlinkName, target)
+ m.supportFiles = append(m.supportFiles, installedApk)
}
- target := installedBaseRelativeToHere(symlinkName, *m.tradefedProperties.Base)
- installedApk := ctx.InstallAbsoluteSymlink(installDir, symlinkName, target)
- m.supportFiles = append(m.supportFiles, installedApk)
// 3) Symlink for all data deps
// And like this for data files and required modules
@@ -374,8 +389,7 @@
// ├── data
// │ └── broken_shortcut.xml
// ├── JobTestApp.apk
- for _, f := range m.provider.InstalledFiles {
- symlinkName := f.Rel()
+ for _, symlinkName := range m.provider.TestcaseRelDataFiles {
target := installedBaseRelativeToHere(symlinkName, *m.tradefedProperties.Base)
installedPath := ctx.InstallAbsoluteSymlink(installDir, symlinkName, target)
m.supportFiles = append(m.supportFiles, installedPath)
@@ -386,7 +400,7 @@
// 5) We provide so we can be listed in test_suites.
android.SetProvider(ctx, tradefed.BaseTestProviderKey, tradefed.BaseTestProviderData{
- InstalledFiles: m.supportFiles.Paths(),
+ TestcaseRelDataFiles: testcaseRel(m.supportFiles.Paths()),
OutputFile: baseApk,
TestConfig: m.testConfig,
HostRequiredModuleNames: m.provider.HostRequiredModuleNames,
@@ -400,6 +414,14 @@
var _ android.AndroidMkEntriesProvider = (*testModuleConfigHostModule)(nil)
+func testcaseRel(paths android.Paths) []string {
+ relPaths := []string{}
+ for _, p := range paths {
+ relPaths = append(relPaths, p.Rel())
+ }
+ return relPaths
+}
+
// Given a relative path to a file in the current directory or a subdirectory,
// return a relative path under our sibling directory named `base`.
// There should be one "../" for each subdir we descend plus one to backup to "base".
diff --git a/tradefed_modules/test_module_config_test.go b/tradefed_modules/test_module_config_test.go
index cf6c7d1..efd4a04 100644
--- a/tradefed_modules/test_module_config_test.go
+++ b/tradefed_modules/test_module_config_test.go
@@ -16,6 +16,7 @@
import (
"android/soong/android"
"android/soong/java"
+ "android/soong/sh"
"fmt"
"strconv"
"strings"
@@ -54,6 +55,8 @@
`
+const variant = "android_arm64_armv8-a"
+
// Ensure we create files needed and set the AndroidMkEntries needed
func TestModuleConfigAndroidTest(t *testing.T) {
@@ -62,7 +65,7 @@
android.FixtureRegisterWithContext(RegisterTestModuleConfigBuildComponents),
).RunTestWithBp(t, bp)
- derived := ctx.ModuleForTests("derived_test", "android_common")
+ derived := ctx.ModuleForTests("derived_test", variant)
// Assert there are rules to create these files.
derived.Output("test_module_config.manifest")
derived.Output("test_config_fixer/derived_test.config")
@@ -88,7 +91,7 @@
// And some new derived entries are there.
android.AssertArrayString(t, "", entries.EntryMap["LOCAL_MODULE_TAGS"], []string{"tests"})
- android.AssertStringMatches(t, "", entries.EntryMap["LOCAL_FULL_TEST_CONFIG"][0], "derived_test/android_common/test_config_fixer/derived_test.config")
+ android.AssertStringMatches(t, "", entries.EntryMap["LOCAL_FULL_TEST_CONFIG"][0], fmt.Sprintf("derived_test/%s/test_config_fixer/derived_test.config", variant))
// Check the footer lines. Our support files should depend on base's support files.
convertedActual := make([]string, 5)
@@ -105,6 +108,80 @@
})
}
+func TestModuleConfigShTest(t *testing.T) {
+ ctx := android.GroupFixturePreparers(
+ sh.PrepareForTestWithShBuildComponents,
+ android.PrepareForTestWithAndroidBuildComponents,
+ android.FixtureMergeMockFs(android.MockFS{
+ "test.sh": nil,
+ "testdata/data1": nil,
+ "testdata/sub/data2": nil,
+ }),
+ android.FixtureRegisterWithContext(RegisterTestModuleConfigBuildComponents),
+ ).RunTestWithBp(t, `
+ sh_test {
+ name: "shell_test",
+ src: "test.sh",
+ filename: "test.sh",
+ test_suites: ["general-tests"],
+ data: [
+ "testdata/data1",
+ "testdata/sub/data2",
+ ],
+ }
+ test_module_config {
+ name: "conch",
+ base: "shell_test",
+ test_suites: ["general-tests"],
+ options: [{name: "SomeName", value: "OptionValue"}],
+ }
+ `)
+ derived := ctx.ModuleForTests("conch", variant) //
+ conch := derived.Module().(*testModuleConfigModule)
+ android.AssertArrayString(t, "TestcaseRelDataFiles", []string{"arm64/testdata/data1", "arm64/testdata/sub/data2"}, conch.provider.TestcaseRelDataFiles)
+ android.AssertStringEquals(t, "Rel OutputFile", "test.sh", conch.provider.OutputFile.Rel())
+
+ // Assert there are rules to create these files.
+ derived.Output("test_module_config.manifest")
+ derived.Output("test_config_fixer/conch.config")
+
+ // Ensure some basic rules exist.
+ entries := android.AndroidMkEntriesForTest(t, ctx.TestContext, derived.Module())[0]
+
+ // Ensure some entries from base are there, specifically support files for data and helper apps.
+ // Do not use LOCAL_COMPATIBILITY_SUPPORT_FILES, but instead use LOCAL_SOONG_INSTALLED_COMPATIBILITY_SUPPORT_FILES
+ android.AssertStringPathsRelativeToTopEquals(t, "support-files", ctx.Config,
+ []string{"out/soong/target/product/test_device/testcases/conch/arm64/testdata/data1",
+ "out/soong/target/product/test_device/testcases/conch/arm64/testdata/sub/data2"},
+ entries.EntryMap["LOCAL_SOONG_INSTALLED_COMPATIBILITY_SUPPORT_FILES"])
+ android.AssertArrayString(t, "", entries.EntryMap["LOCAL_COMPATIBILITY_SUPPORT_FILES"], []string{})
+
+ android.AssertStringEquals(t, "app class", "NATIVE_TESTS", entries.Class)
+ android.AssertArrayString(t, "required modules", []string{"shell_test"}, entries.EntryMap["LOCAL_REQUIRED_MODULES"])
+ android.AssertArrayString(t, "host required modules", []string{}, entries.EntryMap["LOCAL_HOST_REQUIRED_MODULES"])
+ android.AssertArrayString(t, "cert", []string{}, entries.EntryMap["LOCAL_CERTIFICATE"])
+
+ // And some new derived entries are there.
+ android.AssertArrayString(t, "tags", []string{}, entries.EntryMap["LOCAL_MODULE_TAGS"])
+
+ android.AssertStringMatches(t, "", entries.EntryMap["LOCAL_FULL_TEST_CONFIG"][0],
+ fmt.Sprintf("conch/%s/test_config_fixer/conch.config", variant))
+
+ // Check the footer lines. Our support files should depend on base's support files.
+ convertedActual := make([]string, 4)
+ for i, e := range entries.FooterLinesForTests() {
+ // AssertStringPathsRelativeToTop doesn't replace both instances
+ convertedActual[i] = strings.Replace(e, ctx.Config.SoongOutDir(), "", 2)
+ }
+ android.AssertArrayString(t, fmt.Sprintf("%s", ctx.Config.SoongOutDir()), convertedActual, []string{
+ "include $(BUILD_SYSTEM)/soong_cc_rust_prebuilt.mk",
+ "/target/product/test_device/testcases/conch/arm64/testdata/data1: /target/product/test_device/testcases/shell_test/arm64/testdata/data1",
+ "/target/product/test_device/testcases/conch/arm64/testdata/sub/data2: /target/product/test_device/testcases/shell_test/arm64/testdata/sub/data2",
+ "",
+ })
+
+}
+
// Make sure we call test-config-fixer with the right args.
func TestModuleConfigOptions(t *testing.T) {
@@ -114,7 +191,7 @@
).RunTestWithBp(t, bp)
// Check that we generate a rule to make a new AndroidTest.xml/Module.config file.
- derived := ctx.ModuleForTests("derived_test", "android_common")
+ derived := ctx.ModuleForTests("derived_test", variant)
rule_cmd := derived.Rule("fix_test_config").RuleParams.Command
android.AssertStringDoesContain(t, "Bad FixConfig rule inputs", rule_cmd,
`--test-runner-options='[{"Name":"exclude-filter","Key":"","Value":"android.test.example.devcodelab.DevCodelabTest#testHelloFail"},{"Name":"include-annotation","Key":"","Value":"android.platform.test.annotations.LargeTest"}]'`)
@@ -211,8 +288,7 @@
).ExtendWithErrorHandler(
android.FixtureExpectsAtLeastOneErrorMatchingPattern("Test options must be given")).
RunTestWithBp(t, badBp)
-
- ctx.ModuleForTests("derived_test", "android_common")
+ ctx.ModuleForTests("derived_test", variant)
}
func TestModuleConfigMultipleDerivedTestsWriteDistinctMakeEntries(t *testing.T) {
@@ -250,7 +326,7 @@
).RunTestWithBp(t, multiBp)
{
- derived := ctx.ModuleForTests("derived_test", "android_common")
+ derived := ctx.ModuleForTests("derived_test", variant)
entries := android.AndroidMkEntriesForTest(t, ctx.TestContext, derived.Module())[0]
// All these should be the same in both derived tests
android.AssertStringPathsRelativeToTopEquals(t, "support-files", ctx.Config,
@@ -260,13 +336,13 @@
entries.EntryMap["LOCAL_SOONG_INSTALLED_COMPATIBILITY_SUPPORT_FILES"])
// Except this one, which points to the updated tradefed xml file.
- android.AssertStringMatches(t, "", entries.EntryMap["LOCAL_FULL_TEST_CONFIG"][0], "derived_test/android_common/test_config_fixer/derived_test.config")
+ android.AssertStringMatches(t, "", entries.EntryMap["LOCAL_FULL_TEST_CONFIG"][0], fmt.Sprintf("derived_test/%s/test_config_fixer/derived_test.config", variant))
// And this one, the module name.
android.AssertArrayString(t, "", entries.EntryMap["LOCAL_MODULE"], []string{"derived_test"})
}
{
- derived := ctx.ModuleForTests("another_derived_test", "android_common")
+ derived := ctx.ModuleForTests("another_derived_test", variant)
entries := android.AndroidMkEntriesForTest(t, ctx.TestContext, derived.Module())[0]
// All these should be the same in both derived tests
android.AssertStringPathsRelativeToTopEquals(t, "support-files", ctx.Config,
@@ -275,7 +351,8 @@
"out/soong/target/product/test_device/testcases/another_derived_test/data/testfile"},
entries.EntryMap["LOCAL_SOONG_INSTALLED_COMPATIBILITY_SUPPORT_FILES"])
// Except this one, which points to the updated tradefed xml file.
- android.AssertStringMatches(t, "", entries.EntryMap["LOCAL_FULL_TEST_CONFIG"][0], "another_derived_test/android_common/test_config_fixer/another_derived_test.config")
+ android.AssertStringMatches(t, "", entries.EntryMap["LOCAL_FULL_TEST_CONFIG"][0],
+ fmt.Sprintf("another_derived_test/%s/test_config_fixer/another_derived_test.config", variant))
// And this one, the module name.
android.AssertArrayString(t, "", entries.EntryMap["LOCAL_MODULE"], []string{"another_derived_test"})
}