summaryrefslogtreecommitdiff
path: root/android/module_test.go
AgeCommit message (Collapse)Author
2025-02-12Don't panic in ModuleForTests and friends Colin Cross
Panicking in ModuleForTests and similar test helper functions was a mistake. Go's test runner stops running tests as soon as any test panics, which means debugging multiple tests panicking requires rerunning all the tests after fixing each panic to find the next one. Pass the *testing.T into ModuleForTests and friends so that it can call t.Fatalf instead. Test: all soong tests pass Change-Id: I5d0f2424eaf04fb795079e6d1e4b9469d8c7033c
2025-02-06Add a unit test for module name enforcement Spandan Das
With https://r.android.com/3478084, blueprint will become more strict on allowing special chars in module names. Test: m nothing --no-skip-soong-tests Change-Id: I89fd7631d6e12e5af25641ca953f9e5659a9728c
2024-12-17Always install to out/target instead of out/soong/target Cole Faust
So that when using soong-only builds, we don't have to update a bunch of tools and other parts of soong that expect files in out/target. Bug: 383892968 Test: m nothing --no-skip-soong-tests Change-Id: Idba3b5a416e6ffff799ec3ce632a8a4fbafe341f
2024-11-12Change GetModuleFromPathDep to use ModuleProxy. Yu Liu
Bug: 377723687 Test: Compare ninja and mk files generated. Change-Id: I428b0965b217adb20a792ebde88374e0c6fae9d6
2024-09-24Check if vintf_fragment modules' target partition Kiyoung Kim
Current implementation allows vintf_fragment to be installed in the different partition of a module referenced it via vintf_fragment_modules, but this is unexpected behavior and should be caught from the build system to avoid any unintended mistakes. This change checks target parition of vintf_fragment module and any modules referencing it, and fails if there is any mismatch found. Bug: 322089980 Test: aosp_cf_x86_64_phone build succeeded Change-Id: Ie8152d2f2616726e44a99fb1261be292f2b9ad54
2024-08-26Merge "Make the defaults property non-configurable" into main Treehugger Robot
2024-08-23Make the defaults property non-configurable Cole Faust
In order to support changing the global configuration per-module, we can't make decisions on configuration until the configuration is decided. The defaults mutator is one of the earliest mutators, and it would be helpful to run it before deciding the configuration. Bug: 361816274 Test: Presubmits Change-Id: Iee9c603d7e2601919d636345dfdedae47448db38
2024-08-21Remove outputFiles from ModuleBase. Yu Liu
Bug: 358425833 Test: CI Change-Id: I6c398fbdbc38b99fa62f8670baa44ffd51b5e6d3
2024-07-23Make the defaults property configurable Inseob Kim
This allows using select statements with it. Bug: 354824866 Test: m Change-Id: I673df0869a68c2e79b19c577d0ae1ff2249388db
2024-07-12Use OutputFilesProvider in module_test mrziwang
In the context of incremental soong, the output files inter-module-communication will be through OutputFilesProvider. The OutputFileProducer interface will be deprecated. Test: CI Bug: 339477385 Change-Id: Iaf0b039b17d34e1a696f2c87df2f0db39307fc6d
2024-01-18Remove SymlinkOutputs Cole Faust
symlink_outputs was added so bazel could run ninja files, but we abanoned that approach in roboleaf, and then roboleaf was cancelled entirely. Remove this feature so we're more compatible with upstream ninja / n2. Bug: 160568334 Test: Presubmits Change-Id: Ic368c48dd01b68e51c471c3fe90d0c02c55956e9
2022-10-04Make OutputFileForModule work for AllowMissingDependencies Colin Cross
Report missing output files as missing dependencies when AllowMissingDependencies is enabled. This will fix AllowMissingDependencies builds where a dependency module is present but missing support for a specific architecture. Bug: 250918230 Test: lunch aosp_riscv64-userdebug && m ALLOW_MISSING_DEPENDENCIES=true nothing Test: TestOutputFileForModule Change-Id: I95e96e3e7cb3df7bf678ed628b45baf659addbad
2022-08-22Add a new `test_options.tags` attribute to customize test execution Zhenhuang Wang
The `test_options.tags` attribute provides additional metadata to customize test execution by downstream test runners. The tags have no special meaning to Soong. Bug: 240928948 Test: manually add `test_options.tags` attribute and run: $ refreshmod && \ cat out/target/product/generic/module-info.json |\ grep <tags> Change-Id: I35267f6608e48c6184e56530ef128d93b2f97522
2022-08-17Move common test_options properties into the android package Zhenhuang Wang
Multiple modules (e.g. java, cc, python, rust) define the `test_options` field. Extract the common properties in test_options to share across different test rules. Bug: 240928948 Test: `refreshmod` and diff with original module-info.json Change-Id: I404a7a157b4ccaa53d800ee2217559ff695bd825
2022-03-25Add values to json module graph Liz Kammer
Increases size of json module graph but it still remains smaller than action information. Test: m json-module-graph Change-Id: I215e92afb0f5d3d688e5e590517392d0cc534455
2022-02-22Merge "Move functionality to test install rules into testing.go." Treehugger Robot
2022-02-11Support multiple library names per target. Bob Badour
The prior interface to make supported only a single package name per target; although, a target might have multiple licenses each with its own package name. Bug: 151177513 Bug: 210912771 Test: m all dist Test: flash; About Phone -> Legal Information -> Third-party licenses Change-Id: I1db5fcfd4c066afd162adb4eb4177960c7a503bd
2022-02-10Move functionality to test install rules into testing.go. Martin Stjernholm
In preparation for test in the cc package. Test: m nothing Bug: 211770050 Change-Id: I3f6190e102c607a0b6246d78d7bde7fcffa21650
2022-01-11Add SetProperties to json-module-graph Liz Kammer
SetProperties contains name and type of properties set in the bp file and any set via defaults. There may be properties that were not specified in an Android.bp file due to: * specified via go code (e.g. LoadHooks) * property is _not_ a pointer -- so it is not possible to tell between not set in bp file and default value. Test: soong tests Test: m json-module-graph and verify Change-Id: I4cb868b1d7db566e72636c6fb53bb9c7090f236a
2021-12-15Remove InstallBypassMake and ToMakePath Colin Cross
InstallBypassMake and ToMakePath are obsolete, remove them. Bug: 204136549 Test: m checkbuild Change-Id: Ie5a6f7254b3d317ed6039e114ed6aec35e1ce273
2021-11-09Fix InstallBypassMake symlink dependencies Colin Cross
Host symlinks cannot use order-only dependencies because they may be used as part of the dependency chain on a tool, and an order-only dependency would cause the target of the symlink not to be updated. Use regular dependencies instead. Bug: 204136549 Fixes: 205674000 Test: TestInstallBypassMake Change-Id: Ib3f4ee143e94d1995ec6c60d314e7c91e57cc775
2021-11-09Add tests for ctx.InstallFile Colin Cross
Add tests that cover Soong-only installation as well as installation with InstallBypassMake. Bug: 204136549 Test: TestInstall Test: TestInstallBypassMake Change-Id: Iac22c9fdf99994e06b419623ee5fa399ef6957fb
2021-07-12Use bazel syntax for fully qualified name in path property Paul Duffin
A module reference to a fully qualified module in a path property looks like: //path:module And with a tag: //path:module{tag} At the moment the checking is quite lax but some follow up changes will make it much stricter. Bug: 193228441 Test: m nothing Change-Id: Ie42edcfa33ec66fda5d75b3df1da73f56f147afd
2021-03-22Remove uses of FixtureFactory from android package Paul Duffin
Bug: 183235980 Test: m nothing Change-Id: I72898ada020ee1a73fd534c61afb5c22fa00c1e5
2021-03-17Convert android/module_test.go to test fixtures Paul Duffin
Replaces the uses of buildDir in the unit test methods with t.TempDir() as it just needs a temporary directory. Bug: 182885307 Test: m nothing Change-Id: I70452d548eff53c0bccada09f60eba7a615b5371
2020-11-27Expand dist property checks to cover dists Paul Duffin
Previously, only the dist property's nested properties were checked for correctness. This change also checks the dists property's nested dist structures and adds some tests to verify that the checks are run and correctly report the location of the incorrect property even when it is within a slice of dist structs. Test: m nothing Bug: 174226317 Change-Id: If5a19360e1e4c98ee3b5afc813e35349d1fc6f6f
2020-11-12Pass Config to NewTestContext instead of ctx.Register Colin Cross
Prepare for using Config when adding singletons by passing Config to NewTestContext and NewContext instead of to ctx.Register. This will enable a followup change to store SingletonMakeVarsProviders registered on the Context in the Config, which is necessary to run multiple tests in parallel without data races. Test: all soong tests Change-Id: Id229629a4e42ff4487d317241673837726c075fc
2020-10-19Add symlink_outputs support to Soong. Jingwen Chen
This CL adds symlink_outputs to various locations in Soong that creates actions that creates symlink outputs, and explicitly mark them as such. Test: m Bug: 160568334 Change-Id: I322751bada52a9f49011c74731d84761586e03e7
2020-10-09Revert "Make lots of tests run in parallel" Colin Cross
This reverts commit 323dc60712491c71ccdc5363c42df61f0a192487. Reason for revert: Possible cause of test instability Bug: 170513220 Test: soong tests Change-Id: Iee168e9fbb4210569e6cffcc23e60d111403abb8
2020-10-06Make lots of tests run in parallel Colin Cross
Putting t.Parallel() in each test makes them run in parallel. Additional t.Parallel() could be added to each subtest, although that requires making a local copy of the loop variable for table driven tests. Test: m checkbuild Change-Id: I5d9869ead441093f4d7c5757f2447385333a95a4
2019-12-18Move filesystem into Config Colin Cross
The filesystem object was available through ModuleContext.Fs(), but gives too much access to the filesystem without enforicing correct dependencies. In order to support sandboxing the soong_build process move the filesystem into the Config. The next change will make it private. Bug: 146437378 Test: all Soong tests Change-Id: I5d3ae9108f120fd335b21efd612aefa078378813
2019-11-25Make TestContext.RegisterModuleType take an android.ModuleFactory Colin Cross
Avoid having to pass ModuleFactoryAdaptor to every call to RegisterModuleType in a test by wrapping RegisterModuleType. Test: all soong tests Change-Id: If8847d16487de0479cc3020b728256922b3cadba
2019-08-26soong: Add tests for depending on disabled module Jooyung Han
This will check if direct deps of android.Module type is "Enabled()". Previously, this is checked only if a module calls VisitDeps*() functions in GenerateAndroidBuildActions(). Most modules call VisitDeps*() in GenerateAndroidBuildActions(), but some modules don't. For example, "apex" module calls WalkDepsBlueprint() or VisitDirectDepsBlueprint() since it exceptionally depends on non-android.Module modules. Therefore, when an apex module depends on disabled(enabled:false) module, build fails with panic, which is fixed by this change. Test: m # runs soong tests Change-Id: I81c5c148bbd51a253d2904690eb76ae7b6df1a0f
2019-06-04Support tagged module references Colin Cross
There are cases where a module needs to refer to an intermediate output of another module instead of its final output. For example, a module may want to use the .jar containing .class files from another module whose final output is a .jar containing classes.dex files. Support a new ":module{.tag}" format in any property that is annotated with `android:"path"`, which will query the target module for its ".tag" output(s). Test: path_properties_test.go, paths_test.go Test: no unexpected changes in build.ninja Change-Id: Icd3c9b0d83ff125771767c04046fcffb9fc3f65a