chiark / gitweb /
regress: Introduce FUZZRAW_SYNC
[adns.git] / regress / hfuzzraw.c.m4
index c2c44cb186bdcd19c124fc6712d2f1610709b2be..16475bf3f39867b25c21bdd12236755dcbcb7eb5 100644 (file)
@@ -188,6 +188,13 @@ static void Pfdset(fd_set *set, int max, int *r_io) {
   }
 }
 
+#ifdef FUZZRAW_SYNC
+static void Psync(const char *exp, char *got, size_t sz, const char *what) {
+  P_read(got,sz,"syscall");
+  if (memcmp(exp,got,sz)) Pformat(what);
+}
+#endif
+
 #ifdef HAVE_POLL
 static void Ppollfds(struct pollfd *fds, int nfds, int *r_io) {
   int fd;
@@ -236,6 +243,12 @@ int H$1(hm_args_massage($3,void)) {
    Q$1(hm_args_massage($3));
  }
 
+#ifdef FUZZRAW_SYNC
+  static const char sync_expect[]= "$1";
+  static char sync_got[sizeof(sync_expect)];
+  Psync(sync_expect, sync_got, sizeof(sync_got), "sync lost: exp=$1");
+#endif
+
  m4_define(`hm_rv_succfail',`
   r= P_succfail();
   if (r<0) return r;