-
-
Notifications
You must be signed in to change notification settings - Fork 404
Zinc
based testQuick
command
#4787
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
Conversation
@lihaoyi This PR is an attempt for the Zinc based design, you can take a look. This uses solely Zinc's The main advantages of this design is that the class dependencies graph is much smaller than methods call graph. Dependencies graph also based on Downside mainly is that we need some conversion between |
Could you elaborate abit on this statement? I know Zinc works and is able to incrementally compile both Java and Scala modules, so shouldn't it also have some model of the Java file-level dependencies in your project? |
cb4f45f
to
b2fd081
Compare
d3043e8
to
9610b60
Compare
9610b60
to
bdcbef9
Compare
@lihaoyi I finally have some free time add an integration test for test-quick, please have a quick look to see if it is good enough. |
assert(secondRun.out.isEmpty) | ||
|
||
// Third run, MyNumber.scala changed, so MyNumberDefaultValueTests & MyNumberCombinatorTests should run | ||
modifyFile(workspacePath / "app" / "src" / "MyNumber.scala", _.replace("def defaultValue: MyNumber = MyNumber(0)", "def defaultValue: MyNumber = MyNumber(1)")) |
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.
This will be the main different between this Zinc
based approach and the method call approach. The method call approach is expected to only trigger the MyNumberDefaultValueTests
test, not the MyNumberCombinatorTests
test
Not sure how to run ad hoc benchmark on this meaningfully, so I just run this with
So in average, the cost to calculate the re-run test is about ~5.87 extra seconds. Compare to the overall runtime of the command, this is about ~4.21% slow down. |
Thanks @HollandDM ! Manually using the |
The time is for this PR, which mean it is |
@lihaoyi I've update the ad-hoc bench result (the old one is accidentally wrong) and add bench result for the other implementation. |
We decided to move forward with #4731 |
This is a alternative design for
testQuick
command, based on Zinc's output. Zinc's incremental compiler is used internally inmill
, and the analysis file is saved in the appropriatecompile.dest
. This file has many interesting information that can be used to identify which test classes need to be re-runAlgorithm
We can get Zinc analysis's
stamps
to identify which source files are changed betweencompile
runs. With all the changed source files, we can then mark theirproduct
s as the source of invalidation, and then do a "spanning invalidation process" (pretty similar tocodesig
's function) using Zinc analysis'srelation
s to collect all invalidatedproduct
s. From there, using the samerelation
objects, we can get the corresponding source files, and then collect all the invalidated classes's absolute path.Having all invalidated absolute path, we can use
testClasspath
to get the invalidated classname that suitable for the test command to run.There are some conversion between sources, products, classpaths, classfiles. This is required because Zinc's
Analysis
object does not have information aboutJava
classnames./claim #4109
see also #4731 for call graph analysis based design.