Skip to content

Commit e51ff47

Browse files
committed
fix and add unittests - draft
1 parent 51db5c1 commit e51ff47

File tree

7 files changed

+28
-10
lines changed

7 files changed

+28
-10
lines changed

lib/ClientSai.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1557,7 +1557,8 @@ sai_status_t ClientSai::dbgGenerateDump(
15571557
SWSS_LOG_ENTER();
15581558
REDIS_CHECK_API_INITIALIZED();
15591559

1560-
const std::vector<swss::FieldValueTuple> entry =
1560+
return SAI_STATUS_NOT_IMPLEMENTED;
1561+
/*const std::vector<swss::FieldValueTuple> entry =
15611562
{
15621563
swss::FieldValueTuple("DBG_GENERATE_DUMP", dump_file_name),
15631564
};
@@ -1567,5 +1568,5 @@ sai_status_t ClientSai::dbgGenerateDump(
15671568
m_communicationChannel->set(key, entry, REDIS_ASIC_STATE_COMMAND_DBG_GEN_DUMP);
15681569
15691570
swss::KeyOpFieldsValuesTuple kco;
1570-
return m_communicationChannel->wait(REDIS_ASIC_STATE_COMMAND_DBG_GEN_DUMPRESPONSE, kco);
1571+
return m_communicationChannel->wait(REDIS_ASIC_STATE_COMMAND_DBG_GEN_DUMPRESPONSE, kco);*/
15711572
}

proxylib/Sai.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1131,7 +1131,7 @@ sai_status_t Sai::dbgGenerateDump(
11311131

11321132
std::string key = "DBG_GEN_DUMP:01";
11331133

1134-
m_communicationChannel->set(key, entry, "dbg_gen_dump");
1134+
m_communicationChannel->set("api", entry, "dbg_gen_dump");
11351135

11361136
/*swss::KeyOpFieldsValuesTuple kco;
11371137

unittest/lib/TestClientSai.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ TEST(ClientSai, dbgGenerateDump)
5656

5757
sai.apiInitialize(0,&test_services);
5858

59-
const std::string filePath = "/var/log/dbgGenerateDump.log";
59+
const std::string filePath = "/var/log/testDump.log";
6060

61-
EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, sai.dbgGenerateDump(filePath.c_str()));
62-
}
61+
EXPECT_EQ(sai.dbgGenerateDump(filePath.c_str()), SAI_STATUS_NOT_IMPLEMENTED);
62+
}

unittest/lib/TestServerSai.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,4 @@ TEST(ServerSai, bulkGet)
4949
SAI_BULK_OP_ERROR_MODE_STOP_ON_ERROR,
5050
statuses));
5151
}
52+

unittest/syncd/TestVendorSai.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1558,3 +1558,10 @@ TEST_F(VendorSaiTest, bulk_prefix_compression_entry)
15581558
EXPECT_EQ(SAI_STATUS_NOT_SUPPORTED,
15591559
m_vsai->bulkSet(0, e, nullptr, SAI_BULK_OP_ERROR_MODE_STOP_ON_ERROR, nullptr));
15601560
}
1561+
1562+
TEST_F(VendorSaiTest, dbgGenerateDump)
1563+
{
1564+
const std::string filePath = "/var/log/testDump.log";
1565+
1566+
EXPECT_EQ(SAI_STATUS_SUCCESS, m_vsai->dbgGenerateDump(filePath.c_str()));
1567+
}

unittest/vslib/TestSai.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,13 @@ TEST(Sai, bulkGet)
2424
attrs,
2525
SAI_BULK_OP_ERROR_MODE_STOP_ON_ERROR,
2626
statuses));
27-
}
27+
}
28+
29+
TEST(Sai, dbgGenerateDump)
30+
{
31+
Sai sai;
32+
33+
const std::string filePath = "/var/log/testDump.log";
34+
35+
EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, sai.dbgGenerateDump(filePath.c_str()));
36+
}

vslib/Sai.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -856,11 +856,11 @@ sai_status_t Sai::queryApiVersion(
856856
sai_status_t Sai::dbgGenerateDump(
857857
_In_ const char *dump_file_name)
858858
{
859-
MUTEX();
860859
SWSS_LOG_ENTER();
861-
VS_CHECK_API_INITIALIZED();
862860

863-
return m_meta->dbgGenerateDump(dump_file_name);
861+
SWSS_LOG_ERROR("not implemented, FIXME");
862+
863+
return SAI_STATUS_NOT_IMPLEMENTED;
864864
}
865865

866866

0 commit comments

Comments
 (0)