-
Notifications
You must be signed in to change notification settings - Fork 278
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix source pathing for code coverage #1006
Merged
Merged
Changes from 6 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
555bd09
Fix source pathing for code coverage
4eae668
lint fixes hopefully?
77f2181
lint? idk what's going on here
9e2e2a2
Rename in_out_pair to records
acaa155
Remove bad assumptions about how bazel works
6d51720
Clean up lingering srcs
576b00f
this commit should fail tests
4bf9408
this commit should pass tests
9a8eaa9
let this test actually fail the CI
8d0c3da
update comments
0293fad
Refactor src_paths
d7f4927
spelling is hard
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
package coverage; | ||
|
||
object A1 { | ||
def a1(flag: Boolean): B1.type = | ||
if (flag) B1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
package coverage; | ||
|
||
object A2 { | ||
def a2(): Unit = { | ||
println("a2: " + | ||
"" // B2.b2_a() | ||
println("a2: " + B2.b2_a() | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
package coverage; | ||
|
||
object B1 { | ||
|
||
def not_called(): Unit = { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
package coverage; | ||
|
||
class B2 { | ||
public static String b2_a() { | ||
return C2.c2("hello from b2_a"); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,20 +62,10 @@ scala_library( | |
"A2.scala", | ||
], | ||
deps = [ | ||
# TODO :: Understand why referencing a local java library breaks coverage | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice to fix this! |
||
# ":b2", | ||
":b2", | ||
], | ||
) | ||
|
||
# | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Very happy to see this comment go away |
||
# As it stands I can't seem to generate coverage for Java libraries pulled into | ||
# a scala_test target. | ||
# | ||
# The java_library is instrumented, but doesn't have the .uninstrumented files | ||
# that Bazel seems to expect. There are a few code paths for code coverage, so | ||
# down the road we can explore how to fix this... | ||
# | ||
|
||
java_library( | ||
name = "b2", | ||
srcs = [ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
package coverage; | ||
|
||
object C2 { | ||
def c2(input: String): String = | ||
input.reverse | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
package coverage; | ||
import org.scalatest._ | ||
|
||
class TestAll extends FlatSpec { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
package coverage; | ||
|
||
import org.junit.Test; | ||
import org.junit.Assert.*; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,78 +1,110 @@ | ||
SF:/A1.scala | ||
FN:-1,A1$::<clinit> ()V | ||
FN:5,A1$::<init> ()V | ||
FN:3,A1$::a1 (Z)LB1$; | ||
FN:-1,A1::a1 (Z)LB1$; | ||
FNDA:1,A1$::<clinit> ()V | ||
FNDA:1,A1$::<init> ()V | ||
FNDA:1,A1$::a1 (Z)LB1$; | ||
FNDA:0,A1::a1 (Z)LB1$; | ||
SF:test/coverage/A1.scala | ||
FN:-1,coverage/A1$::<clinit> ()V | ||
FN:7,coverage/A1$::<init> ()V | ||
FN:5,coverage/A1$::a1 (Z)Lcoverage/B1$; | ||
FN:-1,coverage/A1::a1 (Z)Lcoverage/B1$; | ||
FNDA:1,coverage/A1$::<clinit> ()V | ||
FNDA:1,coverage/A1$::<init> ()V | ||
FNDA:1,coverage/A1$::a1 (Z)Lcoverage/B1$; | ||
FNDA:0,coverage/A1::a1 (Z)Lcoverage/B1$; | ||
FNF:4 | ||
FNH:3 | ||
BA:3,2 | ||
BA:5,2 | ||
BRF:1 | ||
BRH:1 | ||
DA:3,4 | ||
DA:4,0 | ||
DA:5,5 | ||
DA:5,4 | ||
DA:6,0 | ||
DA:7,5 | ||
LH:2 | ||
LF:3 | ||
end_of_record | ||
SF:/A2.scala | ||
FN:-1,A2$::<clinit> ()V | ||
FN:7,A2$::<init> ()V | ||
FN:3,A2$::a2 ()V | ||
FN:-1,A2::a2 ()V | ||
FNDA:1,A2$::<clinit> ()V | ||
FNDA:1,A2$::<init> ()V | ||
FNDA:1,A2$::a2 ()V | ||
FNDA:0,A2::a2 ()V | ||
SF:test/coverage/A2.scala | ||
FN:-1,coverage/A2$::<clinit> ()V | ||
FN:8,coverage/A2$::<init> ()V | ||
FN:5,coverage/A2$::a2 ()V | ||
FN:-1,coverage/A2::a2 ()V | ||
FNDA:1,coverage/A2$::<clinit> ()V | ||
FNDA:1,coverage/A2$::<init> ()V | ||
FNDA:1,coverage/A2$::a2 ()V | ||
FNDA:0,coverage/A2::a2 ()V | ||
FNF:4 | ||
FNH:3 | ||
DA:3,4 | ||
DA:7,5 | ||
DA:5,11 | ||
DA:8,5 | ||
LH:2 | ||
LF:2 | ||
end_of_record | ||
SF:/B1.scala | ||
FN:-1,B1$::<clinit> ()V | ||
FN:7,B1$::<init> ()V | ||
FN:4,B1$::not_called ()V | ||
FN:-1,B1::not_called ()V | ||
FNDA:1,B1$::<clinit> ()V | ||
FNDA:1,B1$::<init> ()V | ||
FNDA:0,B1$::not_called ()V | ||
FNDA:0,B1::not_called ()V | ||
SF:test/coverage/B1.scala | ||
FN:-1,coverage/B1$::<clinit> ()V | ||
FN:9,coverage/B1$::<init> ()V | ||
FN:6,coverage/B1$::not_called ()V | ||
FN:-1,coverage/B1::not_called ()V | ||
FNDA:1,coverage/B1$::<clinit> ()V | ||
FNDA:1,coverage/B1$::<init> ()V | ||
FNDA:0,coverage/B1$::not_called ()V | ||
FNDA:0,coverage/B1::not_called ()V | ||
FNF:4 | ||
FNH:2 | ||
DA:4,0 | ||
DA:7,5 | ||
DA:6,0 | ||
DA:9,5 | ||
LH:1 | ||
LF:2 | ||
end_of_record | ||
SF:test/coverage/B2.java | ||
FN:3,coverage/B2::<init> ()V | ||
FN:5,coverage/B2::b2_a ()Ljava/lang/String; | ||
FN:9,coverage/B2::b2_b ()V | ||
FNDA:0,coverage/B2::<init> ()V | ||
FNDA:1,coverage/B2::b2_a ()Ljava/lang/String; | ||
FNDA:0,coverage/B2::b2_b ()V | ||
FNF:3 | ||
FNH:1 | ||
DA:3,0 | ||
DA:5,3 | ||
DA:9,0 | ||
DA:10,0 | ||
LH:1 | ||
LF:4 | ||
end_of_record | ||
SF:test/coverage/C2.scala | ||
FN:-1,coverage/C2$::<clinit> ()V | ||
FN:7,coverage/C2$::<init> ()V | ||
FN:5,coverage/C2$::c2 (Ljava/lang/String;)Ljava/lang/String; | ||
FN:-1,coverage/C2::c2 (Ljava/lang/String;)Ljava/lang/String; | ||
FNDA:1,coverage/C2$::<clinit> ()V | ||
FNDA:1,coverage/C2$::<init> ()V | ||
FNDA:1,coverage/C2$::c2 (Ljava/lang/String;)Ljava/lang/String; | ||
FNDA:1,coverage/C2::c2 (Ljava/lang/String;)Ljava/lang/String; | ||
FNF:4 | ||
FNH:4 | ||
DA:5,9 | ||
DA:7,5 | ||
LH:2 | ||
LF:2 | ||
end_of_record | ||
SF:/TestAll.scala | ||
FN:10,TestAll$$anonfun$1::<init> (LTestAll;)V | ||
FN:10,TestAll$$anonfun$1::apply ()V | ||
FN:10,TestAll$$anonfun$1::apply$mcV$sp ()V | ||
FN:6,TestAll$$anonfun$2::<init> (LTestAll;)V | ||
FN:6,TestAll$$anonfun$2::apply ()Lorg/scalatest/compatible/Assertion; | ||
FN:3,TestAll::<init> ()V | ||
FNDA:1,TestAll$$anonfun$1::<init> (LTestAll;)V | ||
FNDA:1,TestAll$$anonfun$1::apply ()V | ||
FNDA:1,TestAll$$anonfun$1::apply$mcV$sp ()V | ||
FNDA:1,TestAll$$anonfun$2::<init> (LTestAll;)V | ||
FNDA:1,TestAll$$anonfun$2::apply ()Lorg/scalatest/compatible/Assertion; | ||
FNDA:1,TestAll::<init> ()V | ||
SF:test/coverage/TestAll.scala | ||
FN:11,coverage/TestAll$$anonfun$1::<init> (Lcoverage/TestAll;)V | ||
FN:11,coverage/TestAll$$anonfun$1::apply ()V | ||
FN:11,coverage/TestAll$$anonfun$1::apply$mcV$sp ()V | ||
FN:7,coverage/TestAll$$anonfun$2::<init> (Lcoverage/TestAll;)V | ||
FN:7,coverage/TestAll$$anonfun$2::apply ()Lorg/scalatest/compatible/Assertion; | ||
FN:4,coverage/TestAll::<init> ()V | ||
FNDA:1,coverage/TestAll$$anonfun$1::<init> (Lcoverage/TestAll;)V | ||
FNDA:1,coverage/TestAll$$anonfun$1::apply ()V | ||
FNDA:1,coverage/TestAll$$anonfun$1::apply$mcV$sp ()V | ||
FNDA:1,coverage/TestAll$$anonfun$2::<init> (Lcoverage/TestAll;)V | ||
FNDA:1,coverage/TestAll$$anonfun$2::apply ()Lorg/scalatest/compatible/Assertion; | ||
FNDA:1,coverage/TestAll::<init> ()V | ||
FNF:6 | ||
FNH:6 | ||
BA:6,2 | ||
BA:7,2 | ||
BRF:1 | ||
BRH:1 | ||
DA:3,2 | ||
DA:5,22 | ||
DA:6,51 | ||
DA:9,23 | ||
DA:10,13 | ||
DA:4,2 | ||
DA:6,22 | ||
DA:7,51 | ||
DA:10,23 | ||
DA:11,13 | ||
LH:5 | ||
LF:5 | ||
end_of_record |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we do
src_paths = [src.path for src in ctx.files.srcs]
? IMHO it's a bit cleaner and more readable to do a list comprehension than a loop with mutation.