Skip to content

Commit b93d704

Browse files
committed
Make the test of jemalloc optional
Jemalloc is not supported on Windows (MSVC). There's no way to run tests of other crates without manually removing jemalloc dependencies and integration tests. This may lead some mistake (e.g. including jemalloc removed `Cargo.toml` to the commit mistakenly) so I want to make easier to ignore the test on Windows. Now, the test will be run only when `jemalloc` feature is enabled. Note that the feature is default feature, since completely ignoring the test by default will forget running the test forever. So `cargo test` will run the test usually. To ignore the test, run `cargo test --no-default-features` to disable `jemalloc` feature.
1 parent 5baaae0 commit b93d704

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

Cargo.toml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ edition = "2018"
99
name = "main"
1010
path = "src/main.rs"
1111

12+
[features]
13+
jemalloc = ["jemalloc-ctl", "jemallocator"]
14+
default = ["jemalloc"]
15+
1216
[dependencies]
1317
# AtCoder 2019年言語アップデート以降に使用できるクレート
1418

@@ -70,8 +74,14 @@ ndarray = "=0.12.1"
7074
nalgebra = "=0.18.1"
7175

7276
# 代替ヒープアロケータ。条件によってはシステムアロケータより速いことも
73-
jemallocator = "=0.3.2"
74-
jemalloc-ctl = "=0.3.3"
77+
[target.'cfg(not(windows))'.dependencies]
78+
jemallocator = { version = "=0.3.2", optional = true }
79+
jemalloc-ctl = { version = "=0.3.3", optional = true }
80+
81+
[[test]]
82+
name = "jemallocator"
83+
path = "tests/test_jemallocator.rs"
84+
required-features = ["jemalloc"]
7585

7686
# ---------------------------------------------------------------------
7787

0 commit comments

Comments
 (0)