diff options
| author | Andrew Geissler <andrewg@us.ibm.com> | 2017-07-10 15:13:33 -0500 |
|---|---|---|
| committer | Andrew Geissler <andrewg@us.ibm.com> | 2017-07-18 13:52:09 -0500 |
| commit | 4cea4d2b36a0bfc212f34e72792cfa00e43384e9 (patch) | |
| tree | df51bb8e01368e8cf3b6623ec17930623f0049ed /test | |
| parent | 52cf26a821d914dc073b8d40a98b26cf2c6abe84 (diff) | |
| download | openpower-occ-control-4cea4d2b36a0bfc212f34e72792cfa00e43384e9.tar.gz openpower-occ-control-4cea4d2b36a0bfc212f34e72792cfa00e43384e9.zip | |
Determine pcap value to send to occ
Change-Id: Ie60aac151f5fd8ce091020ce756834e4877cbc93
Signed-off-by: Andrew Geissler <andrewg@us.ibm.com>
Diffstat (limited to 'test')
| -rw-r--r-- | test/Makefile.am | 20 | ||||
| -rw-r--r-- | test/utest.cpp | 30 |
2 files changed, 50 insertions, 0 deletions
diff --git a/test/Makefile.am b/test/Makefile.am new file mode 100644 index 0000000..6022c65 --- /dev/null +++ b/test/Makefile.am @@ -0,0 +1,20 @@ +AM_CPPFLAGS = -I$(top_srcdir) +check_PROGRAMS = utest + +# Run all 'check' test programs +TESTS = $(check_PROGRAMS) + +# Build/add utest to test suite +utest_CPPFLAGS = -Igtest $(GTEST_CPPFLAGS) $(AM_CPPFLAGS) +utest_CXXFLAGS = $(PTHREAD_CFLAGS) +utest_LDFLAGS = -lgtest_main -lgtest \ + $(PTHREAD_LIBS) \ + $(OESDK_TESTCASE_FLAGS) \ + $(SYSTEMD_LIBS) \ + ${SDBUSPLUS_LIBS} \ + $(OPENPOWER_DBUS_INTERFACES_LIBS) \ + -lstdc++fs +utest_SOURCES = utest.cpp +utest_LDADD = $(top_builddir)/powercap.o \ + $(top_builddir)/occ_status.o \ + $(top_builddir)/occ_device.o diff --git a/test/utest.cpp b/test/utest.cpp new file mode 100644 index 0000000..e99d996 --- /dev/null +++ b/test/utest.cpp @@ -0,0 +1,30 @@ +#include <gtest/gtest.h> +#include "powercap.hpp" + +using namespace open_power::occ; + +class VerifyOccInput : public ::testing::Test +{ + public: + VerifyOccInput() : + bus(sdbusplus::bus::new_default()), + occStatus(bus,"/test/path"), + pcap(bus,occStatus) + {} + ~VerifyOccInput() + {} + + sdbusplus::bus::bus bus; + Status occStatus; + powercap::PowerCap pcap; +}; + +TEST_F(VerifyOccInput, PcapDisabled) { + uint32_t occInput = pcap.getOccInput(100,false); + EXPECT_EQ(occInput, 0); +} + +TEST_F(VerifyOccInput, PcapEnabled) { + uint32_t occInput = pcap.getOccInput(100,true); + EXPECT_EQ(occInput, 90); +} |

