Skip to content

Commit

Permalink
Skeleton for portsyncd ut added
Browse files Browse the repository at this point in the history
Signed-off-by: Vivek Reddy Karri <vkarri@nvidia.com>
  • Loading branch information
vivekrnv committed Apr 27, 2022
1 parent 1c6cd64 commit 7395544
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 6 deletions.
32 changes: 26 additions & 6 deletions tests/mock_tests/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@ FLEX_CTR_DIR = $(top_srcdir)/orchagent/flex_counter
DEBUG_CTR_DIR = $(top_srcdir)/orchagent/debug_counter
P4_ORCH_DIR = $(top_srcdir)/orchagent/p4orch

INCLUDES = -I $(FLEX_CTR_DIR) -I $(DEBUG_CTR_DIR) -I $(top_srcdir)/lib

CFLAGS_SAI = -I /usr/include/sai

TESTS = tests
TESTS = tests tests_portsyncd

noinst_PROGRAMS = tests
noinst_PROGRAMS = tests tests_portsyncd

LDADD_SAI = -lsaimeta -lsaimetadata -lsaivs -lsairedis

Expand All @@ -21,6 +19,10 @@ endif
CFLAGS_GTEST =
LDADD_GTEST = -L/usr/src/gtest

## Orchagent Unit Tests

tests_INCLUDES = -I $(FLEX_CTR_DIR) -I $(DEBUG_CTR_DIR) -I $(top_srcdir)/lib -I$(top_srcdir)/orchagent

tests_SOURCES = aclorch_ut.cpp \
portsorch_ut.cpp \
routeorch_ut.cpp \
Expand All @@ -32,6 +34,7 @@ tests_SOURCES = aclorch_ut.cpp \
mock_orchagent_main.cpp \
mock_dbconnector.cpp \
mock_consumerstatetable.cpp \
common/mock_shell_command.cpp \
mock_table.cpp \
mock_hiredis.cpp \
mock_redisreply.cpp \
Expand Down Expand Up @@ -109,7 +112,24 @@ tests_SOURCES += $(P4_ORCH_DIR)/p4orch.cpp \
$(P4_ORCH_DIR)/wcmp_manager.cpp \
$(P4_ORCH_DIR)/mirror_session_manager.cpp

tests_CFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_GTEST) $(CFLAGS_SAI)
tests_CPPFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_GTEST) $(CFLAGS_SAI) -I$(top_srcdir)/orchagent
tests_CFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_GTEST) $(CFLAGS_SAI)
tests_CPPFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_GTEST) $(CFLAGS_SAI) $(tests_INCLUDES)
tests_LDADD = $(LDADD_GTEST) $(LDADD_SAI) -lnl-genl-3 -lhiredis -lhiredis -lpthread \
-lswsscommon -lswsscommon -lgtest -lgtest_main -lzmq -lnl-3 -lnl-route-3

## portsyncd unit tests

tests_portsyncd_INCLUDES = -I $(top_srcdir)/portsyncd -I $(top_srcdir)/cfgmgr

tests_portsyncd_SOURCES = portsyncd/portsyncd_ut.cpp \
$(top_srcdir)/portsyncd/linksync.cpp \
mock_dbconnector.cpp \
common/mock_shell_command.cpp \
mock_table.cpp \
mock_hiredis.cpp \
mock_redisreply.cpp

tests_portsyncd_CFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_GTEST) -Wl,-wrap,if_nameindex
tests_portsyncd_CPPFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_GTEST) $(tests_portsyncd_INCLUDES)
tests_portsyncd_LDADD = $(LDADD_GTEST) -lnl-genl-3 -lhiredis -lhiredis -lpthread \
-lswsscommon -lswsscommon -lgtest -lgtest_main -lnl-3 -lnl-route-3
10 changes: 10 additions & 0 deletions tests/mock_tests/portsyncd/portsyncd_ut.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include "gtest/gtest.h"
#include "../mock_table.h"
#define private public
#include "linksync.h"
#undef private

TEST(LinkSyncInitialization, test_initialization)
{
ASSERT_EQ(0, 0);
}

0 comments on commit 7395544

Please sign in to comment.