From 72fcd5b4ba4ce09b39aef9de0fba9980df4f14b7 Mon Sep 17 00:00:00 2001 From: Frank Osterfeld Date: Tue, 16 Jan 2024 22:40:50 +0100 Subject: [PATCH] qa_DataSink: Use multithreaded scheduler for test 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. --- blocks/basic/test/qa_DataSink.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/blocks/basic/test/qa_DataSink.cpp b/blocks/basic/test/qa_DataSink.cpp index bdd21bb6..ebbf92b5 100644 --- a/blocks/basic/test/qa_DataSink.cpp +++ b/blocks/basic/test/qa_DataSink.cpp @@ -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; + const boost::ut::suite DataSinkTests = [] { using namespace boost::ut; using namespace gr; @@ -246,7 +248,7 @@ const boost::ut::suite DataSinkTests = [] { expect(DataSinkRegistry::instance().registerStreamingCallback(DataSinkQuery::sinkName("test_sink"), kChunkSize, callbackWithTags)); expect(DataSinkRegistry::instance().registerStreamingCallback(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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -633,7 +635,7 @@ const boost::ut::suite DataSinkTests = [] { DataSinkRegistry::instance().registerTriggerCallback(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 @@ -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