tools/helper: Streamline return types
These functions can already return exceptions, so make better use of
them for reporting failures.
Change-Id: I572e9e3ee44bbd5add601f3246bb4f95cb9308bf
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/tools/test/tools_helper_unittest.cpp b/tools/test/tools_helper_unittest.cpp
index 2bee66d..cfe5208 100644
--- a/tools/test/tools_helper_unittest.cpp
+++ b/tools/test/tools_helper_unittest.cpp
@@ -1,5 +1,6 @@
#include "helper.hpp"
#include "status.hpp"
+#include "tool_errors.hpp"
#include <blobs-ipmid/blobs.hpp>
#include <ipmiblob/test/blob_interface_mock.hpp>
@@ -30,7 +31,7 @@
EXPECT_CALL(blobMock, getStat(TypedEq<std::uint16_t>(session)))
.WillOnce(Return(verificationResponse));
- EXPECT_TRUE(pollStatus(session, &blobMock));
+ EXPECT_NO_THROW(pollStatus(session, &blobMock));
}
TEST_F(HelperTest, PollStatusReturnsAfterFailure)
@@ -43,7 +44,7 @@
EXPECT_CALL(blobMock, getStat(TypedEq<std::uint16_t>(session)))
.WillOnce(Return(verificationResponse));
- EXPECT_FALSE(pollStatus(session, &blobMock));
+ EXPECT_THROW(pollStatus(session, &blobMock), ToolException);
}
TEST_F(HelperTest, PollReadReadyReturnsAfterSuccess)
@@ -56,7 +57,7 @@
EXPECT_CALL(blobMock, getStat(TypedEq<std::uint16_t>(session)))
.WillOnce(Return(blobResponse));
- EXPECT_TRUE(pollReadReady(session, &blobMock).first);
+ EXPECT_NO_THROW(pollReadReady(session, &blobMock));
}
TEST_F(HelperTest, PollReadReadyReturnsAfterFailure)
@@ -68,7 +69,7 @@
EXPECT_CALL(blobMock, getStat(TypedEq<std::uint16_t>(session)))
.WillOnce(Return(blobResponse));
- EXPECT_FALSE(pollReadReady(session, &blobMock).first);
+ EXPECT_THROW(pollReadReady(session, &blobMock), ToolException);
}
TEST_F(HelperTest, PollReadReadyReturnsAfterRetrySuccess)
@@ -85,7 +86,7 @@
.WillOnce(Return(blobResponseRunning))
.WillOnce(Return(blobResponseReadReady));
- EXPECT_TRUE(pollReadReady(session, &blobMock).first);
+ EXPECT_NO_THROW(pollReadReady(session, &blobMock));
}
TEST_F(HelperTest, PollReadReadyReturnsAfterRetryFailure)
@@ -102,7 +103,7 @@
.WillOnce(Return(blobResponseRunning))
.WillOnce(Return(blobResponseError));
- EXPECT_FALSE(pollReadReady(session, &blobMock).first);
+ EXPECT_THROW(pollReadReady(session, &blobMock), ToolException);
}
TEST_F(HelperTest, MemcpyAlignedOneByte)