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
diff --git a/bp2build/testing.go b/bp2build/testing.go
index 8ae1a38..53b60fa 100644
--- a/bp2build/testing.go
+++ b/bp2build/testing.go
@@ -43,7 +43,7 @@
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 @@
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)
}