Skip to content

Commit

Permalink
Makes LocalTrackIf compile under gtest. (#727)
Browse files Browse the repository at this point in the history
  • Loading branch information
balazsracz committed Aug 19, 2023
1 parent 53f3ab7 commit 6a1b281
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/dcc/LocalTrackIf.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
#else
#include "can_ioctl.h"
#endif

#endif // OPENMRN_FEATURE_FD_CAN_DEVICE

#include "dcc/LocalTrackIf.hxx"

namespace dcc
Expand All @@ -58,18 +61,22 @@ LocalTrackIf::LocalTrackIf(Service *service, int pool_size)
{
}

#if defined(OPENMRN_FEATURE_FD_CAN_DEVICE) || defined(GTEST)
StateFlowBase::Action LocalTrackIf::entry()
{
HASSERT(fd_ >= 0);
auto *p = message()->data();
int ret = write(fd_, p, sizeof(*p));
if (ret < 0) {
HASSERT(errno == ENOSPC);
#ifndef GTEST
::ioctl(fd_, CAN_IOC_WRITE_ACTIVE, this);
#endif
return wait();
}
return finish();
}
#endif

StateFlowBase::Action LocalTrackIfSelect::entry() {
HASSERT(fd_ >= 0);
Expand All @@ -79,4 +86,3 @@ StateFlowBase::Action LocalTrackIfSelect::entry() {

} // namespace dcc

#endif // OPENMRN_FEATURE_FD_CAN_DEVICE

0 comments on commit 6a1b281

Please sign in to comment.