Merge "rust: Fix incorrect expected gcno file for dylibs" am: 3d0f191c35 am: 1e034e7ce1 am: a6f0ef6032 am: 2d17603914

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1500970

Change-Id: I5dfa7fac84c4828944cd8b96db2a41e85c546b23
This commit is contained in:
Ivan Lozano 2020-11-17 16:08:29 +00:00 committed by Automerger Merge Worker
commit ab1bf40e56
2 changed files with 4 additions and 2 deletions

View file

@ -200,7 +200,9 @@ func transformSrctoCrate(ctx ModuleContext, main android.Path, deps PathDeps, fl
profileEmitArg := strings.TrimPrefix(cc.PwdPrefix(), "PWD=") + "/" profileEmitArg := strings.TrimPrefix(cc.PwdPrefix(), "PWD=") + "/"
if outputFile.Ext() != "" { if outputFile.Ext() != "" {
gcnoFile = android.PathForModuleOut(ctx, pathtools.ReplaceExtension(outputFile.Base(), "gcno")) // rustc seems to split the output filename at the first '.' when determining the gcno filename
// so we need to do the same here.
gcnoFile = android.PathForModuleOut(ctx, strings.Split(outputFile.Base(), ".")[0]+".gcno")
rustcFlags = append(rustcFlags, "-Z profile-emit="+profileEmitArg+android.PathForModuleOut( rustcFlags = append(rustcFlags, "-Z profile-emit="+profileEmitArg+android.PathForModuleOut(
ctx, pathtools.ReplaceExtension(outputFile.Base(), "gcda")).String()) ctx, pathtools.ReplaceExtension(outputFile.Base(), "gcda")).String())
} else { } else {

View file

@ -160,7 +160,7 @@ func TestCoverageZip(t *testing.T) {
t.Fatalf("missing expected coverage files for rust 'fizz' binary: %#v", fizzZipInputs) t.Fatalf("missing expected coverage files for rust 'fizz' binary: %#v", fizzZipInputs)
} }
if !android.SuffixInList(libfooZipInputs, "android_arm64_armv8-a_rlib_dylib-std_cov/librlib.gcno") || if !android.SuffixInList(libfooZipInputs, "android_arm64_armv8-a_rlib_dylib-std_cov/librlib.gcno") ||
!android.SuffixInList(libfooZipInputs, "android_arm64_armv8-a_dylib_cov/libfoo.dylib.gcno") { !android.SuffixInList(libfooZipInputs, "android_arm64_armv8-a_dylib_cov/libfoo.gcno") {
t.Fatalf("missing expected coverage files for rust 'fizz' binary: %#v", libfooZipInputs) t.Fatalf("missing expected coverage files for rust 'fizz' binary: %#v", libfooZipInputs)
} }
if !android.SuffixInList(buzzZipInputs, "android_arm64_armv8-a_cov/obj/foo.gcno") || if !android.SuffixInList(buzzZipInputs, "android_arm64_armv8-a_cov/obj/foo.gcno") ||