bp2build: Remove duplicate system shared libs

If a system shared lib is specified in shared_libs, this results in
duplicate values appearing, causing a failure in Bazel. This change
removes any system shared libraries that appear in shared libraries from
bionic OS axes where system_shared_libraries takes the default value.

Test: go soong tests
Test: temporarily allowlist directory with this issue, no longer hits
      duplicate library failure.
Change-Id: I9dce570b73c24973f695b815bce8d50f7259798d
This commit is contained in:
Liz Kammer
2021-12-14 12:21:22 -05:00
parent 7febef761a
commit 5430953c82
4 changed files with 110 additions and 13 deletions

View File

@@ -43,7 +43,7 @@ func checkError(t *testing.T, errs []error, expectedErr error) bool {
if len(errs) != 1 {
return false
}
if errs[0].Error() == expectedErr.Error() {
if strings.Contains(errs[0].Error(), expectedErr.Error()) {
return true
}
@@ -127,8 +127,12 @@ func runBp2BuildTestCase(t *testing.T, registerModuleTypes func(ctx android.Regi
codegenCtx := NewCodegenContext(config, *ctx.Context, Bp2Build)
codegenCtx.unconvertedDepMode = tc.unconvertedDepsMode
bazelTargets, errs := generateBazelTargetsForDir(codegenCtx, checkDir)
if tc.expectedErr != nil && checkError(t, errs, tc.expectedErr) {
return
if tc.expectedErr != nil {
if checkError(t, errs, tc.expectedErr) {
return
} else {
t.Errorf("Expected error: %q, got: %q", tc.expectedErr, errs)
}
} else {
android.FailIfErrored(t, errs)
}