Skip to content

Commit

Permalink
Conditionally compile procfs mem_leak test
Browse files Browse the repository at this point in the history
  • Loading branch information
cjdsellers committed Jan 22, 2024
1 parent 5b7b630 commit aef728b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions nautilus_core/persistence/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ criterion = { workspace = true }
rstest = { workspace = true }
quickcheck = "1"
quickcheck_macros = "1"
[target.'cfg(target_os = "linux")'.dependencies]
procfs = "0.16.0"

[[bench]]
Expand Down
3 changes: 3 additions & 0 deletions nautilus_core/persistence/tests/test_catalog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ use nautilus_persistence::{
backend::session::{DataBackendSession, DataQueryResult, QueryResult},
python::backend::session::NautilusDataType,
};
#[cfg(target_os = "linux")]
use procfs::{self, process::Process};
use pyo3::{types::PyCapsule, IntoPy, Py, PyAny, Python};
use rstest::rstest;
Expand All @@ -31,6 +32,7 @@ use rstest::rstest;
/// Uses arguments from setup to run function for given number of iterations.
/// Checks that the difference between memory after 1 and iter + 1 runs is
/// less than threshold.
#[cfg(target_os = "linux")]
fn mem_leak_test<T>(setup: impl FnOnce() -> T, run: impl Fn(&T), threshold: f64, iter: usize) {
let args = setup();
// measure mem after setup
Expand Down Expand Up @@ -58,6 +60,7 @@ fn mem_leak_test<T>(setup: impl FnOnce() -> T, run: impl Fn(&T), threshold: f64,
}
}

#[cfg(target_os = "linux")]
#[rstest]
fn catalog_query_mem_leak_test() {
mem_leak_test(
Expand Down

0 comments on commit aef728b

Please sign in to comment.