Skip to content

Commit 5a33f89

Browse files
authored
[mock_test]: Move mock tests into a separate folder to separate them from vs tests (#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]>
1 parent c24948c commit 5a33f89

15 files changed

+61
-41
lines changed

configure.ac

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,11 @@ AC_CONFIG_FILES([
9696
teamsyncd/Makefile
9797
swssconfig/Makefile
9898
cfgmgr/Makefile
99+
tests/Makefile
99100
])
100101

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

104106
AC_OUTPUT

fpmsyncd/Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ else
88
DBGFLAGS = -g
99
endif
1010

11-
fpmsyncd_SOURCES = fpmsyncd.cpp fpmlink.cpp routesync.cpp $(top_srcdir)/warmrestart/warmRestartHelper.cpp $(top_srcdir)/warmrestart/warmRestartHelper.h
11+
fpmsyncd_SOURCES = fpmsyncd.cpp fpmlink.cpp routesync.cpp $(top_srcdir)/warmrestart/warmRestartHelper.cpp
1212

1313
fpmsyncd_CFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON)
1414
fpmsyncd_CPPFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON)

tests/Makefile.am

Lines changed: 3 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
CFLAGS_SAI = -I /usr/include/sai
2-
INCLUDES = -I ../orchagent
32

43
bin_PROGRAMS = tests
54

@@ -9,47 +8,12 @@ else
98
DBGFLAGS = -g -DNDEBUG
109
endif
1110

12-
LDADD_SAI = -lsaimeta -lsaimetadata -lsaivs -lsairedis
13-
1411
CFLAGS_GTEST =
1512
LDADD_GTEST = -L/usr/src/gtest
1613

17-
tests_SOURCES = swssnet_ut.cpp request_parser_ut.cpp aclorch_ut.cpp saispy_ut.cpp \
18-
mock_orchagent_main.cpp \
19-
mock_dbconnector.cpp \
20-
mock_consumerstatetable.cpp \
21-
mock_hiredis.cpp \
22-
mock_redisreply.cpp \
23-
../orchagent/orchdaemon.cpp \
24-
../orchagent/orch.cpp \
25-
../orchagent/notifications.cpp \
26-
../orchagent/routeorch.cpp \
27-
../orchagent/neighorch.cpp \
28-
../orchagent/intfsorch.cpp \
29-
../orchagent/portsorch.cpp \
30-
../orchagent/copporch.cpp \
31-
../orchagent/tunneldecaporch.cpp \
32-
../orchagent/qosorch.cpp \
33-
../orchagent/bufferorch.cpp \
34-
../orchagent/mirrororch.cpp \
35-
../orchagent/fdborch.cpp \
36-
../orchagent/aclorch.cpp \
37-
../orchagent/saihelper.cpp \
38-
../orchagent/switchorch.cpp \
39-
../orchagent/pfcwdorch.cpp \
40-
../orchagent/pfcactionhandler.cpp \
41-
../orchagent/policerorch.cpp \
42-
../orchagent/crmorch.cpp \
43-
../orchagent/request_parser.cpp \
44-
../orchagent/vrforch.cpp \
45-
../orchagent/countercheckorch.cpp \
46-
../orchagent/vxlanorch.cpp \
47-
../orchagent/vnetorch.cpp \
48-
../orchagent/dtelorch.cpp \
49-
../orchagent/flexcounterorch.cpp \
50-
../orchagent/watermarkorch.cpp
14+
tests_SOURCES = swssnet_ut.cpp request_parser_ut.cpp
5115

5216
tests_CFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_GTEST) $(CFLAGS_SAI)
53-
tests_CPPFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_GTEST) $(CFLAGS_SAI)
54-
tests_LDADD = $(LDADD_GTEST) $(LDADD_SAI) -lnl-genl-3 -lhiredis -lhiredis -lpthread \
17+
tests_CPPFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_GTEST) $(CFLAGS_SAI) -I../orchagent
18+
tests_LDADD = $(LDADD_GTEST) -lnl-genl-3 -lhiredis -lhiredis -lpthread \
5519
-lswsscommon -lswsscommon -lgtest -lgtest_main

tests/mock_tests/Makefile.am

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
CFLAGS_SAI = -I /usr/include/sai
2+
3+
bin_PROGRAMS = tests
4+
5+
LDADD_SAI = -lsaimeta -lsaimetadata -lsaivs -lsairedis
6+
7+
if DEBUG
8+
DBGFLAGS = -ggdb -DDEBUG
9+
else
10+
DBGFLAGS = -g -DNDEBUG
11+
endif
12+
13+
CFLAGS_GTEST =
14+
LDADD_GTEST = -L/usr/src/gtest
15+
16+
tests_SOURCES = swssnet_ut.cpp request_parser_ut.cpp aclorch_ut.cpp saispy_ut.cpp \
17+
mock_orchagent_main.cpp \
18+
mock_dbconnector.cpp \
19+
mock_consumerstatetable.cpp \
20+
mock_hiredis.cpp \
21+
mock_redisreply.cpp \
22+
../orchagent/orchdaemon.cpp \
23+
../orchagent/orch.cpp \
24+
../orchagent/notifications.cpp \
25+
../orchagent/routeorch.cpp \
26+
../orchagent/neighorch.cpp \
27+
../orchagent/intfsorch.cpp \
28+
../orchagent/portsorch.cpp \
29+
../orchagent/copporch.cpp \
30+
../orchagent/tunneldecaporch.cpp \
31+
../orchagent/qosorch.cpp \
32+
../orchagent/bufferorch.cpp \
33+
../orchagent/mirrororch.cpp \
34+
../orchagent/fdborch.cpp \
35+
../orchagent/aclorch.cpp \
36+
../orchagent/saihelper.cpp \
37+
../orchagent/switchorch.cpp \
38+
../orchagent/pfcwdorch.cpp \
39+
../orchagent/pfcactionhandler.cpp \
40+
../orchagent/policerorch.cpp \
41+
../orchagent/crmorch.cpp \
42+
../orchagent/request_parser.cpp \
43+
../orchagent/vrforch.cpp \
44+
../orchagent/countercheckorch.cpp \
45+
../orchagent/vxlanorch.cpp \
46+
../orchagent/vnetorch.cpp \
47+
../orchagent/dtelorch.cpp \
48+
../orchagent/flexcounterorch.cpp \
49+
../orchagent/watermarkorch.cpp
50+
51+
tests_CFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_GTEST) $(CFLAGS_SAI)
52+
tests_CPPFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_GTEST) $(CFLAGS_SAI) -I../orchagent
53+
tests_LDADD = $(LDADD_GTEST) $(LDADD_SAI) -lnl-genl-3 -lhiredis -lhiredis -lpthread \
54+
-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.

0 commit comments

Comments
 (0)