Skip to content

Commit 2fceb2d

Browse files
authored
Merge pull request #2153 from dotty-staging/topic/dottest-userman
Add documentation for new parallel testing suite
2 parents a0c0b60 + 29ff5ad commit 2fceb2d

File tree

5 files changed

+129
-7
lines changed

5 files changed

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

docs/docs/contributing/workflow.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,21 @@ $ 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+
The filterTest task takes a regular expression as its argument. For example,
64+
you could run a negative and a positive test with:
65+
66+
```bash
67+
> filterTest (.*pos/t697.scala)|(.*neg/i2101.scala)
68+
```
69+
70+
or if they have the same name, the equivalent can be achieved with:
71+
72+
```bash
73+
> filterTest .*/i2101.scala
74+
```
6575

6676
## Inspecting Trees with Type Stealer ##
6777

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)