chiark / gitweb /
regress: fuzzraw: Improve sync lost msg
[adns.git] / regress / hfuzzraw.c.m4
index 1f76f0ee2de7c7292cd18d61275cbc2e1cb80701..0ed71a2c326232cba12bb4e72fdac6b58ea575ec 100644 (file)
@@ -46,9 +46,8 @@ static vbuf fdtab;
 #define FDF_OPEN     001u
 #define FDF_NONBLOCK 002u
 
-static FILE *Tinputfile;
+static FILE *Tinputfile, *traceout;
 static int traceprint;
-#define traceout stdout
 
 static void Tflushtrace( void) {
   if (fflush(traceout)) Toutputerr();
@@ -73,7 +72,10 @@ void Tensuresetup(void) {
   }
 
   const char *traceprintstr= getenv("ADNS_TEST_FUZZRAW_TRACEPRINT");
-  if (traceprintstr) traceprint= atoi(traceprintstr);
+  if (traceprintstr) {
+    traceprint= atoi(traceprintstr);
+    traceout= fdopen(2,"w");  if (!traceout) Tfailed("fdopen for traceout");
+  }
 }
 
 void Q_vb(void) {
@@ -201,7 +203,7 @@ m4_define(`syscall_sync',`
 #ifdef FUZZRAW_SYNC
   hm_fr_syscall_ident($'`1)
   static char sync_got[sizeof(sync_expect)];
-  Psync(sync_expect, sync_got, sizeof(sync_got), "sync lost: exp=$1");
+  Psync(sync_expect, sync_got, sizeof(sync_got), "sync lost: program did $1");
 #endif
 ')