cppcheck : Add googletest library while running cppcheck
- cppcheck shows a syntaxerror while parsing TEST & TEST_F
macros in the repo's test files, as cppcheck cannot understand
how a TEST or a TEST_F works.
Example:
When repo specific CI is run on phosphor-networkd, it throws following
errors:
test/test_ethernet_interface.cpp:108:1: error: syntax error [syntaxError]
TEST_F(TestEthernetInterface, NoIPaddress)
^
test/test_neighbor.cpp:35:1: error: syntax error [syntaxError]
TEST(ParseNeighbor, SmallMsg)
^
- This commit would load googletest.cfg that contains information
about google test types and functions. With such information
Cppcheck understands the code better and therefore get better
results.
TestedBy:
- Had run docker CI against the networkd, and the above mentioned errors
are gone.
Signed-off-by: Manojkiran Eda <manojkiran.eda@gmail.com>
Change-Id: If72edd4e734fb201e8a2a937fdfe8bc62dfb5f4b
diff --git a/scripts/unit-test.py b/scripts/unit-test.py
index 3d12fe5..d6662c1 100755
--- a/scripts/unit-test.py
+++ b/scripts/unit-test.py
@@ -375,7 +375,7 @@
# http://cppcheck.sourceforge.net/manual.pdf
params = ['cppcheck', '-j', str(multiprocessing.cpu_count()),
- '--enable=all', '--file-list=-']
+ '--enable=all', '--library=googletest', '--file-list=-']
cppcheck_process = subprocess.Popen(
params,