blob: 0d1d62806f380f28d6a19a5e7655ec621872bcd0 [file] [log] [blame]
Vishwanatha Subbanna00bd3772017-05-31 14:53:42 +05301#include <timer_test.hpp>
2#include <chrono>
3#include <watchdog.hpp>
4
5using namespace std::chrono;
6using namespace std::chrono_literals;
7
8// Test Watchdog functionality
9class WdogTest : public TimerTest
10{
11 public:
12 // Gets called as part of each TEST_F construction
13 WdogTest()
14 : bus(sdbusplus::bus::new_default()),
15 wdog(bus, TEST_PATH, eventP),
16 defaultInterval(milliseconds(wdog.interval())),
17 defaultDrift(30)
18 {
19 // Check for successful creation of
20 // event handler and bus handler
21 EXPECT_GE(rc, 0);
22
23 // Initially the watchdog would be disabled
24 EXPECT_EQ(false, wdog.enabled());
25 }
26
27 //sdbusplus handle
28 sdbusplus::bus::bus bus;
29
30 // Watchdog object
31 phosphor::watchdog::Watchdog wdog;
32
33 // This is the default interval as given in Interface definition
34 milliseconds defaultInterval;
35
36 // Acceptable drift when we compare the interval to timeRemaining.
37 // This is needed since it depends on when do we get scheduled and it
38 // has happened that remaining time was off by few msecs.
39 milliseconds defaultDrift;
40
41 private:
42 // Dummy name for object path
43 // This is just to satisfy the constructor. Does not have
44 // a need to check if the objects paths have been created.
45 static constexpr auto TEST_PATH = "/test/path";
46};