Add gcov coverage support to Rust modules.
This adds gcov coverage support for Rust device library and binary
modules (including test modules). Support is provided to pass Rust
static library gcno files to CC modules and visa versa.
Additional changes:
* Begin mutator added for Rust modules.
* SuffixInList added to android package.
* CoverageEnabled added to Coverage interface.
* CoverageFiles added to LinkableLibrary interface.
* Fix in coverage mutator for non-CC modules which marked the wrong
variant as the coverage variant.
* Added coverage libraries to the cc.GatherRequiredDepsForTest.
Bug: 146448203
Test: NATIVE_COVERAGE=true COVERAGE_PATHS='*' m -j <rust_module>
Change-Id: If20728bdde42a1dd544a35a40f0d981b80a5835f
diff --git a/rust/compiler.go b/rust/compiler.go
index 7499776..5f098bc 100644
--- a/rust/compiler.go
+++ b/rust/compiler.go
@@ -110,6 +110,7 @@
linkDirs []string
edition string
src android.Path //rustc takes a single src file
+ coverageFile android.Path //rustc generates a single gcno file
// Install related
dir string
@@ -120,6 +121,10 @@
location installLocation
}
+func (compiler *baseCompiler) coverageOutputZipPath() android.OptionalPath {
+ panic("baseCompiler does not implement coverageOutputZipPath()")
+}
+
var _ compiler = (*baseCompiler)(nil)
func (compiler *baseCompiler) inData() bool {
@@ -235,6 +240,10 @@
compiler.relativeInstallPath(), compiler.relative)
}
+func (compiler *baseCompiler) nativeCoverage() bool {
+ return false
+}
+
func (compiler *baseCompiler) install(ctx ModuleContext, file android.Path) {
compiler.path = ctx.InstallFile(compiler.installDir(ctx), file.Base(), file)
}