Skip to content

Commit 1f527f1

Browse files
committed
Proper feature flag propagation in binding tests
1 parent edee487 commit 1f527f1

File tree

3 files changed

+20
-7
lines changed

3 files changed

+20
-7
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
run: cargo test --features secure
4141

4242
- name: Test libmimalloc-sys crate bindings (secure)
43-
run: cargo run --features secure -p libmimalloc-sys-test
43+
run: cargo run --features libmimalloc-sys-test/secure -p libmimalloc-sys-test
4444

4545
- name: Build (no secure)
4646
run: cargo build
@@ -58,7 +58,7 @@ jobs:
5858
run: cargo test --features extended
5959

6060
- name: Test libmimalloc-sys crate bindings (extended)
61-
run: cargo run --features extended -p libmimalloc-sys-test
61+
run: cargo run --features libmimalloc-sys-test/extended -p libmimalloc-sys-test
6262

6363
- name: Build (v3, secure)
6464
run: cargo build --features v3,secure
@@ -67,7 +67,7 @@ jobs:
6767
run: cargo test --features v3,secure
6868

6969
- name: Test libmimalloc-sys crate bindings (v3, secure)
70-
run: cargo run --features v3,secure -p libmimalloc-sys-test
70+
run: cargo run --features libmimalloc-sys-test/v3,libmimalloc-sys-test/secure -p libmimalloc-sys-test
7171

7272
- name: Build (v3, no secure)
7373
run: cargo build --features v3
@@ -76,7 +76,7 @@ jobs:
7676
run: cargo test --features v3
7777

7878
- name: Test libmimalloc-sys crate bindings (v3, no secure)
79-
run: cargo run --features v3 -p libmimalloc-sys-test
79+
run: cargo run --features libmimalloc-sys-test/v3 -p libmimalloc-sys-test
8080

8181
- name: Build (v3, extended)
8282
run: cargo build --features v3,extended
@@ -85,7 +85,7 @@ jobs:
8585
run: cargo test --features v3,extended
8686

8787
- name: Test libmimalloc-sys crate bindings (v3, extended)
88-
run: cargo run --features v3,extended -p libmimalloc-sys-test
88+
run: cargo run --features libmimalloc-sys-test/v3,libmimalloc-sys-test/extended -p libmimalloc-sys-test
8989

9090
lint:
9191
name: Rustfmt / Clippy

libmimalloc-sys/sys-test/Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@ license = "MIT"
88
publish = false
99

1010
[dependencies]
11-
libmimalloc-sys = { path = "..", features = ["extended"] }
11+
libmimalloc-sys = { path = ".." }
1212
libc = "0.2"
1313

1414
[build-dependencies]
1515
ctest2 = "0.4"
1616

1717
[features]
18+
secure = ["libmimalloc-sys/secure"]
19+
extended = ["libmimalloc-sys/extended"]
1820
v3 = ["libmimalloc-sys/v3"]

libmimalloc-sys/sys-test/build.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@ use std::env;
22

33
fn main() {
44
let cargo_manifest_dir = env!("CARGO_MANIFEST_DIR");
5+
let secure = if env::var("CARGO_FEATURE_SECURE").is_ok() {
6+
Some("secure")
7+
} else {
8+
None
9+
};
10+
let extended = if env::var("CARGO_FEATURE_EXTENDED").is_ok() {
11+
Some("extended")
12+
} else {
13+
None
14+
};
515
let version = if env::var("CARGO_FEATURE_V3").is_ok() {
616
"v3"
717
} else {
@@ -13,7 +23,8 @@ fn main() {
1323
.include(format!(
1424
"{cargo_manifest_dir}/../c_src/mimalloc/{version}/include"
1525
))
16-
.cfg("feature", Some("extended"))
26+
.cfg("feature", secure)
27+
.cfg("feature", extended)
1728
.cfg("feature", (version == "v3").then_some("v3"))
1829
.fn_cname(|rust, link_name| link_name.unwrap_or(rust).to_string())
1930
// ignore whether or not the option enum is signed.

0 commit comments

Comments
 (0)