Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include both benchmarks and tests in the numbers given to TeFiltered{,Out} #103795

Merged
merged 4 commits into from
Oct 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions library/test/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,9 @@ impl FilteredTests {
}));
self.add_test(desc, testfn);
}
fn total_len(&self) -> usize {
self.tests.len() + self.benchs.len()
}
}

pub fn run_tests<F>(
Expand Down Expand Up @@ -303,13 +306,13 @@ where
};
}

let filtered_out = tests_len - filtered.tests.len();
let filtered_out = tests_len - filtered.total_len();
let event = TestEvent::TeFilteredOut(filtered_out);
notify_about_test_event(event)?;

let shuffle_seed = get_shuffle_seed(opts);

let event = TestEvent::TeFiltered(filtered.tests.len(), shuffle_seed);
let event = TestEvent::TeFiltered(filtered.total_len(), shuffle_seed);
notify_about_test_event(event)?;

let concurrency = opts.test_threads.unwrap_or_else(get_concurrency);
Expand Down
11 changes: 11 additions & 0 deletions src/test/run-make/test-benches/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
include ../../run-make-fulldeps/tools.mk

# ignore-cross-compile

all:
# Smoke-test that `#[bench]` isn't entirely broken.
$(RUSTC) --test smokebench.rs -O
$(call RUN,smokebench --bench)
$(call RUN,smokebench --bench noiter)
$(call RUN,smokebench --bench yesiter)
$(call RUN,smokebench)
14 changes: 14 additions & 0 deletions src/test/run-make/test-benches/smokebench.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#![feature(test)]
extern crate test;

#[bench]
fn smoke_yesiter(b: &mut test::Bencher) {
let mut i = 0usize;
b.iter(|| {
i = i.wrapping_add(1);
i
})
}

#[bench]
fn smoke_noiter(_: &mut test::Bencher) {}