blob: 7055053dec92e2e85205eb606786424b52610756 [file] [log] [blame]
Jason M. Billsf2669fa2024-09-05 13:29:16 -07001#include "config-validator.hpp"
2#include "group.hpp"
3#include "ledlayout.hpp"
4#include "test-empty-group.hpp"
5
6#include <gtest/gtest.h>
7
8using namespace phosphor::led;
9
10// systemLedMap is generated code
11// static const GroupMap systemLedMap = {};
12
13const std::string basePath = "/xyz/openbmc_project/led/groups/";
14
15TEST(YamlEmptyGroupTest, assertEmptyGroupExists)
16{
17 /* Empty led groups are supported since some boards may
18 * not have the required leds to fill the expected groups.
19 * Other software in openbmc (e.g bmcweb, led-manager itself)
20 * expects certain groups and unintended error messages can result
21 * if they are not present.
22 */
23
24 const std::string emptyGroupPath = basePath + "emptygroup";
25 const std::string nonEmptyGroupPath = basePath + "nonemptygroup";
26
27 EXPECT_EQ(systemLedMap.contains(emptyGroupPath), true);
28 EXPECT_EQ(systemLedMap.contains(nonEmptyGroupPath), true);
29
30 const Layout::GroupLayout& emptyGroup = systemLedMap.at(emptyGroupPath);
31 const Layout::GroupLayout& nonEmptyGroup =
32 systemLedMap.at(nonEmptyGroupPath);
33
34 EXPECT_EQ(emptyGroup.actionSet.size(), 0);
35 EXPECT_EQ(nonEmptyGroup.actionSet.size(), 1);
36
37 // this should not throw
38 phosphor::led::validateConfigV1(systemLedMap);
39}