Drive physical LED when a LED group is actioned on
Change-Id: I3107c1d961c459379b77548a738533567eccf693
Signed-off-by: Vishwanatha Subbanna <vishwa@linux.vnet.ibm.com>
diff --git a/test/Makefile.am b/test/Makefile.am
index e434c40..6efd2c7 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -5,8 +5,8 @@
# # Build/add utest to test suite
check_PROGRAMS = utest
-utest_CPPFLAGS = -Igtest $(GTEST_CPPFLAGS) $(AM_CPPFLAGS)
+utest_CPPFLAGS = -Igtest $(GTEST_CPPFLAGS) $(AM_CPPFLAGS) $(PHOSPHOR_LOGGING_CFLAGS)
utest_CXXFLAGS = $(PTHREAD_CFLAGS)
-utest_LDFLAGS = -lgtest_main -lgtest $(PTHREAD_LIBS) $(OESDK_TESTCASE_FLAGS)
+utest_LDFLAGS = -lgtest_main -lgtest $(PTHREAD_LIBS) $(OESDK_TESTCASE_FLAGS) $(SYSTEMD_LIBS) $(PHOSPHOR_LOGGING_LIBS)
utest_SOURCES = utest.cpp
utest_LDADD = $(top_builddir)/manager.o
diff --git a/test/utest.cpp b/test/utest.cpp
index 38f8196..7450f09 100644
--- a/test/utest.cpp
+++ b/test/utest.cpp
@@ -1,6 +1,7 @@
#include <set>
#include <algorithm>
#include <gtest/gtest.h>
+#include <sdbusplus/bus.hpp>
#include "manager.hpp"
#include "led-test-map.hpp"
@@ -8,11 +9,12 @@
class LedTest : public ::testing::Test
{
public:
- virtual void SetUp()
+ sdbusplus::bus::bus bus;
+ LedTest() : bus(sdbusplus::bus::new_default())
{
- // Not having a need at the moment but for future.
+ // Nothing here
}
- virtual void TearDown()
+ ~LedTest()
{
// Leaving upto auto cleanup.
}
@@ -21,7 +23,7 @@
/** @brief Assert Single LED to On */
TEST_F(LedTest, assertSingleLedOn)
{
- Manager manager(singleLedOn);
+ Manager manager(bus, singleLedOn);
{
// Assert the LEDs.
Manager::group ledsAssert {};
@@ -53,7 +55,7 @@
/** @brief Assert Single LED to Blink */
TEST_F(LedTest, assertSingleLedBlink)
{
- Manager manager(singleLedBlink);
+ Manager manager(bus, singleLedBlink);
{
// Assert the LEDs.
Manager::group ledsAssert {};
@@ -85,7 +87,7 @@
/** @brief Assert Single LED to On and Try Assert Again */
TEST_F(LedTest, assertSingleLedOnAndreAssert)
{
- Manager manager(singleLedOn);
+ Manager manager(bus, singleLedOn);
{
// Assert the LEDs.
Manager::group ledsAssert {};
@@ -132,7 +134,7 @@
/** @brief Assert Multiple LEDs to On */
TEST_F(LedTest, assertMultipleLedOn)
{
- Manager manager(multipleLedsOn);
+ Manager manager(bus, multipleLedsOn);
{
// Assert the LEDs.
Manager::group ledsAssert {};
@@ -166,7 +168,7 @@
/** @brief Assert Multiple LEDs to Blink */
TEST_F(LedTest, assertMultipleLedBlink)
{
- Manager manager(multipleLedsBlink);
+ Manager manager(bus, multipleLedsBlink);
{
// Assert the LEDs.
Manager::group ledsAssert {};
@@ -200,7 +202,7 @@
/** @brief Assert Multiple LEDs to Blink, DeAssert */
TEST_F(LedTest, assertMultipleLedBlinkAndDeAssert)
{
- Manager manager(multipleLedsBlink);
+ Manager manager(bus, multipleLedsBlink);
{
// Assert the LEDs.
Manager::group ledsAssert {};
@@ -262,7 +264,7 @@
/** @brief Assert Multiple LEDs to Blink, DeAssert Twice */
TEST_F(LedTest, assertMultipleLedBlinkAndDeAssertTwice)
{
- Manager manager(multipleLedsBlink);
+ Manager manager(bus, multipleLedsBlink);
{
// Assert the LEDs.
Manager::group ledsAssert {};
@@ -338,7 +340,7 @@
/** @brief Assert Multiple LEDs to mix of On and Blink */
TEST_F(LedTest, assertMultipleLedOnAndBlink)
{
- Manager manager(multipleLedsOnAndBlink);
+ Manager manager(bus, multipleLedsOnAndBlink);
{
// Assert the LEDs.
Manager::group ledsAssert {};
@@ -374,7 +376,7 @@
/** @brief Assert 2 groups having distinct LEDs */
TEST_F(LedTest, assertTwoGroupsOnWithDistinctLEDOn)
{
- Manager manager(twoGroupsWithDistinctLEDsOn);
+ Manager manager(bus, twoGroupsWithDistinctLEDsOn);
{
// Assert Set-A
Manager::group ledsAssert {};
@@ -436,7 +438,7 @@
/** @brief Assert 2 groups having one of the LEDs common */
TEST_F(LedTest, asserttwoGroupsWithOneComonLEDOn)
{
- Manager manager(twoGroupsWithOneComonLEDOn);
+ Manager manager(bus, twoGroupsWithOneComonLEDOn);
{
// Assert Set-A
Manager::group ledsAssert {};
@@ -497,7 +499,7 @@
/** @brief Assert 2 groups having one of the LEDs common in different state */
TEST_F(LedTest, assertTwoGroupsWithOneComonLEDInDifferentState)
{
- Manager manager(twoGroupsWithOneComonLEDInDifferentState);
+ Manager manager(bus, twoGroupsWithOneComonLEDInDifferentState);
{
// Assert Set-A
Manager::group ledsAssert {};
@@ -560,7 +562,7 @@
/** @brief Assert 2 groups having multiple common LEDs in Same State */
TEST_F(LedTest, assertTwoGroupsWithMultiplComonLEDOn)
{
- Manager manager(twoGroupsWithMultiplComonLEDOn);
+ Manager manager(bus, twoGroupsWithMultiplComonLEDOn);
{
// Assert Set-B
Manager::group ledsAssert {};
@@ -621,7 +623,7 @@
/** @brief Assert 2 groups having multiple LEDs common in different state */
TEST_F(LedTest, assertTwoGroupsWithMultipleComonLEDInDifferentStates)
{
- Manager manager(twoGroupsWithMultipleComonLEDInDifferentState);
+ Manager manager(bus, twoGroupsWithMultipleComonLEDInDifferentState);
{
// Assert Set-A
Manager::group ledsAssert {};
@@ -687,7 +689,7 @@
*/
TEST_F(LedTest, assertTwoGroupsWithMultipleComonLEDAndDeAssertOne)
{
- Manager manager(twoGroupsWithMultiplComonLEDOn);
+ Manager manager(bus, twoGroupsWithMultiplComonLEDOn);
{
// Assert Set-A
Manager::group ledsAssert {};
@@ -775,7 +777,7 @@
* different state and De-Assert one*/
TEST_F(LedTest, assertTwoGroupsWithMultipleComonLEDInDifferentStateDeAssertOne)
{
- Manager manager(twoGroupsWithMultipleComonLEDInDifferentState);
+ Manager manager(bus, twoGroupsWithMultipleComonLEDInDifferentState);
{
// Assert Set-B
Manager::group ledsAssert {};