Skip to content

Partest for Dotty with pos tests and neg tests with error count #482

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 4 commits into from
Apr 20, 2015

Conversation

vsalvis
Copy link
Contributor

@vsalvis vsalvis commented Apr 16, 2015

Adding partest infrastructure to Dotty, currently for pos and neg tests. The sources are generated from tests.scala, which is still a regular JUnit test suite. sbt test runs JUnit as before, sbt partest now generates the sources and runs partest.

I couldn't get everything to run through on travis, which fails at a random partest test with java.lang.RuntimeException: Nonzero exit code returned from runner: 137 so for now travis will keep doing test instead of partest.

For eclipse/IntelliJ tests.scala can be used as before. But don't run JUnit tests from the IDE at the same time as running sbt partest. Firstly, in the IDE all tests will pass (they're generating files instead of running the tests) and secondly, partest in the console might fail because you're messing with the directory structure.

@@ -79,7 +83,9 @@ object DottyBuild extends Build {

tuning ::: agentOptions ::: travis_build ::: fullpath
}
)
) ++ (if (isTravisBuild) Seq() else addCommandAlias("test", "partest"))
Copy link
Contributor

Choose a reason for hiding this comment

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

why do we need this alias? why not have both test and partest?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The test key only generates partest files, it doesn't run the tests. So the alias prevents people from having to remember to use partest instead of test.

Copy link
Contributor

Choose a reason for hiding this comment

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

Can we leave the chance to have both? Ie to be able to either execute tests with partest or with JUnit from sbt?

Copy link
Contributor

Choose a reason for hiding this comment

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

the main reason is that I use javaagent to attach to JUnit tests from sbt (see agentOptions), and attaching to partest doesn't make much sense.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see. Does this need to be the test target or would it work with another target (say nonpartest)? I briefly looked at this already, but couldn't get it to work as I couldn't use test frameworks from my own key or set it up the same as Test and test... But I'll try again.

Alternatively, if you need to edit the Build.scala anyway to uncomment agentOptions, I could also add a flag to set agentOptions and use JUnit in that case. That would be much simpler, but wouldn't give a way to run JUnit without reload.

Copy link
Contributor

Choose a reason for hiding this comment

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

Making test mean test feals clearer to me, as travis could also benefit from it(it would run test, not partest).

Silently replacing default task of sbt feels like a very unintuitive action for newcomers, who would naturally expect test to run tests in the same way as travis does it. This cryptic detail would make it harder for newcomers to reproduce failures seen on travis.

If's it's indeed impossible or very hard to achieve, we can live with this.

@vsalvis
Copy link
Contributor Author

vsalvis commented Apr 17, 2015

I figured out how to keep the two independent targets:

  • test runs JUnit tests
  • partest creates a file that tells the JUnit tests to generate partest files, runs test and then runs partest

It's slightly hacky, but should be good enough (not sure what concurrency guarantees are made with respect to deleting a file, in the worst case running partest;test would run partest twice)

The PR is now marked as having merge conflicts. Do I still rebase despite the warnings about rewriting history that has been pushed? And then create a new PR?

@smarter
Copy link
Member

smarter commented Apr 17, 2015

I suggest rebasing and push-forcing this branch, that will update the PR and the comments on the PR diff won't be lost (comments on individual commits are lost when you push-force a PR, but there isn't any in this PR so you're safe).

@vsalvis
Copy link
Contributor Author

vsalvis commented Apr 17, 2015

Thanks, done! Also updated the PR description.

@DarkDimius
Copy link
Contributor

@vsalvis Nice Idea!
In order to solve concurrency issues you can use https://docs.oracle.com/javase/6/docs/api/java/nio/channels/FileLock.html
But this looks good already!

@vsalvis
Copy link
Contributor Author

vsalvis commented Apr 20, 2015

Done, thanks for the pointer. Travis failure is flaky (failed to download sbt-launcher), the last commit passes locally.

DarkDimius added a commit that referenced this pull request Apr 20, 2015
Partest for Dotty with pos tests and neg tests with error count
@DarkDimius DarkDimius merged commit 187480b into scala:master Apr 20, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants