buffer: Implement "readErrorLogs"
This is the API that will be called by the main to read all of the error
logs. Found a cornercase in wraparoundRead, so added a unit test to
guard it as well.
Tested:
Unit tested and tested on a real HW (with the following changes)
Signed-off-by: Brandon Kim <brandonkim@google.com>
Change-Id: I94cd3a2f53ee7da2c145b751c1c3b5989f4c5b23
diff --git a/include/buffer.hpp b/include/buffer.hpp
index d42b843..d676165 100644
--- a/include/buffer.hpp
+++ b/include/buffer.hpp
@@ -136,6 +136,14 @@
* * @return entry header and entry pair read from buffer
*/
virtual EntryPair readEntry(size_t relativeOffset) = 0;
+
+ /**
+ * Read the buffer - this API should be used instead of individual functions
+ * above
+ *
+ * @return vector of EntryPair which consists of entry header and entry
+ */
+ virtual std::vector<EntryPair> readErrorLogs() = 0;
};
/**
@@ -158,6 +166,7 @@
const uint32_t length) override;
struct QueueEntryHeader readEntryHeader(size_t relativeOffset) override;
EntryPair readEntry(size_t relativeOffset) override;
+ std::vector<EntryPair> readErrorLogs() override;
private:
/** @brief The Error log queue starts after the UE region, which is where