Skip to content

Commit

Permalink
[mock_test]: Move mock tests into a separate folder to separate them …
Browse files Browse the repository at this point in the history
…from vs tests (sonic-net#950)

when libsaivs is installed with compile and run the mock tests; otherwise, we will
just run the normal vs tests

Signed-off-by: Shu0T1an ChenG <[email protected]>
  • Loading branch information
stcheng authored Jul 2, 2019
1 parent c24948c commit 5a33f89
Show file tree
Hide file tree
Showing 15 changed files with 61 additions and 41 deletions.
4 changes: 3 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,11 @@ AC_CONFIG_FILES([
teamsyncd/Makefile
swssconfig/Makefile
cfgmgr/Makefile
tests/Makefile
])

# If no SAI library is installed, compile with SAIVS and run unit tests
AM_COND_IF([HAVE_SAI],[],
[AC_CONFIG_FILES([tests/Makefile])])
[AC_CONFIG_FILES([tests/mock_tests/Makefile])])

AC_OUTPUT
2 changes: 1 addition & 1 deletion fpmsyncd/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ else
DBGFLAGS = -g
endif

fpmsyncd_SOURCES = fpmsyncd.cpp fpmlink.cpp routesync.cpp $(top_srcdir)/warmrestart/warmRestartHelper.cpp $(top_srcdir)/warmrestart/warmRestartHelper.h
fpmsyncd_SOURCES = fpmsyncd.cpp fpmlink.cpp routesync.cpp $(top_srcdir)/warmrestart/warmRestartHelper.cpp

fpmsyncd_CFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON)
fpmsyncd_CPPFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON)
Expand Down
42 changes: 3 additions & 39 deletions tests/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
CFLAGS_SAI = -I /usr/include/sai
INCLUDES = -I ../orchagent

bin_PROGRAMS = tests

Expand All @@ -9,47 +8,12 @@ else
DBGFLAGS = -g -DNDEBUG
endif

LDADD_SAI = -lsaimeta -lsaimetadata -lsaivs -lsairedis

CFLAGS_GTEST =
LDADD_GTEST = -L/usr/src/gtest

tests_SOURCES = swssnet_ut.cpp request_parser_ut.cpp aclorch_ut.cpp saispy_ut.cpp \
mock_orchagent_main.cpp \
mock_dbconnector.cpp \
mock_consumerstatetable.cpp \
mock_hiredis.cpp \
mock_redisreply.cpp \
../orchagent/orchdaemon.cpp \
../orchagent/orch.cpp \
../orchagent/notifications.cpp \
../orchagent/routeorch.cpp \
../orchagent/neighorch.cpp \
../orchagent/intfsorch.cpp \
../orchagent/portsorch.cpp \
../orchagent/copporch.cpp \
../orchagent/tunneldecaporch.cpp \
../orchagent/qosorch.cpp \
../orchagent/bufferorch.cpp \
../orchagent/mirrororch.cpp \
../orchagent/fdborch.cpp \
../orchagent/aclorch.cpp \
../orchagent/saihelper.cpp \
../orchagent/switchorch.cpp \
../orchagent/pfcwdorch.cpp \
../orchagent/pfcactionhandler.cpp \
../orchagent/policerorch.cpp \
../orchagent/crmorch.cpp \
../orchagent/request_parser.cpp \
../orchagent/vrforch.cpp \
../orchagent/countercheckorch.cpp \
../orchagent/vxlanorch.cpp \
../orchagent/vnetorch.cpp \
../orchagent/dtelorch.cpp \
../orchagent/flexcounterorch.cpp \
../orchagent/watermarkorch.cpp
tests_SOURCES = swssnet_ut.cpp request_parser_ut.cpp

tests_CFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_GTEST) $(CFLAGS_SAI)
tests_CPPFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_GTEST) $(CFLAGS_SAI)
tests_LDADD = $(LDADD_GTEST) $(LDADD_SAI) -lnl-genl-3 -lhiredis -lhiredis -lpthread \
tests_CPPFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_GTEST) $(CFLAGS_SAI) -I../orchagent
tests_LDADD = $(LDADD_GTEST) -lnl-genl-3 -lhiredis -lhiredis -lpthread \
-lswsscommon -lswsscommon -lgtest -lgtest_main
54 changes: 54 additions & 0 deletions tests/mock_tests/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
CFLAGS_SAI = -I /usr/include/sai

bin_PROGRAMS = tests

LDADD_SAI = -lsaimeta -lsaimetadata -lsaivs -lsairedis

if DEBUG
DBGFLAGS = -ggdb -DDEBUG
else
DBGFLAGS = -g -DNDEBUG
endif

CFLAGS_GTEST =
LDADD_GTEST = -L/usr/src/gtest

tests_SOURCES = swssnet_ut.cpp request_parser_ut.cpp aclorch_ut.cpp saispy_ut.cpp \
mock_orchagent_main.cpp \
mock_dbconnector.cpp \
mock_consumerstatetable.cpp \
mock_hiredis.cpp \
mock_redisreply.cpp \
../orchagent/orchdaemon.cpp \
../orchagent/orch.cpp \
../orchagent/notifications.cpp \
../orchagent/routeorch.cpp \
../orchagent/neighorch.cpp \
../orchagent/intfsorch.cpp \
../orchagent/portsorch.cpp \
../orchagent/copporch.cpp \
../orchagent/tunneldecaporch.cpp \
../orchagent/qosorch.cpp \
../orchagent/bufferorch.cpp \
../orchagent/mirrororch.cpp \
../orchagent/fdborch.cpp \
../orchagent/aclorch.cpp \
../orchagent/saihelper.cpp \
../orchagent/switchorch.cpp \
../orchagent/pfcwdorch.cpp \
../orchagent/pfcactionhandler.cpp \
../orchagent/policerorch.cpp \
../orchagent/crmorch.cpp \
../orchagent/request_parser.cpp \
../orchagent/vrforch.cpp \
../orchagent/countercheckorch.cpp \
../orchagent/vxlanorch.cpp \
../orchagent/vnetorch.cpp \
../orchagent/dtelorch.cpp \
../orchagent/flexcounterorch.cpp \
../orchagent/watermarkorch.cpp

tests_CFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_GTEST) $(CFLAGS_SAI)
tests_CPPFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_GTEST) $(CFLAGS_SAI) -I../orchagent
tests_LDADD = $(LDADD_GTEST) $(LDADD_SAI) -lnl-genl-3 -lhiredis -lhiredis -lpthread \
-lswsscommon -lswsscommon -lgtest -lgtest_main
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 5a33f89

Please sign in to comment.