From b93d7043941abf037c6ae6fb58551db60e9bb5e3 Mon Sep 17 00:00:00 2001 From: statiolake Date: Wed, 4 Sep 2019 04:41:21 +0900 Subject: [PATCH] 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. --- Cargo.toml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index ca2501c..8ac8731 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,6 +9,10 @@ edition = "2018" name = "main" path = "src/main.rs" +[features] +jemalloc = ["jemalloc-ctl", "jemallocator"] +default = ["jemalloc"] + [dependencies] # AtCoder 2019年言語アップデート以降に使用できるクレート @@ -70,8 +74,14 @@ ndarray = "=0.12.1" nalgebra = "=0.18.1" # 代替ヒープアロケータ。条件によってはシステムアロケータより速いことも -jemallocator = "=0.3.2" -jemalloc-ctl = "=0.3.3" +[target.'cfg(not(windows))'.dependencies] +jemallocator = { version = "=0.3.2", optional = true } +jemalloc-ctl = { version = "=0.3.3", optional = true } + +[[test]] +name = "jemallocator" +path = "tests/test_jemallocator.rs" +required-features = ["jemalloc"] # ---------------------------------------------------------------------