Skip to content

Commit 11bd211

Browse files
bors[bot]cuviper
andcommitted
536: Stabilize the rayon testsuite r=nikomatsakis a=cuviper Co-authored-by: Josh Stone <[email protected]>
2 parents dea6b10 + 93d3af1 commit 11bd211

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+434
-391
lines changed

.travis.yml

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,21 @@ matrix:
99
fast_finish: true
1010
include:
1111
# NB: To help with CI delays, each `pull_request` is only tested on Linux,
12-
# with 1.13 for compatibility and nightly+rayon_unstable for broad test
12+
# with 1.13 for compatibility and stable+rayon_unstable for broad test
1313
# coverage. The bors bot counts as a `push` type, which will run it all.
1414

1515
- rust: 1.13.0
1616
os: linux
1717
#if: everything!
18+
script: cargo build
1819

1920
- rust: stable
2021
os: linux
2122
if: NOT type = pull_request
2223
- rust: stable
2324
os: linux
2425
env: RUSTFLAGS='--cfg rayon_unstable'
25-
if: NOT type = pull_request
26+
#if: everything!
2627

2728
- rust: beta
2829
os: linux
@@ -38,7 +39,7 @@ matrix:
3839
- rust: nightly
3940
os: linux
4041
env: RUSTFLAGS='--cfg rayon_unstable'
41-
#if: everything!
42+
if: NOT type = pull_request
4243

4344
- rust: stable
4445
os: osx
@@ -65,23 +66,29 @@ matrix:
6566
- cargo build --target $TARGET
6667
if: NOT type = pull_request
6768

69+
# rayon-demo has huge dependencies, so limit its testing.
70+
# build on stable, test on nightly (because of #[bench])
71+
- rust: stable
72+
os: linux
73+
env: DEMO=1
74+
script: cargo build -p rayon-demo
75+
if: NOT type = pull_request
76+
- rust: nightly
77+
os: linux
78+
env: DEMO=1
79+
script: cargo test -p rayon-demo
80+
if: NOT type = pull_request
81+
6882

6983
script:
7084
- cargo build
71-
- |
72-
if [ $TRAVIS_RUST_VERSION == nightly ]; then
73-
cargo test -p rayon &&
74-
cargo test -p rayon-core &&
75-
cargo test -p rayon-demo &&
76-
./ci/highlander.sh
77-
fi
85+
- cargo test -p rayon
86+
- cargo test -p rayon-core
87+
- ./ci/highlander.sh
7888
- |
7989
if [ -n "$RUSTFLAGS" ]; then
80-
cargo clean &&
8190
cargo build -p rayon-futures &&
82-
if [ $TRAVIS_RUST_VERSION == nightly ]; then
83-
cargo test -p rayon-futures
84-
fi
91+
cargo test -p rayon-futures
8592
fi
8693
8794
branches:

Cargo.toml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ documentation = "https://docs.rs/rayon/"
1111
readme = "README.md"
1212
keywords = ["parallel", "thread", "concurrency", "join", "performance"]
1313
categories = ["concurrency"]
14+
build = "build.rs"
1415

1516
[workspace]
1617
members = ["rayon-demo", "rayon-core", "rayon-futures"]
@@ -30,7 +31,3 @@ lazy_static = "1"
3031
rand = "0.4"
3132
serde = "1"
3233
serde_derive = "1"
33-
34-
# mingw linking rustc crates is missing -ldbghelp, rust-lang/rust#47359
35-
[target.'cfg(not(all(windows, target_env = "gnu")))'.dev-dependencies]
36-
compiletest_rs = "0.3"

README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,18 +106,16 @@ parallel.
106106

107107
```
108108
> cd rayon-demo
109-
> cargo +nightly run --release -- nbody visualize
109+
> cargo run --release -- nbody visualize
110110
```
111111

112112
For more information on demos, try:
113113

114114
```
115115
> cd rayon-demo
116-
> cargo +nightly run --release -- --help
116+
> cargo run --release -- --help
117117
```
118118

119-
**Note:** While Rayon is usable as a library with the stable compiler, running demos or executing tests requires nightly Rust.
120-
121119
## Other questions?
122120

123121
See [the Rayon FAQ][faq].

appveyor.yml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,11 @@ build: false
5252

5353
test_script:
5454
- cargo build
55-
- if [%CHANNEL%]==[nightly] (
56-
cargo test -p rayon &&
57-
cargo test -p rayon-core &&
58-
cargo test -p rayon-demo
59-
)
55+
- cargo test -p rayon
56+
- cargo test -p rayon-core
6057
- if not "%RUSTFLAGS%"=="%^RUSTFLAGS%" (
61-
cargo clean &&
6258
cargo build -p rayon-futures &&
63-
if [%CHANNEL%]==[nightly] (
64-
cargo test -p rayon-futures
65-
)
59+
cargo test -p rayon-futures
6660
)
6761

