Skip to content

Commit

Permalink
Enable C++ unit test during build (sonic-net#1092)
Browse files Browse the repository at this point in the history
* Enable test during build
* Exclude `tests` in the deb package
  • Loading branch information
qiluo-msft authored Oct 14, 2019
1 parent 629c9d3 commit 1623219
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 16 deletions.
6 changes: 1 addition & 5 deletions Makefile.am
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
SUBDIRS = fpmsyncd neighsyncd portsyncd orchagent swssconfig cfgmgr
SUBDIRS = fpmsyncd neighsyncd portsyncd orchagent swssconfig cfgmgr tests

if HAVE_LIBTEAM
SUBDIRS += teamsyncd
endif

if GTEST
SUBDIRS += tests
endif
9 changes: 0 additions & 9 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,6 @@ AC_ARG_ENABLE(debug,
esac],[debug=false])
AM_CONDITIONAL(DEBUG, test x$debug = xtrue)

AC_ARG_ENABLE(gtest,
[ --enable-gtest Compile with googletest flags],
[case "${enableval}" in
yes) gtest=true ;;
no) gtest=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-gtest) ;;
esac],[gtest=false])
AM_CONDITIONAL(GTEST, test x$gtest = xtrue)

CFLAGS_COMMON="-std=c++11 -Wall -fPIC -Wno-write-strings -I/usr/include/libnl3 -I/usr/include/swss"

AM_CONDITIONAL(sonic_asic_platform_barefoot, test x$CONFIGURED_PLATFORM = xbarefoot)
Expand Down
6 changes: 4 additions & 2 deletions tests/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
CFLAGS_SAI = -I /usr/include/sai

bin_PROGRAMS = tests
TESTS = tests

noinst_PROGRAMS = tests

if DEBUG
DBGFLAGS = -ggdb -DDEBUG
Expand All @@ -11,7 +13,7 @@ endif
CFLAGS_GTEST =
LDADD_GTEST = -L/usr/src/gtest

tests_SOURCES = swssnet_ut.cpp request_parser_ut.cpp
tests_SOURCES = swssnet_ut.cpp request_parser_ut.cpp ../orchagent/request_parser.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
Expand Down
2 changes: 2 additions & 0 deletions tests/request_parser_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#include "orch.h"
#include "request_parser.h"

using namespace swss;

const request_description_t request_description1 = {
{ REQ_T_STRING },
{
Expand Down

0 comments on commit 1623219

Please sign in to comment.