Skip to content

Commit

Permalink
chore: checks existence of --test-threads=1
Browse files Browse the repository at this point in the history
* With that we can decide to print or not the log::error related to the
  memory usage in tests.
  • Loading branch information
helio-frota authored and ctron committed Sep 12, 2024
1 parent 5a18d75 commit 005ebb8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion test-context/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,9 @@ impl AsyncTestContext for TrustifyContext {

async fn teardown(self) {
let peak_mem = PEAK_ALLOC.peak_usage_as_mb();
if peak_mem > self.mem_limit_mb {
let args: Vec<String> = env::args().collect();
// Prints the error message when running the tests with threads=1
if args.iter().any(|arg| arg == "--test-threads=1") && peak_mem > self.mem_limit_mb {
log::error!("Too much RAM used: {peak_mem} MB");
}
PEAK_ALLOC.reset_peak_usage();
Expand Down

0 comments on commit 005ebb8

Please sign in to comment.