static FILE *Tinputfile, *Tfuzzrawfile, *Treportfile;
static vbuf vb2;
-static void Tensurereportfile(void) {
+static void Tensure_reportfile(void) {
const char *fdstr;
int fd;
Treportfile= fdopen(fd,"a"); if (!Treportfile) Tfailed("fdopen ADNS_TEST_REPORT_FD");
}
-static void Tensurefuzzrawfile(void) {
+static void Tensure_fuzzrawfile(void) {
static int done;
if (done) return;
FR_WRITE(delta);
}
-void Tensurerecordfile(void) {
+void Tensuresetup(void) {
int fd;
int chars;
unsigned long sec, usec;
+ Tensure_reportfile();
+ Tensure_fuzzrawfile();
+
if (Tinputfile) return;
Tinputfile= stdin;
fd = Ttestinputfd();
if (vb2.buf[vb2.used++] != hm_squote[hm_squote) Psyntax("pollfds start not [");
for (i=0; i<nfds; i++) {
Pstring("{fd=","{fd= in pollfds");
- fds->fd= strtoul(vb2.buf+vb2.used,&ep,10);
+ int gotfd= strtoul(vb2.buf+vb2.used,&ep,10);
+ if (gotfd != fds->fd) Psyntax("poll fds[].fd changed");
vb2.used= ep - (char*)vb2.buf;
Pstring(", events=",", events= in pollfds");
- fds->events= Ppollfdevents();
+ int gotevents= Ppollfdevents();
+ if (gotevents != fds->events) Psyntax("poll fds[].events changed");
Pstring(", revents=",", revents= in pollfds");
fds->revents= Ppollfdevents();
+ if (gotevents) FR_WRITE(fds->revents);
Pstring("}","} in pollfds");
Pstring(comma,"separator in pollfds");
comma= ", ";
void Q_vb(void) {
const char *nl;
- Tensurerecordfile();
+ Tensuresetup();
if (!adns__vbuf_ensure(&vb2,vb.used+2)) Tnomem();
fread(vb2.buf,1,vb.used+2,Tinputfile);
if (feof(Tinputfile)) {
vb.used,vb.buf, vb.used,vb2.buf+1);
exit(1);
}
- Tensurereportfile();
nl= memchr(vb.buf,'\n',vb.used);
fprintf(Treportfile," %.*s\n", (int)(nl ? nl - (const char*)vb.buf : vb.used), vb.buf);
}
if (!adns__vbuf_ensure(&vb2,1000)) Tnomem();
fgets(vb2.buf,vb2.avail,Tinputfile); Pcheckinput();
- Tensurereportfile();
- Tensurefuzzrawfile();
+ Tensuresetup();
fprintf(Treportfile,"%s",vb2.buf);
amtread= strlen(vb2.buf);
if (amtread<=0 || vb2.buf[--amtread]!=hm_squote\nhm_squote)