]> git.meshlink.io Git - meshlink/blobdiff - test/utils.h
Fix all compiler warnings found using -Wall -W -pedantic.
[meshlink] / test / utils.h
index e1073df8f7e8468c1ee0936dc7d0c0c6323c912f..27bb38c3fe9e20a8abae834c1d802d941daee2a2 100644 (file)
@@ -10,7 +10,7 @@ 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 wait_sync_flag(struct sync_flag *s, int seconds);
 
 /// Create a pair of meshlink instances that are already joined together.
@@ -25,5 +25,14 @@ 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)
 #endif
-