tests: Guard test functions exercising testing APIs
Otherwise when the build is configured with `-Dabi=deprecated,stable`
the test binaries will fail to link.
Change-Id: I0f7937a01f38ca12ef6a7c47d72e7c393a03d8f4
Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>
diff --git a/tests/libpldm_firmware_update_test.cpp b/tests/libpldm_firmware_update_test.cpp
index c42381c..76c5814 100644
--- a/tests/libpldm_firmware_update_test.cpp
+++ b/tests/libpldm_firmware_update_test.cpp
@@ -1278,6 +1278,7 @@
outPendingCompVerStr.length));
}
+#ifdef LIBPLDM_API_TESTING
TEST(QueryDownstreamDevices, goodPathEncodeRequest)
{
constexpr uint8_t instanceId = 1;
@@ -1292,7 +1293,9 @@
EXPECT_EQ(requestPtr->hdr.type, PLDM_FWUP);
EXPECT_EQ(requestPtr->hdr.command, PLDM_QUERY_DOWNSTREAM_DEVICES);
}
+#endif
+#ifdef LIBPLDM_API_TESTING
TEST(QueryDownstreamDevices, encodeRequestInvalidData)
{
constexpr uint8_t instanceId = 1;
@@ -1301,7 +1304,9 @@
EXPECT_EQ(rc, PLDM_ERROR_INVALID_DATA);
}
+#endif
+#ifdef LIBPLDM_API_TESTING
TEST(QueryDownstreamDevices, goodPathDecodeResponse)
{
uint8_t completion_code_resp = PLDM_SUCCESS;
@@ -1347,7 +1352,9 @@
max_number_of_downstream_devices_resp);
EXPECT_EQ(resp_data.capabilities.value, capabilities_resp.value);
}
+#endif
+#ifdef LIBPLDM_API_TESTING
TEST(QueryDownstreamDevices, decodeRequestUndefinedValue)
{
uint8_t completion_code_resp = PLDM_SUCCESS;
@@ -1384,7 +1391,9 @@
ASSERT_EQ(rc, PLDM_ERROR_INVALID_DATA);
}
+#endif
+#ifdef LIBPLDM_API_TESTING
TEST(QueryDownstreamDevices, decodeRequestErrorBufSize)
{
uint8_t completion_code_resp = PLDM_SUCCESS;
@@ -1424,7 +1433,9 @@
EXPECT_EQ(rc, PLDM_ERROR_INVALID_LENGTH);
}
+#endif
+#ifdef LIBPLDM_API_TESTING
TEST(QueryDownstreamIdentifiers, goodPathEncodeRequest)
{
constexpr uint8_t instanceId = 1;
@@ -1444,7 +1455,9 @@
expectedReq{0x81, 0x05, 0x04, 0xFF, 0xFF, 0xFF, 0xFF, 0x01};
EXPECT_EQ(requestMsg, expectedReq);
}
+#endif
+#ifdef LIBPLDM_API_TESTING
TEST(QueryDownstreamIdentifiers, encodeRequestInvalidErrorPaths)
{
constexpr uint8_t instanceId = 1;
@@ -1472,7 +1485,9 @@
requestPtr, payload_length);
EXPECT_EQ(rc, PLDM_INVALID_TRANSFER_OPERATION_FLAG);
}
+#endif
+#ifdef LIBPLDM_API_TESTING
TEST(QueryDownstreamIdentifiers, goodPathDecodeResponse)
{
// Len is not fixed here taking it as 9, constains 1 downstream device with
@@ -1533,7 +1548,9 @@
PLDM_QUERY_DOWNSTREAM_IDENTIFIERS_RESP_MIN_LEN,
responseMsg.end()));
}
+#endif
+#ifdef LIBPLDM_API_TESTING
TEST(QueryDownstreamIdentifiers, decodeRequestErrorPaths)
{
std::array<uint8_t, hdrSize + sizeof(uint8_t)> responseMsg{};
@@ -1560,7 +1577,9 @@
EXPECT_EQ(rc, PLDM_ERROR_INVALID_LENGTH);
}
+#endif
+#ifdef LIBPLDM_API_TESTING
TEST(QueryDownstreamIdentifiers, decodeRequestErrorDownstreamDevicesSize)
{
// Len is not fixed here taking it as 9, constains 1 downstream device with
@@ -1622,7 +1641,9 @@
"");
#endif
}
+#endif
+#ifdef LIBPLDM_API_TESTING
TEST(QueryDownstreamIdentifiers, decodeRequestErrorBufSize)
{
constexpr uint32_t actualDownstreamDevicesLen = 0;
@@ -1661,6 +1682,7 @@
EXPECT_EQ(rc, PLDM_ERROR_INVALID_LENGTH);
}
+#endif
TEST(RequestUpdate, goodPathEncodeRequest)
{