From bc00899e7080d5cc7f5e25c4d4c6d41482b33005 Mon Sep 17 00:00:00 2001 From: Pavel Kirienko Date: Wed, 13 May 2015 17:50:45 +0300 Subject: [PATCH] Testing tooling fix --- libuavcan/test/node/test_node.hpp | 5 +++++ libuavcan/test/protocol/helpers.hpp | 9 +++------ libuavcan/test/transport/can/can.hpp | 8 ++++++++ 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/libuavcan/test/node/test_node.hpp b/libuavcan/test/node/test_node.hpp index c8b2055834..5aaa60288d 100644 --- a/libuavcan/test/node/test_node.hpp +++ b/libuavcan/test/node/test_node.hpp @@ -122,6 +122,11 @@ struct PairableCanDriver : public uavcan::ICanDriver, public uavcan::ICanIface return 1; } + void pushRxToAllIfaces(const uavcan::CanFrame& can_frame) + { + read_queue.push(can_frame); + } + virtual uavcan::int16_t configureFilters(const uavcan::CanFilterConfig*, uavcan::uint16_t) { return -1; } virtual uavcan::uint16_t getNumFilters() const { return 0; } virtual uavcan::uint64_t getErrorCount() const { return error_count; } diff --git a/libuavcan/test/protocol/helpers.hpp b/libuavcan/test/protocol/helpers.hpp index 171fb66871..e0fb164f2f 100644 --- a/libuavcan/test/protocol/helpers.hpp +++ b/libuavcan/test/protocol/helpers.hpp @@ -104,8 +104,8 @@ struct BackgroundSpinner : uavcan::TimerBase } }; -template -static inline void emulateSingleFrameBroadcastTransfer(CanDriverMock& can, uavcan::NodeID node_id, +template +static inline void emulateSingleFrameBroadcastTransfer(CanDriver& can, uavcan::NodeID node_id, const MessageType& message, uavcan::TransferID tid) { uavcan::StaticTransferBuffer<100> buffer; @@ -126,8 +126,5 @@ static inline void emulateSingleFrameBroadcastTransfer(CanDriverMock& can, uavca uavcan::CanFrame can_frame; ASSERT_TRUE(frame.compile(can_frame)); - for (uint8_t i = 0; i < can.getNumIfaces(); i++) - { - can.ifaces.at(i).pushRx(can_frame); - } + can.pushRxToAllIfaces(can_frame); } diff --git a/libuavcan/test/transport/can/can.hpp b/libuavcan/test/transport/can/can.hpp index 6557d16533..00a038df9e 100644 --- a/libuavcan/test/transport/can/can.hpp +++ b/libuavcan/test/transport/can/can.hpp @@ -169,6 +169,14 @@ public: , select_failure(false) { } + void pushRxToAllIfaces(const uavcan::CanFrame& can_frame) + { + for (uint8_t i = 0; i < getNumIfaces(); i++) + { + ifaces.at(i).pushRx(can_frame); + } + } + virtual uavcan::int16_t select(uavcan::CanSelectMasks& inout_masks, uavcan::MonotonicTime deadline) { assert(this);