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_bios_table_test.cpp b/tests/libpldm_bios_table_test.cpp
index 54173b6..95a9310 100644
--- a/tests/libpldm_bios_table_test.cpp
+++ b/tests/libpldm_bios_table_test.cpp
@@ -876,9 +876,15 @@
auto firstEntry =
reinterpret_cast<struct pldm_bios_attr_val_table_entry*>(table.data());
firstEntry->attr_type = PLDM_BIOS_PASSWORD;
+#ifdef NDEBUG
+ EXPECT_EQ(pldm_bios_table_attr_value_find_by_handle(table.data(),
+ table.size(), 1),
+ nullptr);
+#else
EXPECT_DEATH(pldm_bios_table_attr_value_find_by_handle(table.data(),
table.size(), 1),
"entry_length != NULL");
+#endif
}
TEST(AttrValTable, CopyAndUpdateTest)
@@ -1131,7 +1137,9 @@
auto iter = pldm_bios_table_iter_create(table.data(), table.size(),
PLDM_BIOS_ATTR_TABLE);
attr_entry->attr_type = PLDM_BIOS_PASSWORD;
+#ifndef NDEBUG
EXPECT_DEATH(pldm_bios_table_iter_next(iter), "attr_table_entry != NULL");
+#endif
pldm_bios_table_iter_free(iter);
}