Add a sent too fast check for simulation and shm
Returns an error if more than queue_size (frequency *
channel_storage_duration) messages were sent in one
channel_storage_duration.
Signed-off-by: Eric Schmiedeberg <eric.schmiedeberg@bluerivertech.com>
Change-Id: Ie41205ba37b66930d8a9082f2d85d7dc3388e3bf
diff --git a/aos/events/event_loop_param_test.h b/aos/events/event_loop_param_test.h
index a9d280e..fad8dea 100644
--- a/aos/events/event_loop_param_test.h
+++ b/aos/events/event_loop_param_test.h
@@ -359,6 +359,12 @@
std::vector<std::reference_wrapper<const Fetcher<TestMessage>>> fetchers,
std::vector<std::reference_wrapper<const Sender<TestMessage>>> senders);
+ // Helper function for testing the sent too fast check using a PhasedLoop with
+ // an interval that sends exactly at the frequency of the channel
+ void TestSentTooFastCheckEdgeCase(
+ const std::function<RawSender::Error(int, int)> expected_err,
+ const bool send_twice_at_end);
+
private:
const ::std::unique_ptr<EventLoopTestFactory> factory_;
@@ -367,6 +373,13 @@
using AbstractEventLoopDeathTest = AbstractEventLoopTest;
+// Returns the frequency of the /test TestMessage channel
+int TestChannelFrequency(EventLoop *event_loop);
+// Returns the queue size of the /test TestMessage channel
+int TestChannelQueueSize(EventLoop *event_loop);
+// Sends a test message with value 0 with the given sender
+RawSender::Error SendTestMessage(aos::Sender<TestMessage> &sender);
+
} // namespace testing
} // namespace aos