Skip to content

Commit

Permalink
qa_DataSink: Use multithreaded scheduler for test
Browse files Browse the repository at this point in the history
It seems the issues with tag handling in multithreaded schedulers
(issue #217) have been fixed, so let's up the game by using multi-
threaded schedulers for qa_DataSink.
  • Loading branch information
frankosterfeld authored and RalphSteinhagen committed Jan 17, 2024
1 parent ae6928d commit 72fcd5b
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions blocks/basic/test/qa_DataSink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ indexesMatch(const T &lhs, const U &rhs) {
return std::equal(std::begin(lhs), std::end(lhs), std::begin(rhs), std::end(rhs), index_match);
}

using Scheduler = gr::scheduler::Simple<gr::scheduler::multiThreaded>;

const boost::ut::suite DataSinkTests = [] {
using namespace boost::ut;
using namespace gr;
Expand Down Expand Up @@ -246,7 +248,7 @@ const boost::ut::suite DataSinkTests = [] {
expect(DataSinkRegistry::instance().registerStreamingCallback<float>(DataSinkQuery::sinkName("test_sink"), kChunkSize, callbackWithTags));
expect(DataSinkRegistry::instance().registerStreamingCallback<float>(DataSinkQuery::sinkName("test_sink"), kChunkSize, callbackWithTagsAndSink));

gr::scheduler::Simple sched{ std::move(testGraph) };
Scheduler sched{ std::move(testGraph) };
sched.runAndWait();

sink.stop(); // TODO the scheduler should call this
Expand Down Expand Up @@ -309,7 +311,7 @@ const boost::ut::suite DataSinkTests = [] {
});

{
gr::scheduler::Simple sched{ std::move(testGraph) };
Scheduler sched{ std::move(testGraph) };
sched.runAndWait();

sink.stop(); // TODO the scheduler should call this
Expand Down Expand Up @@ -383,7 +385,7 @@ const boost::ut::suite DataSinkTests = [] {
return std::make_tuple(receivedData, receivedTags);
});

gr::scheduler::Simple sched{ std::move(testGraph) };
Scheduler sched{ std::move(testGraph) };
sched.runAndWait();

sink.stop(); // TODO the scheduler should call this
Expand Down Expand Up @@ -456,7 +458,7 @@ const boost::ut::suite DataSinkTests = [] {
return receivedData;
});

gr::scheduler::Simple sched{ std::move(testGraph) };
Scheduler sched{ std::move(testGraph) };
sched.runAndWait();

sink.stop(); // TODO the scheduler should call this
Expand Down Expand Up @@ -538,7 +540,7 @@ const boost::ut::suite DataSinkTests = [] {
results.push_back(std::move(f));
}

gr::scheduler::Simple sched{ std::move(testGraph) };
Scheduler sched{ std::move(testGraph) };
sched.runAndWait();

sink.stop(); // TODO the scheduler should call this
Expand Down Expand Up @@ -591,7 +593,7 @@ const boost::ut::suite DataSinkTests = [] {
return std::make_tuple(receivedData, receivedTags);
});

gr::scheduler::Simple sched{ std::move(testGraph) };
Scheduler sched{ std::move(testGraph) };
sched.runAndWait();

sink.stop(); // TODO the scheduler should call this
Expand Down Expand Up @@ -633,7 +635,7 @@ const boost::ut::suite DataSinkTests = [] {

DataSinkRegistry::instance().registerTriggerCallback<float>(DataSinkQuery::sinkName("test_sink"), isTrigger, 3000, 2000, callback);

gr::scheduler::Simple sched{ std::move(testGraph) };
Scheduler sched{ std::move(testGraph) };
sched.runAndWait();

sink.stop(); // TODO the scheduler should call this
Expand Down Expand Up @@ -675,7 +677,7 @@ const boost::ut::suite DataSinkTests = [] {
return samplesSeen;
});

gr::scheduler::Simple sched{ std::move(testGraph) };
Scheduler sched{ std::move(testGraph) };
sched.runAndWait();

sink.stop(); // TODO the scheduler should call this
Expand Down

0 comments on commit 72fcd5b

Please sign in to comment.