Skip to content

Operation Kill Partest (part 1) #2125

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

Merged
merged 39 commits into from
Mar 29, 2017

Conversation

felixmulder
Copy link
Contributor

@felixmulder felixmulder commented Mar 20, 2017

Partest is dead, long live [name for new testing "framework"]!

@felixmulder felixmulder changed the title Kill partest [WIP] Kill partest Mar 20, 2017
@felixmulder felixmulder changed the title [WIP] Kill partest Kill partest Mar 20, 2017
@felixmulder felixmulder requested a review from DarkDimius March 20, 2017 16:24
@smarter
Copy link
Member

smarter commented Mar 20, 2017

Awesome! I think this is missing one great feature from partest: A good summary report. When I scroll to the end of the logs I should be able to see at a glance:

  • What test methods failed
  • In each failed test method, what files failed to compile/run
  • The exact command-line invocation I should use to run this test manually

A related feature is log files, which partest also outputs (but delete for non-failed tests), when the compiler output is really huge, it's very helpful to be able to navigate a log file instead of scrolling for hours. Also related: partest keeps output directories for failed run tests, this makes it easy to inspect them with javap or a decompiler to figure out what's going on.

@smarter
Copy link
Member

smarter commented Mar 20, 2017

Also, I know this was already the case but it's really bugging me now: can we fix dotty.tools.dottydoc.TestWhitelistedCollections so that its output does not fill most of the log? I'm talking about all the:

Compiling (1/546): Platform.scala
Compiling (2/546): ScalaBeanInfo.scala
Compiling (3/546): BeanInfoSkip.scala
...

@smarter
Copy link
Member

smarter commented Mar 20, 2017

Basically all tests that instantiate a compiler should use a custom reporter that writes things to a logfile, that logfile should be kept only if specified by the user or if the test failed.

@felixmulder
Copy link
Contributor Author

Awesome! I think this is missing one great feature from partest: A good summary report. When I scroll to the end of the logs I should be able to see at a glance:

Sure

Also, I know this was already the case but it's really bugging me now: can we fix dotty.tools.dottydoc.TestWhitelistedCollections so that its output does not fill most of the log? I'm talking about all the:

Ah huh

Basically all tests that instantiate a compiler should use a custom reporter that writes things to a logfile, that logfile should be kept only if specified by the user or if the test failed.

Mhm

All good ideas, I'll get them in tomorrow.

),
defaultOptions.and("-Xprompt")
)
}.times(2).pos()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you try making a -Ytimes option instead, as we discussed recently?

Copy link
Contributor Author

@felixmulder felixmulder Mar 21, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No - let's discuss this afternoon

@felixmulder felixmulder force-pushed the topic/kill-partest branch 2 times, most recently from 1978085 to da8e352 Compare March 23, 2017 13:23
smarter added a commit to dotty-staging/dotty that referenced this pull request Mar 23, 2017
… a real one

Previously, we sometimes ended up forcing a companion class symbol from
a previous run or from the classpath which lead to weird issues like in
`false-companion`. Even if we end up not forcing such a symbol, its
presence can still lead to issue: before this commit incremental
compilation of `dotty-compiler-bootstrapped` was broken because we
recorded a false dependency on the non-bootstrapped `dotty-compiler`
jar.

