X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=test%2Futils.h;h=dfada2c70b6e5dab562676690fe3ee18c1aabcc5;hb=0b08024d7834a915163a7b6a298ca109cf03db8c;hp=488721dd37af86748e9642879cad1da8588725d9;hpb=8fde91038538d01aaa5b36ebb06b516a8c313364;p=meshlink diff --git a/test/utils.h b/test/utils.h index 488721dd..dfada2c7 100644 --- a/test/utils.h +++ b/test/utils.h @@ -10,7 +10,8 @@ struct sync_flag { bool flag; }; -extern void set_sync_flag(struct sync_flag *s); +extern void set_sync_flag(struct sync_flag *s, bool value); +extern bool check_sync_flag(struct sync_flag *s); extern bool wait_sync_flag(struct sync_flag *s, int seconds); /// Create a pair of meshlink instances that are already joined together. @@ -25,14 +26,17 @@ extern void stop_meshlink_pair(meshlink_handle_t *a, meshlink_handle_t *b); /// Stop and cleanup a pair of meshlink instances. extern void close_meshlink_pair(meshlink_handle_t *a, meshlink_handle_t *b, const char *prefix); -#define assert_after(cond, timeout) do {\ - for(int i = 0; i++ <= timeout;) {\ - if(cond)\ - break;\ - if(i == timeout)\ - assert(cond);\ - sleep(1);\ - }\ -} while(0); - +/// Link two meshlink instances. +extern void link_meshlink_pair(meshlink_handle_t *a, meshlink_handle_t *b); + +#define assert_after(cond, timeout)\ + do {\ + for(int i = 0; i++ <= timeout;) {\ + if(cond)\ + break;\ + if(i == timeout)\ + assert(cond);\ + sleep(1);\ + }\ + } while(0) #endif