Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is nice, does it get applied in the build or test process? if not, how should we enable it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First need install clang-format. Before build process, apply clang-format to committed files (or all files) and save the result into a tmp folder. Then compare committed files and files in tmp folder. If all files are the same, means submitter do clang-format before send PR.

Current I do it locally to make sure every files have the same style, follow aclorch.cpp nearly.
But it shall be another task if we want to enable it in build or test process.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to add enforce the format check on the pr test. can you add clang-format in the sonic-slave-stretch, and add a small script to perform the check. Then, i can run it in the pr test.

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