Added end2end test case
Added end2end test case for exercising code from attention event to isolator.
Signed-off-by: Ben Tyner <ben.tyner@ibm.com>
Change-Id: I5bde1c50e4b70e284e99e71bb69d55041310c0d0
diff --git a/test/end2end/analyzer_main.cpp b/test/end2end/analyzer_main.cpp
new file mode 100644
index 0000000..03d6a8f
--- /dev/null
+++ b/test/end2end/analyzer_main.cpp
@@ -0,0 +1,25 @@
+#include <hei_main.hpp>
+
+namespace analyzer
+{
+
+// Quick test that we can call the core libhei functions. This function
+// is called from the attention handler when a checkstop event is active.
+void analyzeHardware()
+{
+ using namespace libhei;
+
+ // Add some chips for error isolation
+ std::vector<Chip> chipList;
+ chipList.emplace_back(Chip{"proc", static_cast<ChipType_t>(0xdeadbeef)});
+
+ // Isolation data that will be populated by isolator
+ IsolationData isoData{};
+
+ // Isolate active hardware errors in chips
+ initialize(nullptr, 0);
+ isolate(chipList, isoData);
+ uninitialize();
+}
+
+} // namespace analyzer
diff --git a/test/end2end/bp_handler.cpp b/test/end2end/bp_handler.cpp
new file mode 100644
index 0000000..bcb0ac3
--- /dev/null
+++ b/test/end2end/bp_handler.cpp
@@ -0,0 +1,17 @@
+#include <attn/logging.hpp>
+
+#include <sstream>
+
+namespace attn
+{
+
+/** @brief Breakpoint special attention handler */
+void bpHandler()
+{
+ // trace message
+ std::stringstream ss;
+ ss << "breakpoint handler";
+ log<level::INFO>(ss.str().c_str());
+}
+
+} // namespace attn
diff --git a/test/end2end/hei_user_defines.hpp b/test/end2end/hei_user_defines.hpp
new file mode 100644
index 0000000..e45e18d
--- /dev/null
+++ b/test/end2end/hei_user_defines.hpp
@@ -0,0 +1,25 @@
+#pragma once
+
+/**
+ * @file hei_user_defines.hpp
+ * @brief The purpose of this file is to provide defines that are required by
+ * the hardware error isolator library (libhei)
+ */
+
+#include <assert.h>
+#include <inttypes.h>
+#include <stdio.h>
+
+#define HEI_INF(...) \
+ { \
+ printf("HWDIAGS I> " __VA_ARGS__); \
+ printf("\n"); \
+ }
+
+#define HEI_ERR(...) \
+ { \
+ printf("HWDIAGS E> " __VA_ARGS__); \
+ printf("\n"); \
+ }
+
+#define HEI_ASSERT(expression) assert(expression);
diff --git a/test/end2end/logging.cpp b/test/end2end/logging.cpp
new file mode 100644
index 0000000..2833766
--- /dev/null
+++ b/test/end2end/logging.cpp
@@ -0,0 +1,15 @@
+#include <attn/logging.hpp>
+
+#include <iostream>
+
+namespace attn
+{
+
+/** @brief Log message of type INFO using stdout */
+template <>
+void log<INFO>(const char* i_message)
+{
+ std::cout << i_message;
+}
+
+} // namespace attn
diff --git a/test/end2end/main.cpp b/test/end2end/main.cpp
new file mode 100644
index 0000000..3540f6d
--- /dev/null
+++ b/test/end2end/main.cpp
@@ -0,0 +1,18 @@
+#include <libpdbg.h>
+
+#include <attn/attn_handler.hpp>
+
+// The attnHandler() function is called when the an attention GPIO event is
+// triggered. We call it here directly to simulatea a GPIO event.
+int main()
+{
+ int rc = 0; // return code
+
+ // initialize pdbg targets
+ pdbg_targets_init(nullptr);
+
+ // exercise attention gpio event path
+ attn::attnHandler(false);
+
+ return rc;
+}
diff --git a/test/end2end/meson.build b/test/end2end/meson.build
new file mode 100644
index 0000000..f2031d6
--- /dev/null
+++ b/test/end2end/meson.build
@@ -0,0 +1,8 @@
+# create openpower-hw-diags executable for local testing
+executable('openpower-hw-diags-test',
+ 'main.cpp', 'logging.cpp', 'bp_handler.cpp', 'ti_handler.cpp',
+ 'analyzer_main.cpp',
+ link_with : [analyzer, attn],
+ include_directories : incdir,
+ dependencies : libhei_dep,
+ install : false)
diff --git a/test/end2end/ti_handler.cpp b/test/end2end/ti_handler.cpp
new file mode 100644
index 0000000..50cc97b
--- /dev/null
+++ b/test/end2end/ti_handler.cpp
@@ -0,0 +1,17 @@
+#include <attn/logging.hpp>
+
+#include <sstream>
+
+namespace attn
+{
+
+/** @brief Handle TI special attention */
+void tiHandler()
+{
+ // trace message
+ std::stringstream ss;
+ ss << "TI handler" << std::endl;
+ log<level::INFO>(ss.str().c_str());
+}
+
+} // namespace attn
diff --git a/test/meson.build b/test/meson.build
index 76aa354..1704f17 100644
--- a/test/meson.build
+++ b/test/meson.build
@@ -1,3 +1,6 @@
+# end2end code exerciser for experiment and testing
+subdir('end2end')
+
tests = [
'hello-world',
]