6862
branches:

rayon-core/Cargo.toml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,26 @@ version = "0.2.0"
2525

2626
[dev-dependencies]
2727
rand = "0.4"
28+
29+
[[test]]
30+
name = "stack_overflow_crash"
31+
path = "tests/stack_overflow_crash.rs"
32+
harness = false
33+
34+
# NB: having one [[test]] manually defined means we need to declare them all
35+
36+
[[test]]
37+
name = "double_init_fail"
38+
path = "tests/double_init_fail.rs"
39+
40+
[[test]]
41+
name = "init_zero_threads"
42+
path = "tests/init_zero_threads.rs"
43+
44+
[[test]]
45+
name = "scope_join"
46+
path = "tests/scope_join.rs"
47+
48+
[[test]]
49+
name = "simple_panic"
50+
path = "tests/simple_panic.rs"

rayon-core/src/compile_fail/mod.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
// These modules contain `compile_fail` doc tests.
3+
mod quicksort_race1;
4+
mod quicksort_race2;
5+
mod quicksort_race3;
6+
mod rc_return;
7+
mod rc_upvar;
8+
mod scope_join_bad;

tests/compile-fail/quicksort_race1.rs renamed to rayon-core/src/compile_fail/quicksort_race1.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
extern crate rayon;
1+
/*! ```compile_fail,E0524
22
33
fn quick_sort<T:PartialOrd+Send>(v: &mut [T]) {
44
if v.len() <= 1 {
@@ -7,7 +7,7 @@ fn quick_sort<T:PartialOrd+Send>(v: &mut [T]) {
77
88
let mid = partition(v);
99
let (lo, _hi) = v.split_at_mut(mid);
10-
rayon::join(|| quick_sort(lo), || quick_sort(lo)); //~ ERROR E0524
10+
rayon_core::join(|| quick_sort(lo), || quick_sort(lo)); //~ ERROR
1111
}
1212
1313
fn partition<T:PartialOrd+Send>(v: &mut [T]) -> usize {
@@ -24,3 +24,5 @@ fn partition<T:PartialOrd+Send>(v: &mut [T]) -> usize {
2424
}
2525
2626
fn main() { }
27+
28+
``` */

tests/compile-fail/quicksort_race2.rs renamed to rayon-core/src/compile_fail/quicksort_race2.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
extern crate rayon;
1+
/*! ```compile_fail,E0500
22
33
fn quick_sort<T:PartialOrd+Send>(v: &mut [T]) {
44
if v.len() <= 1 {
@@ -7,7 +7,7 @@ fn quick_sort<T:PartialOrd+Send>(v: &mut [T]) {
77
88
let mid = partition(v);
99
let (lo, _hi) = v.split_at_mut(mid);
10-
rayon::join(|| quick_sort(lo), || quick_sort(v)); //~ ERROR E0500
10+
rayon_core::join(|| quick_sort(lo), || quick_sort(v)); //~ ERROR
1111
}
1212
1313
fn partition<T:PartialOrd+Send>(v: &mut [T]) -> usize {
@@ -24,3 +24,5 @@ fn partition<T:PartialOrd+Send>(v: &mut [T]) -> usize {
2424
}
2525
2626
fn main() { }
27+
28+
``` */

tests/compile-fail/quicksort_race3.rs renamed to rayon-core/src/compile_fail/quicksort_race3.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
extern crate rayon;
1+
/*! ```compile_fail,E0524
22
33
fn quick_sort<T:PartialOrd+Send>(v: &mut [T]) {
44
if v.len() <= 1 {
@@ -7,7 +7,7 @@ fn quick_sort<T:PartialOrd+Send>(v: &mut [T]) {
77
88
let mid = partition(v);
99
let (_lo, hi) = v.split_at_mut(mid);
10-
rayon::join(|| quick_sort(hi), || quick_sort(hi)); //~ ERROR E0524
10+
rayon_core::join(|| quick_sort(hi), || quick_sort(hi)); //~ ERROR
1111
}
1212
1313
fn partition<T:PartialOrd+Send>(v: &mut [T]) -> usize {
@@ -24,3 +24,5 @@ fn partition<T:PartialOrd+Send>(v: &mut [T]) -> usize {
2424
}
2525
2626
fn main() { }
27+
28+
``` */
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/** ```compile_fail,E0277
2+
3+
use std::rc::Rc;
4+
5+
fn main() {
6+
rayon_core::join(|| Rc::new(22), || ()); //~ ERROR
7+
}
8+
9+
``` */
10+
mod left {}
11+
12+
/** ```compile_fail,E0277
13+
14+
use std::rc::Rc;
15+
16+
fn main() {
17+
rayon_core::join(|| (), || Rc::new(23)); //~ ERROR
18+
}
19+
20+
``` */
21+
mod right {}

0 commit comments

Comments
 (0)