#include "config.h" #include #include #include #include namespace server = sdbusplus::server::xyz::openbmc_project::state; TEST(updateCurrentHostState, BasicPaths) { auto bus = sdbusplus::bus::new_default(); auto event = sdeventplus::Event::get_default(); bus.attach_event(event.get(), SD_EVENT_PRIORITY_NORMAL); auto objPathInst = std::string{HYPERVISOR_OBJPATH} + '0'; phosphor::state::manager::Hypervisor hypObj(bus, objPathInst.c_str()); std::string bootProgress = "Invalid.Boot.Progress"; hypObj.updateCurrentHostState(bootProgress); EXPECT_EQ(hypObj.currentHostState(), server::Host::HostState::Off); bootProgress = "xyz.openbmc_project.State.Boot.Progress." "ProgressStages.SystemInitComplete"; hypObj.updateCurrentHostState(bootProgress); EXPECT_EQ(hypObj.currentHostState(), server::Host::HostState::Standby); bootProgress = "xyz.openbmc_project.State.Boot.Progress." "ProgressStages.OSRunning"; hypObj.updateCurrentHostState(bootProgress); EXPECT_EQ(hypObj.currentHostState(), server::Host::HostState::Running); bootProgress = "xyz.openbmc_project.State.Boot.Progress." "ProgressStages.Unspecified"; hypObj.updateCurrentHostState(bootProgress); EXPECT_EQ(hypObj.currentHostState(), server::Host::HostState::Off); }