Skip to content

Commit

Permalink
fix and add unittests - draft
Browse files Browse the repository at this point in the history
  • Loading branch information
aviramd committed Dec 3, 2024
1 parent 51db5c1 commit e3c934a
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 16 deletions.
4 changes: 2 additions & 2 deletions proxylib/Sai.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1129,11 +1129,11 @@ sai_status_t Sai::dbgGenerateDump(
swss::FieldValueTuple("DBG_GENERATE_DUMP", dump_file_name),
};

std::string key = "DBG_GEN_DUMP:01";
/*std::string key = "DBG_GEN_DUMP:01";
m_communicationChannel->set(key, entry, "dbg_gen_dump");
/*swss::KeyOpFieldsValuesTuple kco;
swss::KeyOpFieldsValuesTuple kco;
return m_communicationChannel->wait("dbg_gen_dumpresponse", kco);*/

Expand Down
10 changes: 0 additions & 10 deletions unittest/lib/TestClientSai.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,3 @@ TEST(ClientSai, bulkGet)
statuses));
}

TEST(ClientSai, dbgGenerateDump)
{
ClientSai sai;

sai.apiInitialize(0,&test_services);

const std::string filePath = "/var/log/dbgGenerateDump.log";

EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, sai.dbgGenerateDump(filePath.c_str()));
}
1 change: 1 addition & 0 deletions unittest/lib/TestServerSai.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,4 @@ TEST(ServerSai, bulkGet)
SAI_BULK_OP_ERROR_MODE_STOP_ON_ERROR,
statuses));
}

11 changes: 11 additions & 0 deletions unittest/syncd/TestVendorSai.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1558,3 +1558,14 @@ TEST_F(VendorSaiTest, bulk_prefix_compression_entry)
EXPECT_EQ(SAI_STATUS_NOT_SUPPORTED,
m_vsai->bulkSet(0, e, nullptr, SAI_BULK_OP_ERROR_MODE_STOP_ON_ERROR, nullptr));
}

TEST(VendorSaiTest, queryApiVersion)
{
VendorSai sai;

sai_api_version_t version;

sai.apiInitialize(0,&test_services);

EXPECT_EQ(sai.queryApiVersion(&version), SAI_STATUS_SUCCESS);
}
11 changes: 10 additions & 1 deletion unittest/vslib/TestSai.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,13 @@ TEST(Sai, bulkGet)
attrs,
SAI_BULK_OP_ERROR_MODE_STOP_ON_ERROR,
statuses));
}
}

TEST(Sai, dbgGenerateDump)
{
Sai sai;

const std::string filePath = "/var/log/testDump.log";

EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, sai.dbgGenerateDump(filePath.c_str()));
}
6 changes: 3 additions & 3 deletions vslib/Sai.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -856,11 +856,11 @@ sai_status_t Sai::queryApiVersion(
sai_status_t Sai::dbgGenerateDump(
_In_ const char *dump_file_name)
{
MUTEX();
SWSS_LOG_ENTER();
VS_CHECK_API_INITIALIZED();

return m_meta->dbgGenerateDump(dump_file_name);
SWSS_LOG_ERROR("not implemented, FIXME");

return SAI_STATUS_NOT_IMPLEMENTED;
}


Expand Down

0 comments on commit e3c934a

Please sign in to comment.