Kunlun OEM commands,The first version add two commands:
1,setCpuInfo:save cpu infomation from bios to file
2,getCpuInfo:load cpu infomation from file
Signed-off-by: Xiuzhi Cheng <xzcheng@zd-tech.com.cn>
diff --git a/test/.uuid b/test/.uuid
new file mode 100644
index 0000000..9ec05e5
--- /dev/null
+++ b/test/.uuid
@@ -0,0 +1 @@
+5ff5f36b-062f-459b-a9ee-70bc183722c4
\ No newline at end of file
diff --git a/test/meson.build b/test/meson.build
new file mode 100644
index 0000000..0e54c90
--- /dev/null
+++ b/test/meson.build
@@ -0,0 +1,23 @@
+gtest = dependency('gtest', main: true, disabler: true, required: build_tests)
+gmock = dependency('gmock', disabler: true, required: build_tests)
+openssl = dependency('openssl', disabler: true, required: build_tests)
+
+configure_file(output: 'config.h',
+ configuration: cdata,
+)
+test_inc = include_directories('.')
+
+test_kunlun_ipmi_oem = executable(
+ 'test_kunlun-ipmi-oem',
+ '../src/kunlun_oem.cpp',
+ 'test_kunlun_ipmi_oem.cpp',
+ include_directories: [test_inc, src_inc],
+ dependencies: [
+ libipmid,
+ gtest,
+ gmock,
+ phosphor_logging,
+ openssl,
+ ])
+
+test('test_kunlun-ipmi-oem', test_kunlun_ipmi_oem)
diff --git a/test/test_kunlun_ipmi_oem.cpp b/test/test_kunlun_ipmi_oem.cpp
new file mode 100644
index 0000000..1b4526a
--- /dev/null
+++ b/test/test_kunlun_ipmi_oem.cpp
@@ -0,0 +1,56 @@
+#include "config.h"
+
+#include "kunlun_oem.hpp"
+
+#include <ipmid/api.h>
+
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+
+using ::testing::_;
+using ::testing::Invoke;
+using ::testing::IsNull;
+using ::testing::Return;
+using ::testing::StrEq;
+using ::testing::VariantWith;
+
+namespace ipmi
+{
+
+namespace impl
+{
+
+bool registerHandler(int prio, NetFn netFn, Cmd cmd, Privilege priv, ::ipmi::HandlerBase::ptr handler)
+{
+ (void)prio;
+ (void)netFn;
+ (void)cmd;
+ (void)priv;
+ (void)handler;
+
+ return true;
+}
+
+} // namespace impl
+
+TEST(TestKunlunIpmiOem, SetAndGetCpuInfo)
+{
+ uint8_t index = 0;
+ uint32_t loop;
+ std::vector<char> infoSet;
+ std::vector<char> infoGet;
+
+ for (loop = 0; loop < 256; loop++)
+ {
+ infoSet.push_back(static_cast<char>(loop));
+ }
+
+ EXPECT_EQ(setCpuInfo(index, infoSet), responseSuccess());
+
+ auto result = getCpuInfo(index);
+ infoGet = std::get<0>(std::get<1>(result).value());
+
+ EXPECT_TRUE(infoSet == infoGet);
+}
+
+} // namespace ipmi
\ No newline at end of file