Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ jobs:
libboost-regex1.71-dev \
googletest \
libgtest-dev \
libgmock-dev \
libgcc-8-dev \
libhiredis0.14 \
libhiredis-dev \
Expand Down
4 changes: 2 additions & 2 deletions objects.mk
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ LIBS := \
-lnl-route-3

LIBS_TEST := \
-lgtest_main \
-lgtest
-lgtest \
-lgmock
5 changes: 0 additions & 5 deletions test/FakeMuxPort.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,6 @@ FakeMuxPort::FakeMuxPort(
std::make_shared<FakeLinkProber> (mActiveStandbyStateMachinePtr->getLinkProberStateMachinePtr().get())
)
{
std::string prog_name = "linkmgrd-test";
std::string log_filename = "/tmp/" + prog_name + ".log";
bool extraLogFile = true;
common::MuxLogger::getInstance()->initialize(prog_name, log_filename, boost::log::trivial::debug, extraLogFile);
common::MuxLogger::getInstance()->setLevel(boost::log::trivial::trace);
mMuxPortConfig.setMode(common::MuxPortConfig::Mode::Auto);
getActiveStandbyStateMachinePtr()->setInitializeProberFnPtr(
boost::bind(&FakeLinkProber::initialize, mFakeLinkProber.get())
Expand Down
20 changes: 20 additions & 0 deletions test/LinkMgrdTestMain.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include "gmock/gmock.h"
#include "gtest/gtest.h"

#include "common/MuxLogger.h"

void initLogger()
{
std::string prog_name = "linkmgrd-test";
std::string log_filename = "/tmp/" + prog_name + ".log";
bool extraLogFile = true;
common::MuxLogger::getInstance()->initialize(prog_name, log_filename, boost::log::trivial::debug, extraLogFile);
common::MuxLogger::getInstance()->setLevel(boost::log::trivial::trace);
}

int main(int argc, char** argv)
{
initLogger();
::testing::InitGoogleMock(&argc, argv);
return RUN_ALL_TESTS();
}
9 changes: 6 additions & 3 deletions test/subdir.mk
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,26 @@ CPP_SRCS += \
./test/FakeMuxPort.cpp \
./test/LinkManagerStateMachineTest.cpp \
./test/LinkProberTest.cpp \
./test/MuxManagerTest.cpp
./test/MuxManagerTest.cpp \
./test/LinkMgrdTestMain.cpp

OBJS_LINKMGRD_TEST += \
./test/FakeDbInterface.o \
./test/FakeLinkProber.o \
./test/FakeMuxPort.o \
./test/LinkManagerStateMachineTest.o \
./test/LinkProberTest.o \
./test/MuxManagerTest.o
./test/MuxManagerTest.o \
./test/LinkMgrdTestMain.o

CPP_DEPS += \
./test/FakeDbInterface.d \
./test/FakeLinkProber.d \
./test/FakeMuxPort.d \
./test/LinkManagerStateMachineTest.d \
./test/LinkProberTest.d \
./test/MuxManagerTest.d
./test/MuxManagerTest.d \
./test/LinkMgrdTestMain.d

# Each subdirectory must supply rules for building sources it contributes
test/%.o: test/%.cpp
Expand Down