summaryrefslogtreecommitdiffstats
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
* meson: Add alternate build systemWilliam A. Kennington III2019-03-061-0/+13
| | | | | | | | | | | | | | For now we will support both the autotools and meson build systems alongside each other, until support for meson is ready across the ecosystem. Tested: Run through build and unit tests that leverage the new build system and all of the tests pass and the install puts phosphor-watchdog in the correct location. Change-Id: I0454e763acc648ac76efd7728f6da498d9acf5dd Signed-off-by: William A. Kennington III <wak@google.com>
* test/watchdog: Change the time quantum to 0.1s instead of 1sWilliam A. Kennington III2019-01-161-1/+1
| | | | | | | | | | | This improves the runtime of the test suite from 60s down to 6s or less. Tested: Run multiple times through the unit test suite without any flakiness. Change-Id: Ib7d97ed62b45501db9cf15dba01e33f8f9d07b5d Signed-off-by: William A. Kennington III <wak@google.com>
* test/watchdog: Define a time quantum typeWilliam A. Kennington III2019-01-162-43/+43
| | | | | | | | | | | | This will allow us to change the size of the windows of time we wait for watchdog events to happen. Right now this doesn't actually change any behavior it just makes it easier to tweak. Tested: Run through the build and unit test suite. Change-Id: If5b351574346426aff6499701164a3d5ebf9db7c Signed-off-by: William A. Kennington III <wak@google.com>
* test/watchdog: Don't use designated initializersWilliam A. Kennington III2019-01-161-14/+12
| | | | | | | | | | | | gcc supported this in c++ even though it was non-standard until c++2a is complete. This change removes designated initializers to make our tests compliant with std++17. Tested: Built and run through unit tests. Change-Id: I846394c633c0396518db6ed41682bbcf05b890c6 Signed-off-by: William A. Kennington III <wak@google.com>
* test: Rename watchdog_test to watchdogWilliam A. Kennington III2019-01-163-7/+8
| | | | | | | | Tested: Ran through build and unit test suite. Change-Id: I3a906ac26c43ac419eef8a98b20a498fe22f942b Signed-off-by: William A. Kennington III <wak@google.com>
* Convert to standard CLI11 argument parserWilliam A. Kennington III2018-10-053-186/+1
| | | | | | | | | | | | This simplifies the argument parsing logic drastically and still provides the same error handling as before. Tested: Ran through unit test suite and manually verified that the command line functions as expected on a real BMC. Change-Id: Ic5d69adf5359f9f64f2ada17e6a8f3242ca03e25 Signed-off-by: William A. Kennington III <wak@google.com>
* Convert to using sdeventplusWilliam A. Kennington III2018-10-055-135/+23
| | | | | | | | | | | | This gets rid of the ad-hoc timer class in favor of using the timer source built into sdeventplus. Tested: Unit tests pass and everything still builds. Manually verified the functionality is still in tact on a zaius machine. Change-Id: I90619f0fe5a9fdfcecd24a49de672c0c99dc95e9 Signed-off-by: William A. Kennington III <wak@google.com>
* test/watchdog: Test interval updateWilliam A. Kennington III2018-09-241-0/+27
| | | | | | | | | | | Adds a test to ensure that setting the interval on the watchdog affects subsequent resetTimeRemaining() calls. Tested: Ran through a unit test run Change-Id: Ibff14bbb40d5b93ffd5eaa5149f5cc9822e21d1e Signed-off-by: William A. Kennington III <wak@google.com>
* Standardize Action -> Target Map TypeWilliam A. Kennington III2018-09-171-6/+3
| | | | | | | | | | | | | | | This change refactors the watchdog header to export the type of watchdog action to systemd target map, so it can be directly used by other files. This makes enumerating the map type more trivial. Also convert to an unordered_map instead of map since we don't need the ordering guarantees. Tested: Builds and tests still pass Change-Id: I77d315210ec27fde295589479c50d46dc5d1b32a Signed-off-by: William A. Kennington III <wak@google.com>
* add .clang-formatPatrick Venture2018-09-116-145/+133
| | | | | Change-Id: I6d9ec8401dcd46781ea258bf8998faa2507fa91d Signed-off-by: Patrick Venture <venture@google.com>
* Implement a flag to enable fallback alwaysWilliam A. Kennington III2018-03-071-0/+61
| | | | | | | | | On some machines we want our watchdog running as long as the phosphor-watchdog daemon is alive. This patch adds an option to enter fallback mode any time the watchdog expires or is set to be disabled. Change-Id: Ic96d2f15c761aeb4e25158c5bd861076cca6497d Signed-off-by: William A. Kennington III <wak@google.com>
* Implement a fallback watchdog optionWilliam A. Kennington III2018-03-071-0/+135
| | | | | | | | | | | | | | | | | | Sometimes our initial watchdog action is not enough to recover the host from the state it transitioned into. However, always using a more power form of power cycle is not desirable as we can lose useful CPU crash state. It is desirable in this case to have two levels of watchog timers. This patch implements the ability for the service to specify a fallback watchdog action and interval. After the initial watchdog timeout is encountered, the watchdog will be re-armed with the new parameters. Once the watchdog times out again it will execute the fallback action. Attempts to update the timeRemaining will reset the fallback just in case something is still alive. Change-Id: I69f4422c7e3963f02200815f3cef620af9e6cf8b Signed-off-by: William A. Kennington III <wak@google.com>
* watchdog: Rewrite timeoutHandler() to make disabling part of the timeoutWilliam A. Kennington III2018-03-071-1/+1
| | | | | | | | This makes no functional changes to the user interface but make future code reworks shorter. Change-Id: Ibd57a5d1090588c8a7b2a67730660c3cf47c832e Signed-off-by: William A. Kennington III <wak@google.com>
* tests/watchdog: Cleanup our use of durationsWilliam A. Kennington III2018-03-071-12/+10
| | | | | | | | We have lots of unnecessary constructors and forced duration casts. This change makes all of that logic simpler. Change-Id: Icfc6d51d75dfb67b3b4c252fbc32beeeded299ca Signed-off-by: William A. Kennington III <wak@google.com>
* tests/watchdog: Make sure the watchdog can be configured while disabledWilliam A. Kennington III2018-03-071-0/+20
| | | | | Change-Id: If25a533fd23ede502df402d021742aa19f64d2f6 Signed-off-by: William A. Kennington III <wak@google.com>
* tests/watchdog: Add a helper for counting down with the watchdogWilliam A. Kennington III2018-03-072-23/+31
| | | | | | | | This reduces a bunch of duplicate code that loops through an event loop to try and guage how long it took for the watchdog to expire. Change-Id: Ib3b33e250b157df02eff39751277c564ea40705c Signed-off-by: William A. Kennington III <wak@google.com>
* watchdog: Add a function to tell us if the timer is runningWilliam A. Kennington III2018-03-071-1/+9
| | | | | | | | This helps us refactor some of our existing code and will be useful for future changes. Change-Id: Ifa1547f09997d6824f726fc5f46e15eed4c1e8c1 Signed-off-by: William A. Kennington III <wak@google.com>
* tests: Make private members protectedWilliam A. Kennington III2018-02-281-1/+1
| | | | | | | | | | | Googletest derived classes should never have private members unless they are inteded to not be accessible to class functions. Since class functions are derived from the provided class, the private members are unable to be accessed by the test cases. In a future change we need access to one of these members so make them protected. Change-Id: Iadbb53adc748d02168a1fc83f738f86437a1d15c Signed-off-by: William A. Kennington III <wak@google.com>
* test/watchdog: Use a unique_ptr for the watchdogWilliam A. Kennington III2018-02-282-29/+31
| | | | | | | | | This lets us change out the watchdog with a watchdog constructed using different parameters. Currently this functionality is not used, but it is needed for a future change. Change-Id: Ie1e7fbf2c7fc8bf2949237f2535177ecd46944a0 Signed-off-by: William A. Kennington III <wak@google.com>
* tests: Convert EXPECT_EQ(bool -> EXPECT_{TRUE,FALSE}William A. Kennington III2018-02-283-21/+21
| | | | | | | This is more in line with normal gtest code style. Change-Id: If49f700f756ad8d278927baae4e934ef7aa399d7 Signed-off-by: William A. Kennington III <wak@google.com>
* test/Makefile: Build test sources using automake targetsWilliam A. Kennington III2018-02-051-10/+3
| | | | | | | | | | If you specify object files for LDADD it will use some kind of built in rules for building those objects instead of adding the proper CFLAGS to the compile process. This results in build failures if the CFLAGS were actually needed to compile those objects. Change-Id: I1b7837c41fb5fc840d8b913802cfcdc0ee800455 Signed-off-by: William A. Kennington III <wak@google.com>
* argument: Support multiple argumentsWilliam A. Kennington III2018-02-051-14/+18
| | | | | | | | | | This will be used in future patches. Right now this should retain similar behavior to the current argument parsing semantics. The difference is we now require arguments to be specified only once and error if they are specified multiple times. Change-Id: I21e4cf9734f045c2b0991f7ed0ec6e6a569eec7d Signed-off-by: William A. Kennington III <wak@google.com>
* argument: Implement test casesWilliam A. Kennington III2018-01-303-1/+196
| | | | | | | The argument parser had a few subtle bugs and could use some tests. Change-Id: I0adbc507a822a6887fbf02b888b1f678b3cc7b35 Signed-off-by: William A. Kennington III <wak@google.com>
* configure/make: Allow googletest from pkg-configWilliam A. Kennington III2018-01-291-12/+11
| | | | | Change-Id: I2eb526827987dd2361d35fd782229b1461d49d01 Signed-off-by: William A. Kennington III <wak@google.com>
* Spelling fixesGunnar Mills2017-10-251-1/+1
| | | | | Change-Id: I3a85e921f87401701f3ebb22e972e0d3f9cf19c1 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
* Don't set Interval by setting TimeRemainingPatrick Venture2017-09-121-3/+12
| | | | | | | | | | | | | This change allows one to set the TimeRemaining as a one-time shot, and also allows more straightforward control. -Changing the Interval doesn't reset the watchdog or update the TimeRemaining. -Changing the TimeRemaining doesn't set the Interval for future cycles. Change-Id: I03a3cdb9cc9e5c4bc034dc86d2b4324a5a4b7243 Signed-off-by: Patrick Venture <venture@google.com>
* Update Interval when timeRemaining is updatedVishwanatha Subbanna2017-06-081-0/+3
| | | | | | | | | | | | | | | | | | | | | | | A typical watchdog implementation would give these 2 features: - Setting the interval - Resetting the timer which also means poke This watchdog implementation does not provide a poke function and the same can be achieved by clients making these dbus calls in that order. 1) Get the Last set Interval 2) Set TimeRemaining field to result from #1 To achieve #1, this commit adds the support. This would make sure that the new timer would expire after last updated user interval from that time. Fixes openbmc/openbmc#767 Change-Id: I7393eb32992d7a08518ef463fd0a442df0772392 Signed-off-by: Vishwanatha Subbanna <vishwa@linux.vnet.ibm.com>
* Commit error and exit the application on error scenariosVishwanatha Subbanna2017-06-081-3/+4
| | | | | | | | Typically sd_event* calls can not go wrong and if they do, better would be to terminate the application so we get a coredump. Change-Id: I899177c369332cabf6d9bc22daaa142b50d758d0 Signed-off-by: Vishwanatha Subbanna <vishwa@linux.vnet.ibm.com>
* Add Gtest to test watchdogVishwanatha Subbanna2017-06-065-0/+327
Change-Id: Ia0268b6b18999b6dd6cfd26bcadcff25734306f0 Signed-off-by: Vishwanatha Subbanna <vishwa@linux.vnet.ibm.com>
OpenPOWER on IntegriCloud