From 6c5649bd4b966f326a41b4034220ddaca7276f57 Mon Sep 17 00:00:00 2001
From: Nicolas Pope <nwpope@utu.fi>
Date: Tue, 11 Aug 2020 22:15:48 +0300
Subject: [PATCH] WIP More changes to unit tests

---
 components/streams/test/recsend_unit.cpp | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/components/streams/test/recsend_unit.cpp b/components/streams/test/recsend_unit.cpp
index 10bd7dd46..a73ef6a0a 100644
--- a/components/streams/test/recsend_unit.cpp
+++ b/components/streams/test/recsend_unit.cpp
@@ -210,11 +210,13 @@ TEST_CASE( "Multi-thread stability testing" ) {
 		auto h = receiver->onFrameSet([&count,&result](const ftl::data::FrameSetPtr &fs) {
 			LOG(INFO) << "FS RECV: " << fs->timestamp();
 			count++;
-			if (result) REQUIRE( result->timestamp() <= fs->timestamp()-20 );
-			REQUIRE( fs->frames.size() == 2 );
-			REQUIRE( fs->isComplete() );
-			REQUIRE( fs->frames[0].hasChannel(Channel::Colour) );
-			REQUIRE( fs->frames[1].hasChannel(Channel::Colour) );
+			if (result) {
+				REQUIRE( result->timestamp() <= fs->timestamp()-20 );
+				REQUIRE( fs->frames.size() == 2 );
+				REQUIRE( fs->isComplete() );
+				REQUIRE( fs->frames[0].hasChannel(Channel::Colour) );
+				REQUIRE( fs->frames[1].hasChannel(Channel::Colour) );
+			}
 			result = fs;
 			return true;
 		});
@@ -269,6 +271,8 @@ TEST_CASE( "Multi-thread stability testing" ) {
 
 	ftl::timer::reset();
 	ftl::timer::setInterval(50);
+	ftl::pool.clear_queue();
+	while (ftl::pool.n_idle() != ftl::pool.size()) std::this_thread::sleep_for(std::chrono::milliseconds(10));
 
 	delete receiver;
 	delete sender;
-- 
GitLab