8000 temporarily posting a preview version of the hacker guide · phaller/scala.github.com@3594d0f · GitHub
[go: up one dir, main page]

Skip to content

Commit 3594d0f

Browse files
committed
temporarily posting a preview version of the hacker guide
So that I can link it to external reviewers (as discussed with Heather). Please do not distribute links to this guide as it will end up elsewhere, and we don't want to fix broken links afterwards.
1 parent 43798d6 commit 3594d0f

File tree

7 files changed

+405
-0
lines changed

7 files changed

+405
-0
lines changed

tutorials/01-post.png

169 KB
Loading

tutorials/02-post.png

112 KB
Loading

tutorials/03-fork.png

45.1 KB
Loading

tutorials/04-submit.png

163 KB
Loading

tutorials/05-review.png

29 KB
Loading

tutorials/hacker-guide.md

Lines changed: 339 additions & 0 deletions
Large diffs are not rendered by default.

tutorials/partest-guide.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
---
2+
layout: page
3+
title: Running the Test Suite
4+
---
5+
6+
Partest is a custom parallel testing tool that we use to run the test suite for the Scala compiler and library. Go the scala project folder from your local checkout and run it via `ant` or standalone as follows.
7+
8+
## Using ant
9+
10+
The test suite can be run by using ant from the command line:
11+
12+
$ ant test.suite
13+
14+
## Standalone
15+
16+
There are launch scripts `partest` and `partest.bat` in the `test` folder of the scala project. To have partest run failing tests only and print details about test failures to the console, you can use
17+
18+
./test/partest --show-diff --show-log --failed
19+
20+
You can get a summary of the usage by running partest without arguments.
21+
22+
* Most commonly you want to invoke partest with an option that tells it which part of the tests to run. For example `--all`, `--pos`, `--neg` or `--run`.
23+
* You can test individual files by specifying individual test files (`.scala` files) as options. Several files can be tested if they are from the same category, e.g., `pos`.
24+
* You can enable output of log and diff using the `-show-log` and `-show-diff` options.
25+
* If you get into real trouble, and want to find out what partest does, you can run it with option `--verbose`. This info is useful as part of bug reports.
26+
* Set custom path from where to load classes: `-classpath <path>` and `-buildpath <path>`.
27+
* You can use the `SCALAC_OPTS` environment variable to pass command line options to the compiler.
28+
* You can use the `JAVA_OPTS` environment variable to pass command line options to the runner (e.g., for `run/jvm` tests).
29+
* The launch scripts run partest as follows:
30+
31+
scala -cp <path to partest classes> scala.tools.partest.nest.NestRunner <options>
32+
33+
Partest classes from a `quick` build, e.g., can be found in `./build/quick/classes/partest/`.
34+
35+
Partest will tell you where it loads compiler/library classes from by adding the `partest.debug` property:
36+
37+
scala -Dpartest.debug=true -cp <path to partest classes> scala.tools.partest.nest.NestRunner <options>
38+
39+
40+
41+
## ScalaCheck tests
42+
43+
Tests that depend on [ScalaCheck](https://github.com/rickynils/scalacheck) can be added under folder `./test/files/scalacheck`. A sample test:
44+
45+
import org.scalacheck._
46+
import Prop._
47+
48+
object Test {
49+
val prop_ConcatLists = property{ (l1: ListInt, l2: ListInt) =>
50+
l1.size + l2.size == (l1 ::: l2).size
51+
}
52+
53+
val tests = List(("prop_ConcatLists", prop_ConcatLists))
54+
}
55+
56+
## Troubleshooting
57+
58+
### Windows
59+
60+
Some tests might fail because line endings in the `.check` files and the produced results do not match. In that case, set either
61+
62+
git config core.autocrlf false
63+
64+
or
65+
66+
git config core.autocrlf input

0 commit comments

Comments
 (0)
0