-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add documentation for new parallel testing suite #2153
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
Changes from all commits
Commits
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 hidden or 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 hidden or 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 |
---|---|---|
@@ -0,0 +1,89 @@ | ||
--- | ||
layout: doc-page | ||
title: Testing in Dotty | ||
--- | ||
|
||
<aside class="warning"> | ||
This page should be updated as soon as scala-partest is removed | ||
</aside> | ||
|
||
Running all tests in Dotty is as simple as: | ||
|
||
```bash | ||
$ sbt test | ||
``` | ||
|
||
There are currently several forms of tests in Dotty. These can be split into | ||
two categories: | ||
|
||
## Unit tests | ||
These tests can be found in `<sub-project>/test` and are used to check | ||
functionality of specific parts of the codebase in isolation e.g: parsing, | ||
scanning and message errors. | ||
|
||
Running a single unit test class from sbt is as simple as: | ||
|
||
```bash | ||
> testOnly absolute.path.to.TestClass | ||
``` | ||
|
||
You can further restrict the executed tests to a subset of `TestClass` methods | ||
as follows: | ||
|
||
```bash | ||
> testOnly absolute.path.to.TestClass -- *methodName | ||
``` | ||
|
||
## Integration tests | ||
These tests are Scala source files expected to compile with Dotty (pos tests), | ||
along with their expected output (run tests) or errors (neg tests). | ||
|
||
All of these tests are contained in the `./tests/*` directories. | ||
|
||
## scala-partest | ||
Historically these tests needed a structure which was generated by running the | ||
unit tests, and then that structure was in turn used by | ||
[scala-partest](http://github.com/scala/scala-partest) to run compilation tests | ||
in parallel. | ||
|
||
This test suite can still be used (and is currently a part of the CI to check | ||
that it has the same outcome as the new test suite). It is invoked from sbt by | ||
running one of the following commands: | ||
|
||
```bash | ||
> partest-only-no-bootstrap | ||
> partest-only | ||
> partest | ||
``` | ||
|
||
- `partest-only-no-bootstrap` will only run the integration tests | ||
- `partest-only` will bootstrap the compiler and run the integration tests | ||
- `partest` will bootstrap the compiler, run the unit tests and then the | ||
integration tests | ||
|
||
## dotty parallel test suite | ||
The new test suite will soon become the standard integration test runner. It | ||
has several advantages over the old implementation: | ||
|
||
- integrates with JUnit, without the need for setup | ||
- reuses the same VM for compilation | ||
- allows filtering of tests | ||
- runs much faster (almost 2x) | ||
|
||
Currently to run these tests you need to invoke from sbt: | ||
|
||
```bash | ||
> testOnly dotty.tools.dotc.CompilationTests | ||
``` | ||
|
||
This might be aliased in the future. It is also possible to run tests filtered | ||
by using: | ||
|
||
```bash | ||
> filterTest .*i2147.scala | ||
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. What do you think about using testOnly for both by class name and by regex filtering? 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. I think that would be cool. Please implement |
||
``` | ||
|
||
This will run both the test `./tests/pos/i2147.scala` and | ||
`./tests/partest-test/i2147.scala` since both of these match the given regular | ||
expression. This also means that you could run `filterTest .*` to run all | ||
integration tests. |
This file contains hidden or 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 hidden or 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 hidden or 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
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 you explain the
*
here?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.
From what I gather the
*methodName
is equivalent to-z methodName
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.
Should I include this instead?
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.
I not sure it's better, but it might be a bit confusing to have both
.*
and*
in the such similar placesThere 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.
Decided to merge this so that @abeln can base his docs update on it.
I'll get to the docs again once I've fixed the deadlock situation.