/* * timedereg test case for the libxl event system * * To run this test: * ./test_timedereg * Success: * program takes a few seconds, prints some debugging output and exits 0 * Failure: * crash * * set up [0]-group timeouts 0 1 2 * wait for timeout 1 to occur * deregister 0 and 2. 1 is supposed to be deregistered already * register [1]-group 0 1 2 * deregister 1 (should be a no-op) * wait for [1]-group 0 1 2 in turn * on final callback assert that all have been deregistered */ #include "libxl_internal.h" #include "libxl_test_timedereg.h" #define NTIMES 3 static const int ms[2][NTIMES] = { { 2000,1000,2000 }, { 1000,2000,3000 } }; static libxl__ev_time et[2][NTIMES]; static libxl__ao *tao; static int seq; static void occurs(libxl__egc *egc, libxl__ev_time *ev, const struct timeval *requested_abs, int rc); static void regs(libxl__ao *ao, int j) { AO_GC; int rc, i; LOG(DEBUG,"regs(%d)", j); for (i=0; i