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/prebuilt_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/prebuilt_test.go')
| -rw-r--r-- | cc/prebuilt_test.go | 65 |
1 files changed, 12 insertions, 53 deletions
diff --git a/cc/prebuilt_test.go b/cc/prebuilt_test.go index af68ca6bf..cade677ee 100644 --- a/cc/prebuilt_test.go +++ b/cc/prebuilt_test.go @@ -20,7 +20,6 @@ import ( "testing" "android/soong/android" - "github.com/google/blueprint" ) var prepareForPrebuiltTest = android.GroupFixturePreparers( @@ -132,42 +131,31 @@ func TestPrebuilt(t *testing.T) { prebuiltLibfShared := ctx.ModuleForTests(t, "prebuilt_libf", "android_arm64_armv8-a_shared").Module() prebuiltCrtx := ctx.ModuleForTests(t, "prebuilt_crtx", "android_arm64_armv8-a").Module() - hasDep := func(m android.Module, wantDep android.Module) bool { - t.Helper() - var found bool - ctx.VisitDirectDeps(m, func(dep blueprint.Module) { - if dep == wantDep { - found = true - } - }) - return found - } - - if !hasDep(liba, prebuiltLiba) { + if !android.HasDirectDep(ctx, liba, prebuiltLiba) { t.Errorf("liba missing dependency on prebuilt_liba") } - if !hasDep(libb, prebuiltLibb) { + if !android.HasDirectDep(ctx, libb, prebuiltLibb) { t.Errorf("libb missing dependency on prebuilt_libb") } - if !hasDep(libd, prebuiltLibd) { + if !android.HasDirectDep(ctx, libd, prebuiltLibd) { t.Errorf("libd missing dependency on prebuilt_libd") } - if !hasDep(libe, prebuiltLibe) { + if !android.HasDirectDep(ctx, libe, prebuiltLibe) { t.Errorf("libe missing dependency on prebuilt_libe") } - if !hasDep(libfStatic, prebuiltLibfStatic) { + if !android.HasDirectDep(ctx, libfStatic, prebuiltLibfStatic) { t.Errorf("libf static missing dependency on prebuilt_libf") } - if !hasDep(libfShared, prebuiltLibfShared) { + if !android.HasDirectDep(ctx, libfShared, prebuiltLibfShared) { t.Errorf("libf shared missing dependency on prebuilt_libf") } - if !hasDep(crtx, prebuiltCrtx) { + if !android.HasDirectDep(ctx, crtx, prebuiltCrtx) { t.Errorf("crtx missing dependency on prebuilt_crtx") } @@ -440,17 +428,6 @@ func TestMultiplePrebuilts(t *testing.T) { } all_apex_contributions {name: "all_apex_contributions"} ` - hasDep := func(ctx *android.TestContext, m android.Module, wantDep android.Module) bool { - t.Helper() - var found bool - ctx.VisitDirectDeps(m, func(dep blueprint.Module) { - if dep == wantDep { - found = true - } - }) - return found - } - testCases := []struct { desc string selectedDependencyName string @@ -486,7 +463,7 @@ func TestMultiplePrebuilts(t *testing.T) { }, preparer) libfoo := ctx.ModuleForTests(t, "libfoo", "android_arm64_armv8-a_shared").Module() expectedDependency := ctx.ModuleForTests(t, tc.expectedDependencyName, "android_arm64_armv8-a_shared").Module() - android.AssertBoolEquals(t, fmt.Sprintf("expected dependency from %s to %s\n", libfoo.Name(), tc.expectedDependencyName), true, hasDep(ctx, libfoo, expectedDependency)) + android.AssertBoolEquals(t, fmt.Sprintf("expected dependency from %s to %s\n", libfoo.Name(), tc.expectedDependencyName), true, android.HasDirectDep(ctx, libfoo, expectedDependency)) // check that LOCAL_SHARED_LIBRARIES contains libbar and not libbar.v<N> entries := android.AndroidMkInfoForTest(t, ctx, libfoo).PrimaryInfo android.AssertStringListContains(t, "Version should not be present in LOCAL_SHARED_LIBRARIES", entries.EntryMap["LOCAL_SHARED_LIBRARIES"], "libbar") @@ -539,16 +516,6 @@ func TestMultiplePrebuiltsPreferredUsingLegacyFlags(t *testing.T) { } all_apex_contributions {name: "all_apex_contributions"} ` - hasDep := func(ctx *android.TestContext, m android.Module, wantDep android.Module) bool { - t.Helper() - var found bool - ctx.VisitDirectDeps(m, func(dep blueprint.Module) { - if dep == wantDep { - found = true - } - }) - return found - } testCases := []struct { desc string @@ -587,7 +554,8 @@ func TestMultiplePrebuiltsPreferredUsingLegacyFlags(t *testing.T) { } libfoo := ctx.ModuleForTests(t, "libfoo", "android_arm64_armv8-a_shared").Module() expectedDependency := ctx.ModuleForTests(t, tc.expectedDependencyName, "android_arm64_armv8-a_shared").Module() - android.AssertBoolEquals(t, fmt.Sprintf("expected dependency from %s to %s\n", libfoo.Name(), tc.expectedDependencyName), true, hasDep(ctx, libfoo, expectedDependency)) + android.AssertBoolEquals(t, fmt.Sprintf("expected dependency from %s to %s\n", libfoo.Name(), tc.expectedDependencyName), + true, android.HasDirectDep(ctx, libfoo, expectedDependency)) } } @@ -617,16 +585,6 @@ func TestMissingVariantInModuleSdk(t *testing.T) { } all_apex_contributions {name: "all_apex_contributions"} ` - hasDep := func(ctx *android.TestContext, m android.Module, wantDep android.Module) bool { - t.Helper() - var found bool - ctx.VisitDirectDeps(m, func(dep blueprint.Module) { - if dep == wantDep { - found = true - } - }) - return found - } preparer := android.GroupFixturePreparers( android.FixtureRegisterWithContext(func(ctx android.RegistrationContext) { @@ -642,5 +600,6 @@ func TestMissingVariantInModuleSdk(t *testing.T) { sourceLibBar := ctx.ModuleForTests(t, "libbar", "android_arm64_armv8-a_static").Module() // Even though the prebuilt is listed in apex_contributions, the prebuilt does not have a static variant. // Therefore source of libbar should be used. - android.AssertBoolEquals(t, fmt.Sprintf("expected dependency from libfoo to source libbar"), true, hasDep(ctx, libfoo, sourceLibBar)) + android.AssertBoolEquals(t, fmt.Sprintf("expected dependency from libfoo to source libbar"), true, + android.HasDirectDep(ctx, libfoo, sourceLibBar)) } |
