summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorWilliam A. Kennington III <wak@google.com>2019-04-24 01:53:52 -0700
committerWilliam A. Kennington III <wak@google.com>2019-04-29 12:06:35 -0700
commitf2fd17a41bf7e3afd4d69adf5f8ea5642bdfffcf (patch)
tree3838a8099d55f05dc10cea8bfbb31e70b2cf14bf /test
parent51694c22130d4f6160f63167a547d0a40763ef31 (diff)
downloadphosphor-host-ipmid-f2fd17a41bf7e3afd4d69adf5f8ea5642bdfffcf.tar.gz
phosphor-host-ipmid-f2fd17a41bf7e3afd4d69adf5f8ea5642bdfffcf.zip
message/payload: Ignore unchecked unpack warning during unwind
If we are caught in an exception unwind we don't care that the payload is not be fully checked. Otherwise, this encourages the pattern of wrapping all handler code in try catch blocks that set trailingOk as it is not required to read the entire payload when throwing an exception. Change-Id: I35149eedd33bd9fd41968e89d5a8614df7436872 Signed-off-by: William A. Kennington III <wak@google.com>
Diffstat (limited to 'test')
-rw-r--r--test/message/payload.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/message/payload.cpp b/test/message/payload.cpp
index 431a34b..56d8d41 100644
--- a/test/message/payload.cpp
+++ b/test/message/payload.cpp
@@ -19,6 +19,7 @@
#include <ipmid/api.hpp>
#include <ipmid/message.hpp>
+#include <stdexcept>
#include <gtest/gtest.h>
@@ -425,3 +426,17 @@ TEST_F(PayloadLogging, EnforcingMove)
}
EXPECT_EQ(logs.size(), 1);
}
+
+TEST_F(PayloadLogging, EnforcingException)
+{
+ try
+ {
+ ipmi::message::Payload p({1, 2});
+ p.trailingOk = false;
+ throw std::runtime_error("test");
+ }
+ catch (...)
+ {
+ }
+ EXPECT_EQ(logs.size(), 0);
+}
OpenPOWER on IntegriCloud