Include libraries: Cover included libs if -Xcoverage is specified
This commit is contained in:
committed by
Ilya Matveev
parent
f0294f5414
commit
5c6a357a35
+2
-1
@@ -65,7 +65,8 @@ internal class CoverageManager(val context: Context) {
|
||||
val coveredUserCode = if (shouldCoverProgram) setOf(context.moduleDescriptor) else emptySet()
|
||||
val coveredLibs = context.irModules.filter { it.key in librariesToCover }.values
|
||||
.map { it.descriptor }.toSet()
|
||||
coveredLibs + coveredUserCode
|
||||
val coveredIncludedLibs = if (shouldCoverProgram) context.getIncludedLibraryDescriptors().toSet() else emptySet()
|
||||
coveredLibs + coveredUserCode + coveredIncludedLibs
|
||||
}
|
||||
|
||||
private fun fileCoverageFilter(file: IrFile) =
|
||||
|
||||
@@ -3703,16 +3703,7 @@ standaloneTest("coverage_basic_program") {
|
||||
flags = ["-Xcoverage-file=$coverageFile", "-Xcoverage", "-entry", "coverage.basic.program.main"]
|
||||
source = "$projectDir/coverage/basic/program/main.kt"
|
||||
|
||||
doFirst { file(coverageFile).delete() }
|
||||
|
||||
doLast {
|
||||
if (twoStageEnabled) {
|
||||
// If two-stage compilation is enabled, no sources are passed to the compiler when a final binary is generated.
|
||||
// So according to -Xcoverage flag semantics it must provide no coverage info.
|
||||
assert !file(coverageFile).exists()
|
||||
return
|
||||
}
|
||||
|
||||
execLlvm("llvm-profdata") {
|
||||
args "merge"
|
||||
args "$dir/program.profraw"
|
||||
|
||||
Reference in New Issue
Block a user