Skip to content

Commit

Permalink
[aclorch] unittest by gtest (sonic-net#924)
Browse files Browse the repository at this point in the history
  • Loading branch information
yehjunying authored and lguohan committed Jun 6, 2019
1 parent 8f52eb3 commit 9d69dd5
Show file tree
Hide file tree
Showing 15 changed files with 1,862 additions and 4 deletions.
5 changes: 4 additions & 1 deletion debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,13 @@ include /usr/share/dpkg/default.mk
# -DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH)

override_dh_auto_configure:
dh_auto_configure --
dh_auto_configure -- --enable-gtest

override_dh_auto_install:
dh_auto_install --destdir=debian/swss

override_dh_strip:
dh_strip --dbg-package=swss-dbg

override_dh_auto_test:
./tests/tests
104 changes: 104 additions & 0 deletions tests/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
#Language: Cpp
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Right
#AlignOperands: false
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: false
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterClass: true
AfterControlStatement: true
AfterEnum: true
AfterFunction: true
AfterNamespace: true
AfterObjCDeclaration: true
AfterStruct: true
AfterUnion: true
BeforeCatch: true
BeforeElse: true
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
#BreakBeforeInheritanceComma: false
BreakBeforeTernaryOperators: false
BreakConstructorInitializers: AfterColon
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 0
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: true
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: false
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: false
#ForEachMacros:
# - foreach
# - Q_FOREACH
# - BOOST_FOREACH
#IncludeCategories:
# - Regex: '^"config\.h"'
# Priority: -1
# # The main header for a source file automatically gets category 0
# - Regex: '.*'
# Priority: 1
# - Regex: '^<.*\.h>'
# Priority: 2
#IncludeIsMainRegex: '(Test)?$'
IndentCaseLabels: true
IndentWidth: 4
IndentWrappedFunctionNames: true
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: true
MacroBlockBegin: ''
MacroBlockEnd: ''
#MaxEmptyLinesToKeep: 1
NamespaceIndentation: All
ObjCBlockIndentWidth: 4
ObjCSpaceAfterProperty: true
ObjCSpaceBeforeProtocolList: true
#PenaltyBreakAssignment: 2
#PenaltyBreakBeforeFirstCallParameter: 19
#PenaltyBreakComment: 300
#PenaltyBreakFirstLessLess: 120
#PenaltyBreakString: 1000
#PenaltyExcessCharacter: 1000000
#PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Right
ReflowComments: true
SortIncludes: false
SortUsingDeclarations: false
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
#Standard: Cpp11
TabWidth: 4
UseTab: Never
39 changes: 37 additions & 2 deletions tests/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,47 @@ 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
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)
tests_LDADD = $(LDADD_GTEST) -lnl-genl-3 -lhiredis -lhiredis -lpthread \
tests_LDADD = $(LDADD_GTEST) $(LDADD_SAI) -lnl-genl-3 -lhiredis -lhiredis -lpthread \
-lswsscommon -lswsscommon -lgtest -lgtest_main
Loading

0 comments on commit 9d69dd5

Please sign in to comment.