tests: Adjust expectations in accordance with -DNDEBUG
If assertions are disabled then `EXPECT_DEATH()` will fail. Guard
`EXPECT_DEATH()` calls with an NDEBUG test, and substitute an
appropriate test when it's defined.
Change-Id: I60541762aceb656c2eff03a438f314197b281f77
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 493da65..c42381c 100644
--- a/tests/libpldm_firmware_update_test.cpp
+++ b/tests/libpldm_firmware_update_test.cpp
@@ -1608,12 +1608,19 @@
* The 1st parameter is the function under test.
* The 2nd parameter compares the output of the program.
*/
- ASSERT_DEATH(
+#ifdef NDEBUG
+ EXPECT_NE(decode_query_downstream_identifiers_resp(
+ response, responseMsg.size() - hdrSize, &resp_data,
+ &downstreamDevices),
+ PLDM_SUCCESS);
+#else
+ EXPECT_DEATH(
decode_query_downstream_identifiers_resp(
response, responseMsg.size() - hdrSize, &resp_data,
&downstreamDevices),
// This error doesn't output any error message, leave it be empty
"");
+#endif
}
TEST(QueryDownstreamIdentifiers, decodeRequestErrorBufSize)