From 9de8f90afbf8a9579dbb292c650653e5b7178ead Mon Sep 17 00:00:00 2001 From: Arpad Borsos Date: Mon, 31 Jul 2023 16:34:21 +0200 Subject: [PATCH] Add `jemalloc` to test `-sys` style dependencies --- .github/workflows/simple.yml | 3 ++- tests/Cargo.lock | 21 +++++++++++++++++++++ tests/Cargo.toml | 3 +++ tests/src/main.rs | 7 +++++++ 4 files changed, 33 insertions(+), 1 deletion(-) diff --git a/.github/workflows/simple.yml b/.github/workflows/simple.yml index 628cfab..8f9333f 100644 --- a/.github/workflows/simple.yml +++ b/.github/workflows/simple.yml @@ -9,7 +9,7 @@ jobs: matrix: os: [ubuntu-latest, macos-latest, windows-latest] - name: Test `cargo check/test` on ${{ matrix.os }} + name: Test `cargo check/test/build` on ${{ matrix.os }} runs-on: ${{ matrix.os }} env: @@ -27,4 +27,5 @@ jobs: - run: | cargo check cargo test + cargo build --release working-directory: tests diff --git a/tests/Cargo.lock b/tests/Cargo.lock index 5d0b863..aa18327 100644 --- a/tests/Cargo.lock +++ b/tests/Cargo.lock @@ -523,6 +523,7 @@ name = "rust-cache" version = "0.1.0" dependencies = [ "reqwest", + "tikv-jemallocator", "watto", ] @@ -658,6 +659,26 @@ dependencies = [ "syn", ] +[[package]] +name = "tikv-jemalloc-sys" +version = "0.5.4+5.3.0-patched" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9402443cb8fd499b6f327e40565234ff34dbda27460c5b47db0db77443dd85d1" +dependencies = [ + "cc", + "libc", +] + +[[package]] +name = "tikv-jemallocator" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "965fe0c26be5c56c94e38ba547249074803efd52adfb66de62107d95aab3eaca" +dependencies = [ + "libc", + "tikv-jemalloc-sys", +] + [[package]] name = "tinyvec" version = "1.6.0" diff --git a/tests/Cargo.toml b/tests/Cargo.toml index 9551988..aeeec60 100644 --- a/tests/Cargo.toml +++ b/tests/Cargo.toml @@ -8,3 +8,6 @@ edition = "2021" [dependencies] reqwest = "0.11.11" watto = { git = "https://github.com/getsentry/watto", rev = "d71c8218506bddba102a124a460d64da25e303dc", features = ["strings"] } + +[target.'cfg(not(target_env = "msvc"))'.dependencies] +tikv-jemallocator = "0.5" diff --git a/tests/src/main.rs b/tests/src/main.rs index ed1f592..c12e9ad 100644 --- a/tests/src/main.rs +++ b/tests/src/main.rs @@ -1,3 +1,10 @@ +#[cfg(not(target_env = "msvc"))] +use tikv_jemallocator::Jemalloc; + +#[cfg(not(target_env = "msvc"))] +#[global_allocator] +static GLOBAL: Jemalloc = Jemalloc; + fn main() { println!("Hello, world!"); }