#include #include // in this test it is expected that the watchdog_timeout_cb1 is called, but not watchdog_timeout_cb2 int test_result = -1; bool cb1called = false; bool cb2called = false; void watchdog_timeout_cb1(void *data) { SoftwareWatchdog *watchdog = data; printf("!! watchdog_timeout_cb1 called !! \n"); fflush(stdout); cb1called = true; } void watchdog_timeout_cb2(void *data) { SoftwareWatchdog *watchdog = data; printf("!! watchdog_timeout_cb2 called !! \n"); fflush(stdout); cb2called = true; } int main(void){ printHelloWorld(); SoftwareWatchdog watchdog1; struct timespec timeout1; timeout1.tv_nsec = 500*1000000; timeout1.tv_sec = 1; swd_setup(&watchdog1, "watchdog1", watchdog_timeout_cb1, timeout1, NULL); swd_enable(&watchdog1); SoftwareWatchdog watchdog2; struct timespec timeout2; timeout2.tv_nsec = 500*1000000; timeout2.tv_sec = 1; swd_setup(&watchdog2, "watchdog2", watchdog_timeout_cb2, timeout2, NULL); swd_enable(&watchdog2); printf("Main: Sleeping for some seconds:\n"); for (int i = 3; i > 0; i--) { swd_kick(&watchdog2); printf("%d\n", i); fflush(stdout); sleep(1); } if(cb1called && !cb2called) return 0; return -1; }