The added test is currently marked pending because it does not work with
JUnit (which doesn't handle separate compilation), only partest. I
didn't managed to get it to work right, and this won't be necessary once
our testing framework is overhauled by
scala#2125 anyway, so I'll just have to
remember to enable this test afterwards.
@felixmulder felixmulder force-pushed the topic/kill-partest branch 2 times, most recently from b669dcb to b66f5d3 Compare March 27, 2017 11:25
@DarkDimius
Copy link
Contributor

@felixmulder, is this PR ready for review?

@felixmulder
Copy link
Contributor Author

felixmulder commented Mar 27, 2017

@DarkDimius - yes mostly, I have two things left to add before I want this merged:

  • being able to run a single test / or set of files
  • testing output of meta tests

maybe the first one will affect the implementation somewhat, but the second one most likely won't. If you want to review it now that would be great, but you can also wait until I've fixed the first point. Up to you 🙂

@felixmulder felixmulder force-pushed the topic/kill-partest branch 5 times, most recently from c2b606b to 4eb8cba Compare March 27, 2017 15:09
@felixmulder
Copy link
Contributor Author

@DarkDimius - done with point 1

if (seen.contains(elem.getMethodName)) false
else { seen += elem.getMethodName; true }
}
.take(6).find { elem =>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Magic number?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sort of magic, we shouldn't go through more than a few levels of indirection... but maybe I should take out the magic number

@odersky
Copy link
Contributor

odersky commented Mar 29, 2017

Currently there is a check of creation dates. The compiler always picks the file that's newer. It has been done like this since the days of javac and I think it's a good strategy to keep.

@smarter
Copy link
Member

smarter commented Mar 29, 2017

@DarkDimius Compiling is not the problem, the problem is that we use the same JVM to classload the compiler output for run tests, so if you classload Test and Test tries to use your custom implementation of List, it will fail because an existing List has already been classloaded.

@DarkDimius
Copy link
Contributor

@odersky, yes, that what I've meant by an old copy. Didn't know javac did the same.

@DarkDimius
Copy link
Contributor

@smarter, JVM doesn't have global notion of classloading. It has class loading - per class loader.
The fact that another classloader in the same VM has already classloaded a class is unrelated.

By setting up classloaders correctly you should be able to get behavior that custom implementation of the List will be preferred.
Here's an example of how this is done. http://stackoverflow.com/questions/5445511/how-do-i-create-a-parent-last-child-first-classloader-in-java-or-how-to-overr

@smarter
Copy link
Member

smarter commented Mar 29, 2017

@DarkDimius Yes you can do really crazy things if you try hard enough, but I don't think it's worth it since we'll go to multiple JVMs in the future. Also consider that currently the standard collection is on the bootclasspath, so I'm not even sure if you can override that.

@DarkDimius
Copy link
Contributor

DarkDimius commented Mar 29, 2017

@smarter, I wouldn't consider 16 lines of trivial implementation code in java as "crazy things if you try hard enough". This is a lot simpler than things we do everyday here.

I don't think this is going to be fixed by going multiple JVM approach if you'll reuse the VMs.
For the same reason: you'll need to have separate classpath for every test. All of those tests share stdlib, but have classes that may take priority over stdlib.

felixmulder added a commit to dotty-staging/dotty that referenced this pull request Mar 29, 2017
@smarter
Copy link
Member

smarter commented Mar 29, 2017

I don't think we'll need a custom ClassLoader implementation if we use multiple JVMs even if they're persistent. We can just launch the JVM with nothing from scala in the classpath, and everytime we want to run a test we ask the JVM to create a new URLClassLoader with the complete classpath we want to use and classload Test using it.

@felixmulder
Copy link
Contributor Author

Can we agree to put this classloading business into part 2 of killing partest? 🙂

@DarkDimius
Copy link
Contributor

Given that it became such a contentious topic - yes.
There's one more question left: #2125 (comment)

@felixmulder
Copy link
Contributor Author

Let's remove partest after having this run for about a week or so alongside the new suite.

@DarkDimius
Copy link
Contributor

I agree, but doesn't this pr remove partest from drone.yml?

- ;set testOptions in LocalProject("dotty-compiler") += Tests.Argument(TestFrameworks.JUnit, "--exclude-categories=dotty.tools.dotc.ParallelTesting") ;test ;dotty-bin-tests/test
- ;set testOptions in LocalProject("dotty-compiler-bootstrapped") += Tests.Argument(TestFrameworks.JUnit, "--exclude-categories=dotty.tools.dotc.ParallelTesting") ;publishLocal ;dotty-bootstrapped/test
- ;set testOptions in LocalProject("dotty-compiler") += Tests.Argument(TestFrameworks.JUnit, "--exclude-categories=dotty.tools.dotc.ParallelTesting") ;partest-only-no-bootstrap --show-diff --verbose
- ;set testOptions in LocalProject("dotty-compiler-bootstrapped") += Tests.Argument(TestFrameworks.JUnit, "--exclude-categories=dotty.tools.dotc.ParallelTesting") ;partest-only --show-diff --verbose
Copy link
Contributor Author

@felixmulder felixmulder Mar 29, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DarkDimius - here you can see that partest is still included, with the new unit tests filtered out.

Once we want to remove partest from the CI these, lines dissappear and the only two left will be:

- ;test ;dotty-bin-tests/test
- ;publishLocal ;dotty-bootstrapped/test

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@felixmulder, thank you for clarification.

@felixmulder
Copy link
Contributor Author

Alright - before we merge this. Can we decide upon a strategy for the memory settings?

I have not been able to see much of a difference when altering them from the current settings. Especially now that partest is kept.

@DarkDimius
Copy link
Contributor

DarkDimius commented Mar 29, 2017

For metaspace, the current change I believe is unnecessary.
@felixmulder, I propose we postpone this decision till we decide what to do with classloaders.
The approach proposed by @smarter requires substantially more metaspace & code cache memory for JIT. I won't be surprised if it will simply disable some parts of JIT due to too aggressive classloading.

I would expect my proposed approach to be able to fit in <1gb of metaspace and <256mb of code-cache with a lot of spare room and be a lot more JIT friendly.

It is necessary to do this in a new commit because of having to make
sure that the signed drone file is current
@felixmulder felixmulder merged commit 4757a6b into scala:master Mar 29, 2017
@felixmulder felixmulder deleted the topic/kill-partest branch March 29, 2017 13:39
OlivierBlanvillain pushed a commit to dotty-staging/dotty that referenced this pull request Mar 30, 2017
… a real one

Previously, we sometimes ended up forcing a companion class symbol from
a previous run or from the classpath which lead to weird issues like in
`false-companion`. Even if we end up not forcing such a symbol, its
presence can still lead to issue: before this commit incremental
compilation of `dotty-compiler-bootstrapped` was broken because we
recorded a false dependency on the non-bootstrapped `dotty-compiler`
jar.

The added test is currently marked pending because it does not work with
JUnit (which doesn't handle separate compilation), only partest. I
didn't managed to get it to work right, and this won't be necessary once
our testing framework is overhauled by
scala#2125 anyway, so I'll just have to
remember to enable this test afterwards.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants