Skip to content

Commit d21c0cf

Browse files
committed
Move all alloc integration tests to a new alloctests crate
1 parent a18bd8a commit d21c0cf

Some content is hidden

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

58 files changed

+66
-22
lines changed

library/Cargo.lock

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,14 @@ version = "0.2.21"
4040
source = "registry+https://github.com/rust-lang/crates.io-index"
4141
checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923"
4242

43+
[[package]]
44+
name = "alloctests"
45+
version = "0.0.0"
46+
dependencies = [
47+
"rand",
48+
"rand_xorshift",
49+
]
50+
4351
[[package]]
4452
name = "cc"
4553
version = "1.2.0"

library/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ members = [
44
"std",
55
"sysroot",
66
"coretests",
7+
"alloctests",
78
]
89

910
exclude = [

library/alloc/Cargo.toml

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,6 @@ compiler_builtins = { version = "=0.1.146", features = ['rustc-dep-of-std'] }
1616
rand = { version = "0.9.0", default-features = false, features = ["alloc"] }
1717
rand_xorshift = "0.4.0"
1818

19-
[[test]]
20-
name = "alloctests"
21-
path = "tests/lib.rs"
22-
23-
[[test]]
24-
name = "vec_deque_alloc_error"
25-
path = "tests/vec_deque_alloc_error.rs"
26-
27-
[[bench]]
28-
name = "allocbenches"
29-
path = "benches/lib.rs"
30-
test = true
31-
32-
[[bench]]
33-
name = "vec_deque_append_bench"
34-
path = "benches/vec_deque_append.rs"
35-
harness = false
36-
3719
[features]
3820
compiler-builtins-mem = ['compiler_builtins/mem']
3921
compiler-builtins-c = ["compiler_builtins/c"]
File renamed without changes.
File renamed without changes.

library/alloctests/Cargo.toml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
[package]
2+
name = "alloctests"
3+
version = "0.0.0"
4+
license = "MIT OR Apache-2.0"
5+
repository = "https://github.com/rust-lang/rust.git"
6+
description = "Tests for the Rust Allocation Library"
7+
autotests = false
8+
autobenches = false
9+
edition = "2021"
10+
11+
[lib]
12+
path = "lib.rs"
13+
test = false
14+
bench = false
15+
16+
[dev-dependencies]
17+
rand = { version = "0.8.5", default-features = false, features = ["alloc"] }
18+
rand_xorshift = "0.3.0"
19+
20+
[[test]]
21+
name = "alloctests"
22+
path = "tests/lib.rs"
23+
24+
[[test]]
25+
name = "vec_deque_alloc_error"
26+
path = "tests/vec_deque_alloc_error.rs"
27+
28+
[[bench]]
29+
name = "allocbenches"
30+
path = "benches/lib.rs"
31+
test = true
32+
33+
[[bench]]
34+
name = "vec_deque_append_bench"
35+
path = "benches/vec_deque_append.rs"
36+
harness = false
37+
38+
[lints.rust.unexpected_cfgs]
39+
level = "warn"
40+
check-cfg = [
41+
'cfg(bootstrap)',
42+
'cfg(no_global_oom_handling)',
43+
'cfg(no_rc)',
44+
'cfg(no_sync)',
45+
'cfg(randomized_layouts)',
46+
]
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

library/alloctests/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// Intentionally left empty.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

library/alloc/tests/lib.rs renamed to library/alloctests/tests/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,12 @@
4545
#![deny(fuzzy_provenance_casts)]
4646
#![deny(unsafe_op_in_unsafe_fn)]
4747

48+
extern crate alloc;
4849
extern crate test;
4950

5051
use std::hash::{DefaultHasher, Hash, Hasher};
5152

52-
mod alloc;
53+
mod alloc_test;
5354
mod arc;
5455
mod autotraits;
5556
mod borrow;
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/bootstrap/mk/Makefile.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,15 @@ check-aux:
5656
# Run standard library tests in Miri.
5757
$(Q)$(BOOTSTRAP) miri --stage 2 \
5858
library/coretests \
59+
library/alloctests \
5960
library/alloc \
6061
$(BOOTSTRAP_ARGS) \
6162
--no-doc
6263
# Some doctests use file system operations to demonstrate dealing with `Result`.
6364
$(Q)MIRIFLAGS="-Zmiri-disable-isolation" \
6465
$(BOOTSTRAP) miri --stage 2 \
6566
library/coretests \
67+
library/alloctests \
6668
library/alloc \
6769
$(BOOTSTRAP_ARGS) \
6870
--doc

src/bootstrap/src/core/build_steps/check.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,10 @@ impl Step for Std {
4545
const DEFAULT: bool = true;
4646

4747
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
48-
run.crate_or_deps("sysroot").crate_or_deps("coretests").path("library")
48+
run.crate_or_deps("sysroot")
49+
.crate_or_deps("coretests")
50+
.crate_or_deps("alloctests")
51+
.path("library")
4952
}
5053

5154
fn make_run(run: RunConfig<'_>) {

src/bootstrap/src/core/build_steps/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2669,7 +2669,7 @@ impl Step for Crate {
26692669
const DEFAULT: bool = true;
26702670

26712671
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
2672-
run.crate_or_deps("sysroot").crate_or_deps("coretests")
2672+
run.crate_or_deps("sysroot").crate_or_deps("coretests").crate_or_deps("alloctests")
26732673
}
26742674

26752675
fn make_run(run: RunConfig<'_>) {

src/tools/tidy/src/style.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ pub fn check(path: &Path, bad: &mut bool) {
462462
&& !trimmed.starts_with("//")
463463
&& !file.ancestors().any(|a| {
464464
(a.ends_with("tests") && a.join("COMPILER_TESTS.md").exists())
465-
|| a.ends_with("library/alloc/tests")
465+
|| a.ends_with("library/alloctests")
466466
})
467467
&& filename != "tests.rs"
468468
{

0 commit comments

Comments
 (0)