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 /systemfeatures/system_features_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 'systemfeatures/system_features_test.go')
| -rw-r--r-- | systemfeatures/system_features_test.go | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/systemfeatures/system_features_test.go b/systemfeatures/system_features_test.go index 58e6a0660..3f6060b0a 100644 --- a/systemfeatures/system_features_test.go +++ b/systemfeatures/system_features_test.go @@ -44,8 +44,88 @@ java_system_features_srcs { android.AssertStringDoesContain(t, "Expected TELEVISION feature flag", cmd, "--feature=TELEVISION:UNAVAILABLE ") android.AssertStringDoesContain(t, "Expected WATCH feature flag", cmd, "--feature=WATCH: ") android.AssertStringDoesNotContain(t, "Unexpected FOO arg from non-system feature flag", cmd, "FOO") + android.AssertStringDoesNotContain(t, "Unexpected feature xml files flag", cmd, "--feature-xml-files") systemFeaturesModule := module.Module().(*javaSystemFeaturesSrcs) expectedOutputPath := "out/soong/.intermediates/system-features-srcs/gen/RoSystemFeatures.java" android.AssertPathsRelativeToTopEquals(t, "Expected output file", []string{expectedOutputPath}, systemFeaturesModule.Srcs()) } + +func TestJavaSystemFeaturesSrcsFromXml(t *testing.T) { + bp := ` +java_system_features_srcs { + name: "system-features-srcs", + full_class_name: "com.android.test.RoSystemFeatures", +} +` + + res := android.GroupFixturePreparers( + android.FixtureRegisterWithContext(registerSystemFeaturesComponents), + android.PrepareForTestWithBuildFlag("RELEASE_USE_SYSTEM_FEATURE_BUILD_FLAGS", "true"), + android.PrepareForTestWithBuildFlag("RELEASE_USE_SYSTEM_FEATURE_XML_FOR_UNAVAILABLE_FEATURES", "true"), + android.PrepareForTestWithBuildFlag("RELEASE_SYSTEM_FEATURE_AUTOMOTIVE", "0"), + android.FixtureModifyConfig(func(config android.Config) { + config.TestProductVariables.PartitionVarsForSoongMigrationOnlyDoNotUse.ProductCopyFiles = []string{ + "frameworks/features.xml:system/etc/permissions/features.xml", + "frameworks/features.xml:system/etc/permissions/featurescopy.xml", + "frameworks/features2.xml:system/etc/sysconfig/features2.xml", + "frameworks/featureswithowner.xml:vendor/etc/permissions/featureswithowner.xml:customowner", + "frameworks/dstalreadyexists.xml:system/etc/permissions/features.xml", + "frameworks/wrongsuffix.notxml:system/etc/permissions/wrongsuffix.notxml", + "frameworks/wrongsubdir.xml:system/notsysconfig/wrongsubdir.xml", + "frameworks/wrongsubdir.xml:system/notpermissions/wrongsubdir.xml", + "frameworks/wrongsubdir.xml:system/etc/permissions/nested/wrongsubdir.xml", + "frameworks/wrongsubdir.xml:system/notetc/permissions/wrongsubdir.xml", + "frameworks/nonexistent.xml:system/etc/permissions/nonexistent.xml", + } + }), + android.FixtureMergeMockFs(android.MockFS{ + "frameworks/features.xml": nil, + "frameworks/features2.xml": nil, + "frameworks/featureswithowner.xml": nil, + "frameworks/wrongsuffix.notxml": nil, + "frameworks/wrongsubdir.xml": nil, + "frameworks/dstalreadyexists.xml": nil, + // Note that we explicitly omit frameworks/nonexistent.xml. + }), + ).RunTestWithBp(t, bp) + + module := res.ModuleForTests(t, "system-features-srcs", "") + cmd := module.Rule("system-features-srcs").RuleParams.Command + android.AssertStringDoesContain(t, "Expected fully class name", cmd, " com.android.test.RoSystemFeatures ") + android.AssertStringDoesContain(t, "Expected readonly flag", cmd, "--readonly=true") + android.AssertStringDoesContain(t, "Expected AUTOMOTIVE feature flag", cmd, "--feature=AUTOMOTIVE:0 ") + android.AssertStringDoesContain(t, "Expected feature xml files flag", cmd, "--unavailable-feature-xml-files=frameworks/features.xml,frameworks/features2.xml,frameworks/featureswithowner.xml") + android.AssertStringDoesNotContain(t, "Unexpected feature xml file", cmd, "dstalreadyexists.xml") + android.AssertStringDoesNotContain(t, "Unexpected feature xml file", cmd, "nonexistent.xml") + android.AssertStringDoesNotContain(t, "Unexpected feature xml file", cmd, "wrongsubdir.xml") + android.AssertStringDoesNotContain(t, "Unexpected feature xml file", cmd, "wrongsuffix.notxml") + + systemFeaturesModule := module.Module().(*javaSystemFeaturesSrcs) + expectedOutputPath := "out/soong/.intermediates/system-features-srcs/gen/RoSystemFeatures.java" + android.AssertPathsRelativeToTopEquals(t, "Expected output file", []string{expectedOutputPath}, systemFeaturesModule.Srcs()) +} + +func TestJavaSystemFeaturesSrcsFromInvalidProductFiles(t *testing.T) { + bp := ` +java_system_features_srcs { + name: "system-features-srcs", + full_class_name: "com.android.test.RoSystemFeatures", +} +` + + android.GroupFixturePreparers( + android.FixtureRegisterWithContext(registerSystemFeaturesComponents), + android.PrepareForTestWithBuildFlag("RELEASE_USE_SYSTEM_FEATURE_XML_FOR_UNAVAILABLE_FEATURES", "true"), + android.FixtureModifyConfig(func(config android.Config) { + config.TestProductVariables.PartitionVarsForSoongMigrationOnlyDoNotUse.ProductCopyFiles = []string{ + "frameworks/dstmissing.xml", + } + }), + android.FixtureMergeMockFs(android.MockFS{ + "frameworks/dstmissing.xml": nil, + }), + ).ExtendWithErrorHandler( + android.FixtureExpectsAtLeastOneErrorMatchingPattern("PRODUCT_COPY_FILES must follow the format \"src:dest\", got: frameworks/dstmissing.xml"), + ).RunTestWithBp(t, bp) +} |
