Skip to content

Commit 0e772dd

Browse files
committed
Add documentation for new parallel testing suite
1 parent f49c10d commit 0e772dd

File tree

5 files changed

+126
-7
lines changed

5 files changed

+126
-7
lines changed

doc-tool/resources/css/dottydoc.css

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,3 +334,23 @@ blockquote {
334334
color: #777;
335335
border-left: 0.25em solid #ddd;
336336
}
337+
338+
aside {
339+
padding: 15px;
340+
margin: 10px 0;
341+
}
342+
343+
aside.warning {
344+
border-left: 3px solid #d62c2c;
345+
background-color: #ffe4e4;
346+
}
347+
348+
aside.notice {
349+
border-left: 3px solid #4c97e4;
350+
background-color: #e4ebff;
351+
}
352+
353+
aside.success {
354+
border-left: 3px solid #36bf1d;
355+
background-color: #ebfddd;
356+
}

docs/docs/contributing/testing.md

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
---
2+
layout: doc-page
3+
title: Testing in Dotty
4+
---
5+
6+
<aside class="warning">
7+
This page should be updated as soon as scala-partest is removed
8+
</aside>
9+
10+
Running all tests in Dotty is as simple as:
11+
12+
```bash
13+
$ sbt
14+
> test
15+
```
16+
17+
There are currently several forms of tests in Dotty. These can be split into
18+
two categories:
19+
20+
## Unit tests
21+
These tests can be found in `<sub-project>/test` and are used to check
22+
functionality of specific parts of the codebase in isolation, such e.g.
23+
parsing, scanning and message errors.
24+
25+
Running a single unit test class is as simple as:
26+
27+
```bash
28+
$ sbt
29+
> testOnly absolute.path.to.TestClass
30+
```
31+
32+
To filter out individual tests you can use:
33+
34+
```bash
35+
$ sbt
36+
> testOnly absolute.path.to.TestClass -- *methodName
37+
```
38+
39+
## Integration tests
40+
These tests are source files compiled by Dotty with an expected amount of
41+
errors or output. All of these tests are contained inside the `./tests/*`
42+
directories.
43+
44+
## scala-partest
45+
Historically these tests needed a structure which was generated by running the
46+
unit tests, and then that structure was in turn used by
47+
[scala-partest](http://github.com/scala/scala-partest) to run compilation tests
48+
in parallel.
49+
50+
This test suite can still be used (and is currently a part of the CI to check
51+
that it has the same outcome as the new test suite). It is invoked from sbt by
52+
running one of the following commands:
53+
54+
```bash
55+
> partest-only-no-bootstrap
56+
> partest-only
57+
> partest
58+
```
59+
60+
- `partest-only-no-bootstrap` will only run the integration tests
61+
- `partest-only` will bootstrap the compiler and run the integration tests
62+
- `partest` will bootstrap the compiler, run the unit tests and then the
63+
integration tests
64+
65+
## dotty partest
66+
The new test suite will soon become the standard integration test runner. It
67+
has several advantages over the old implementation.
68+
69+
- integrates with JUnit, without the need for setup
70+
- reuses the same VM for compilation
71+
- can filter tests
72+
- much faster than scala-partest (almost 2x)
73+
74+
Currently to run these tests you need to invoke from sbt:
75+
76+
```bash
77+
> testOnly dotty.tools.dotc.CompilationTests
78+
```
79+
80+
This might be aliased in the future. It is also possible to run tests filtered
81+
by using:
82+
83+
```bash
84+
> filterTest .*i2147.scala
85+
```
86+
87+
This will run both the test `./tests/pos/i2147.scala` and
88+
`./tests/partest-test/i2147.scala` since both of these match the given regular
89+
expression. This also means that you could run `filterTest .*` to run all
90+
integration tests.

docs/docs/contributing/workflow.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,17 @@ $ sbt
5757
To test a specific test tests/x/y.scala (for example tests/pos/t210.scala):
5858

5959
```bash
60-
> partest-only-no-bootstrap --show-diff --verbose tests/partest-generated/x/y.scala
60+
> filterTest .*pos/t210.scala
6161
```
6262

63-
Currently this will re-run some unit tests and do some preprocessing because of
64-
the way partest has been set up.
63+
As you can see, the `filterTest` task takes a regular expression as its
64+
argument. This can be used so that if you have multiple tests for an issue, e.g
65+
one negative test and one positive in different directories - you can run both
66+
with:
67+
68+
```bash
69+
> filterTest .*myTest.scala
70+
```
6571

6672
## Inspecting Trees with Type Stealer ##
6773

docs/docs/internals/higher-kinded-v2.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ layout: doc-page
33
title: "Higher-Kinded Types in Dotty"
44
---
55

6-
**This page is out of date and preserved for posterity. Please see [Implementing
7-
Higher-Kinded Types in
8-
Dotty](http://guillaume.martres.me/publications/dotty-hk.pdf) for a more up to
9-
date version**
6+
<aside class="warning">
7+
This page is out of date and preserved for posterity. Please see
8+
<a href="http://guillaume.martres.me/publications/dotty-hk.pdf">
9+
Implementing Higher-Kinded Types in Dotty</a> for a more up to date version
10+
</aside>
1011

1112
Higher-Kinded Types in Dotty V2
1213
===============================

docs/sidebar.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ sidebar:
2323
url: docs/contributing/intellij-idea.html
2424
- title: Workflow
2525
url: docs/contributing/workflow.html
26+
- title: Testing
27+
url: docs/contributing/testing.html
2628
- title: Internals
2729
subsection:
2830
- title: Backend

0 commit comments

Comments
 (0)