Migrate Rust to LLVM coverage.

Bug: 177675913
Test: Manually compile, run, and see output with llvm-cov.
Change-Id: I66729cff87a848782e9fa1b95cbbc06318c5761a
This commit is contained in:
Joel Galenson
2021-01-14 16:03:18 -08:00
parent 66f7fdd1c8
commit fa049385b8
9 changed files with 19 additions and 185 deletions

View File

@@ -121,7 +121,7 @@ func (binary *binaryDecorator) compile(ctx ModuleContext, flags Flags, deps Path
flags.RustFlags = append(flags.RustFlags, deps.depFlags...)
flags.LinkFlags = append(flags.LinkFlags, deps.linkObjects...)
outputs := TransformSrcToBinary(ctx, srcPath, deps, flags, outputFile, deps.linkDirs)
TransformSrcToBinary(ctx, srcPath, deps, flags, outputFile, deps.linkDirs)
if binary.stripper.NeedsStrip(ctx) {
strippedOutputFile := android.PathForModuleOut(ctx, "stripped", fileName)
@@ -129,24 +129,9 @@ func (binary *binaryDecorator) compile(ctx ModuleContext, flags Flags, deps Path
binary.strippedOutputFile = android.OptionalPathForPath(strippedOutputFile)
}
binary.coverageFile = outputs.coverageFile
var coverageFiles android.Paths
if outputs.coverageFile != nil {
coverageFiles = append(coverageFiles, binary.coverageFile)
}
if len(deps.coverageFiles) > 0 {
coverageFiles = append(coverageFiles, deps.coverageFiles...)
}
binary.coverageOutputZipFile = TransformCoverageFilesToZip(ctx, coverageFiles, binary.getStem(ctx))
return outputFile
}
func (binary *binaryDecorator) coverageOutputZipPath() android.OptionalPath {
return binary.coverageOutputZipFile
}
func (binary *binaryDecorator) autoDep(ctx BaseModuleContext) autoDep {
// Binaries default to dylib dependencies for device, rlib for host.
if binary.preferRlib() {