diff options
| author | mosimchah <mosimchah@gmail.com> | 2025-12-02 09:27:38 -0500 |
|---|---|---|
| committer | mosimchah <mosimchah@gmail.com> | 2025-12-02 09:27:38 -0500 |
| commit | c7bade461dc55726f62997d13a48582f7c4b4655 (patch) | |
| tree | ea0588da76060a2038f54f67efd046ca77634b10 /cc/test.go | |
| parent | 0f5414d19317805e8bbbe7c4db5f0fd78769bad5 (diff) | |
| parent | 89d78cff8b00d3b20a90074635c3fe5a2ee49474 (diff) | |
Merge branch 'lineage-23.1' of https://github.com/LineageOS/android_build_soong into HEADw16.1
* 'lineage-23.1' of https://github.com/LineageOS/android_build_soong: (528 commits)
Revert "install_symlink: Make symlink target configurable"
Reapply "Clear as much of cc.Module as possible after GenerateBuildActions"
Revert "rust: config: Fix missing CPU variant LD flags in Rust"
Rename build-flag in outdir
Revert^4 "cipd: Default CIPD proxy server to on, add opt-out"
Convert check-vintf-all to phony with actions
Create a partial implementation of check-vintf-all for soong-only
Configure RBE rust pool based on build variant
Revert^3 "Add sdk version check to arr"
Add jdk.internal.invoke to the allowlist
Make droid always depend on symbols zip
Import Device and Odm skus
Don't install gob_gen in Soong
Remove bazel reference from run_integration_tests.sh
Fix bootstrap_test.sh
Don't panic in aconfig libraries when AllowMissingDependencies is set
Avoid returning nil paths from PathForModuleSrc
Revert "Flag controled clang version"
Rework module target dependencies on required deps
Revert^2 "Add sdk version check to arr"
...
Change-Id: I6e9a63fa14fda917a42e426e5dcebbad7f67e1de
Diffstat (limited to 'cc/test.go')
| -rw-r--r-- | cc/test.go | 95 |
1 files changed, 51 insertions, 44 deletions
diff --git a/cc/test.go b/cc/test.go index 9c276b81a..a20592892 100644 --- a/cc/test.go +++ b/cc/test.go @@ -274,12 +274,6 @@ func (test *testDecorator) moduleInfoJSON(ctx android.ModuleContext, moduleInfoJ } } -func (test *testDecorator) testSuiteInfo(ctx ModuleContext) { - android.SetProvider(ctx, android.TestSuiteInfoProvider, android.TestSuiteInfo{ - TestSuites: test.InstallerProperties.Test_suites, - }) -} - func NewTestInstaller() *baseInstaller { return NewBaseInstaller("nativetest", "nativetest64", InstallInData) } @@ -348,10 +342,6 @@ func (test *testBinary) moduleInfoJSON(ctx ModuleContext, moduleInfoJSON *androi } -func (test *testBinary) testSuiteInfo(ctx ModuleContext) { - test.testDecorator.testSuiteInfo(ctx) -} - func (test *testBinary) installerProps() []interface{} { return append(test.baseInstaller.installerProps(), test.testDecorator.installerProps()...) } @@ -422,44 +412,36 @@ func (test *testBinary) install(ctx ModuleContext, file android.Path) { test.Properties.Test_options.Unit_test = proptools.BoolPtr(true) } - if !ctx.Config().KatiEnabled() { // TODO(spandandas): Remove the special case for kati - // Install the test config in testcases/ directory for atest. - c, ok := ctx.Module().(*Module) - if !ok { - ctx.ModuleErrorf("Not a cc_test module") - } - // Install configs in the root of $PRODUCT_OUT/testcases/$module - testCases := android.PathForModuleInPartitionInstall(ctx, "testcases", ctx.ModuleName()+c.SubName()) - if ctx.PrimaryArch() { - if test.testConfig != nil { - ctx.InstallFile(testCases, ctx.ModuleName()+".config", test.testConfig) - } - dynamicConfig := android.ExistentPathForSource(ctx, ctx.ModuleDir(), "DynamicConfig.xml") - if dynamicConfig.Valid() { - ctx.InstallFile(testCases, ctx.ModuleName()+".dynamic", dynamicConfig.Path()) - } - for _, extraTestConfig := range test.extraTestConfigs { - ctx.InstallFile(testCases, extraTestConfig.Base(), extraTestConfig) - } - } - // Install tests and data in arch specific subdir $PRODUCT_OUT/testcases/$module/$arch - testCases = testCases.Join(ctx, ctx.Target().Arch.ArchType.String()) - ctx.InstallTestData(testCases, test.data) - ctx.InstallFile(testCases, file.Base(), file) + // Install the test config in testcases/ directory for atest. + c, ok := ctx.Module().(*Module) + if !ok { + ctx.ModuleErrorf("Not a cc_test module") } + ctx.SetTestSuiteInfo(android.TestSuiteInfo{ + NameSuffix: c.SubName(), + TestSuites: test.InstallerProperties.Test_suites, + MainFile: file, + MainFileStem: file.Base(), + ConfigFile: test.testConfig, + ExtraConfigs: test.extraTestConfigs, + Data: test.data, + NeedsArchFolder: true, + PerTestcaseDirectory: Bool(test.Properties.Per_testcase_directory), + }) + test.binaryDecorator.baseInstaller.installTestData(ctx, test.data) test.binaryDecorator.baseInstaller.install(ctx, file) if Bool(test.Properties.Standalone_test) { packagingSpecsBuilder := depset.NewBuilder[android.PackagingSpec](depset.TOPOLOGICAL) - ctx.VisitDirectDeps(func(dep android.Module) { + ctx.VisitDirectDepsProxy(func(dep android.ModuleProxy) { deps := android.OtherModuleProviderOrDefault(ctx, dep, android.InstallFilesProvider) packagingSpecsBuilder.Transitive(deps.TransitivePackagingSpecs) }) for _, standaloneTestDep := range packagingSpecsBuilder.Build().ToList() { - if standaloneTestDep.ToGob().SrcPath == nil { + if standaloneTestDep.SrcPath() == nil { continue } if standaloneTestDep.SkipInstall() { @@ -588,8 +570,24 @@ func (test *testLibrary) moduleInfoJSON(ctx ModuleContext, moduleInfoJSON *andro test.testDecorator.moduleInfoJSON(ctx, moduleInfoJSON) } -func (test *testLibrary) testSuiteInfo(ctx ModuleContext) { - test.testDecorator.testSuiteInfo(ctx) +func (test *testLibrary) install(ctx ModuleContext, file android.Path) { + test.libraryDecorator.install(ctx, file) + + c, ok := ctx.Module().(*Module) + if !ok { + ctx.ModuleErrorf("Expected a cc module") + } + // host tests are not installed to testcases/ as per: + // https://cs.android.com/android/platform/superproject/main/+/main:build/make/core/base_rules.mk;l=251;drc=45efec6797cbf812df34dac9d05e43a9fe7217e0 + if test.shared() { + ctx.SetTestSuiteInfo(android.TestSuiteInfo{ + NameSuffix: c.SubName(), + TestSuites: test.InstallerProperties.Test_suites, + NeedsArchFolder: true, + MainFile: file, + MainFileStem: file.Base(), + }) + } } func (test *testLibrary) installerProps() []interface{} { @@ -684,6 +682,21 @@ func (benchmark *benchmarkDecorator) install(ctx ModuleContext, file android.Pat benchmark.binaryDecorator.baseInstaller.dir64 = filepath.Join("benchmarktest64", ctx.ModuleName()) benchmark.binaryDecorator.baseInstaller.installTestData(ctx, benchmark.data) benchmark.binaryDecorator.baseInstaller.install(ctx, file) + + c, ok := ctx.Module().(*Module) + if !ok { + ctx.ModuleErrorf("Not a cc module") + } + + ctx.SetTestSuiteInfo(android.TestSuiteInfo{ + NameSuffix: c.SubName(), + TestSuites: benchmark.Properties.Test_suites, + MainFile: file, + MainFileStem: file.Base(), + ConfigFile: benchmark.testConfig, + Data: benchmark.data, + NeedsArchFolder: true, + }) } func (benchmark *benchmarkDecorator) moduleInfoJSON(ctx ModuleContext, moduleInfoJSON *android.ModuleInfoJSON) { @@ -709,12 +722,6 @@ func (benchmark *benchmarkDecorator) moduleInfoJSON(ctx ModuleContext, moduleInf } } -func (benchmark *benchmarkDecorator) testSuiteInfo(ctx ModuleContext) { - android.SetProvider(ctx, android.TestSuiteInfoProvider, android.TestSuiteInfo{ - TestSuites: benchmark.Properties.Test_suites, - }) -} - func NewBenchmark(hod android.HostOrDeviceSupported) *Module { module, binary := newBinary(hod) module.multilib = android.MultilibBoth |
