Skip to content

Commit 262420d

Browse files
Update UT coverage
1 parent 1a77240 commit 262420d

File tree

2 files changed

+61
-1
lines changed

2 files changed

+61
-1
lines changed

unittest/syncd/Makefile.am

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ tests_SOURCES = main.cpp \
1111
TestCommandLineOptions.cpp \
1212
TestFlexCounter.cpp \
1313
TestVirtualOidTranslator.cpp \
14-
TestNotificationQueue.cpp
14+
TestNotificationQueue.cpp \
15+
TestVendorSai.cpp
1516

1617
tests_CXXFLAGS = $(DBGFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS_COMMON)
1718
tests_LDADD = $(LDADD_GTEST) $(top_srcdir)/syncd/libSyncd.a $(top_srcdir)/vslib/libSaiVS.a -lhiredis -lswsscommon -lnl-genl-3 -lnl-nf-3 -lnl-route-3 -lnl-3 -lpthread -L$(top_srcdir)/lib/.libs -lsairedis -L$(top_srcdir)/meta/.libs -lsaimetadata -lsaimeta -lzmq $(CODE_COVERAGE_LIBS)

unittest/syncd/TestVendorSai.cpp

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#include <gtest/gtest.h>
2+
#include "VendorSai.h"
3+
#include "swss/logger.h"
4+
5+
#ifdef HAVE_SAI_BULK_OBJECT_GET_STATS
6+
#undef HAVE_SAI_BULK_OBJECT_GET_STATS
7+
#endif
8+
9+
using namespace syncd;
10+
11+
static const char* profile_get_value(
12+
_In_ sai_switch_profile_id_t profile_id,
13+
_In_ const char* variable)
14+
{
15+
SWSS_LOG_ENTER();
16+
17+
if (variable == NULL)
18+
return NULL;
19+
20+
return nullptr;
21+
}
22+
23+
static int profile_get_next_value(
24+
_In_ sai_switch_profile_id_t profile_id,
25+
_Out_ const char** variable,
26+
_Out_ const char** value)
27+
{
28+
SWSS_LOG_ENTER();
29+
30+
return 0;
31+
}
32+
33+
static sai_service_method_table_t test_services = {
34+
profile_get_value,
35+
profile_get_next_value
36+
};
37+
38+
TEST(VendorSai, bulkGetStats)
39+
{
40+
VendorSai sai;
41+
sai.initialize(0, &test_services);
42+
ASSERT_EQ(SAI_STATUS_NOT_IMPLEMENTED, sai.bulkGetStats(SAI_NULL_OBJECT_ID,
43+
SAI_OBJECT_TYPE_PORT,
44+
0,
45+
nullptr,
46+
0,
47+
nullptr,
48+
SAI_STATS_MODE_BULK_READ_AND_CLEAR,
49+
nullptr,
50+
nullptr));
51+
ASSERT_EQ(SAI_STATUS_NOT_IMPLEMENTED, sai.bulkClearStats(SAI_NULL_OBJECT_ID,
52+
SAI_OBJECT_TYPE_PORT,
53+
0,
54+
nullptr,
55+
0,
56+
nullptr,
57+
SAI_STATS_MODE_BULK_READ_AND_CLEAR,
58+
nullptr));
59+
}

0 commit comments

Comments
 (0)