Skip to content

Commit

Permalink
qa_sources: disable execution speed sensitive checks
Browse files Browse the repository at this point in the history
Disable certain sensitive checks for the processing rate when running
the instrumented build. This is done by introducing an Environment
variable which is used to conditionally skip them:
`DISABLE_SENSITIVE_CHECKS=1 qa_sources`
  • Loading branch information
wirew0rm committed Oct 13, 2023
1 parent a68e8e8 commit 362be06
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ jobs:

- name: execute tests with coverage
if: matrix.configurations.compiler == 'gcc13' && matrix.cmake-build-type == 'Debug'
env:
DISABLE_SENSITIVE_TESTS: 1 # disables tests which are sensitive to execution speed and will not run with instrumented code
working-directory: ${{runner.workspace}}/build
shell: bash
run: cmake --build . --target coverage
Expand Down
12 changes: 8 additions & 4 deletions blocks/basic/test/qa_sources.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,14 @@ const boost::ut::suite TagTests = [] {
expect(eq(src.n_samples_produced, n_samples)) << "src did not produce enough output samples";
expect(eq(static_cast<std::uint32_t>(sink1.n_samples_produced), n_samples)) << fmt::format("sink1 did not consume enough input samples ({} vs. {})", sink1.n_samples_produced, n_samples);
expect(eq(static_cast<std::uint32_t>(sink2.n_samples_produced), n_samples)) << fmt::format("sink2 did not consume enough input samples ({} vs. {})", sink2.n_samples_produced, n_samples);
expect(approx(sink1.effective_sample_rate(), sample_rate, 500.f))
<< fmt::format("sink1: effective sample rate {} vs {} +- {} does not match", sink1.effective_sample_rate(), sample_rate, 500.f);
expect(approx(sink2.effective_sample_rate(), sample_rate, 500.f))
<< fmt::format("sink2: effective sample rate {} vs {} +- {} does not match", sink1.effective_sample_rate(), sample_rate, 500.f);

if (std::getenv("DISABLE_SENSITIVE_TESTS") != nullptr) {
expect(approx(sink1.effective_sample_rate(), sample_rate, 500.f))
<< fmt::format("sink1: effective sample rate {} vs {} +- {} does not match", sink1.effective_sample_rate(), sample_rate, 500.f);
expect(approx(sink2.effective_sample_rate(), sample_rate, 500.f))
<< fmt::format("sink2: effective sample rate {} vs {} +- {} does not match", sink1.effective_sample_rate(), sample_rate, 500.f);
}

fmt::print("sink1 (USE_PROCESS_ONE): effective {} vs. expected {} sample rate [Hz]\n", sink1.effective_sample_rate(), sample_rate);
fmt::print("sink2 (USE_PROCESS_BULK): effective {} vs. expected {} sample rate [Hz]\n", sink2.effective_sample_rate(), sample_rate);

Expand Down

0 comments on commit 362be06

Please sign in to comment.