[master] 3dbca974b varnishtest: Apply usleep.cocci
Dridi Boukelmoune
dridi.boukelmoune at gmail.com
Wed Feb 5 16:56:06 UTC 2025
commit 3dbca974bde396fd61d57beb7dcb6c091d10eeed
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date: Wed Feb 5 17:52:56 2025 +0100
varnishtest: Apply usleep.cocci
diff --git a/bin/varnishtest/vtc_haproxy.c b/bin/varnishtest/vtc_haproxy.c
index e4150bf01..432493ae6 100644
--- a/bin/varnishtest/vtc_haproxy.c
+++ b/bin/varnishtest/vtc_haproxy.c
@@ -824,7 +824,7 @@ haproxy_wait(struct haproxy *h)
vtc_log(h->vl, 4,
"Kill(%d)=%d: %s", sig, i, strerror(errno));
}
- usleep(100000);
+ VTIM_sleep(0.1);
if (++n == 20) {
switch (sig) {
case SIGINT: sig = SIGTERM ; break;
diff --git a/bin/varnishtest/vtc_http.c b/bin/varnishtest/vtc_http.c
index 352054a59..983576896 100644
--- a/bin/varnishtest/vtc_http.c
+++ b/bin/varnishtest/vtc_http.c
@@ -1682,7 +1682,7 @@ cmd_http_txpri(CMD_ARGS)
if (l != 18)
vtc_log(vl, hp->fatal, "Write failed: (%zd vs %zd) %s",
l, sizeof(PREFACE), strerror(errno));
- usleep(10000);
+ VTIM_sleep(0.01);
l = write(hp->sess->fd, PREFACE + 18, sizeof(PREFACE) - 18);
if (l != sizeof(PREFACE) - 18)
vtc_log(vl, hp->fatal, "Write failed: (%zd vs %zd) %s",
diff --git a/bin/varnishtest/vtc_process.c b/bin/varnishtest/vtc_process.c
index baf196257..e9417450c 100644
--- a/bin/varnishtest/vtc_process.c
+++ b/bin/varnishtest/vtc_process.c
@@ -309,7 +309,7 @@ term_expect_text(struct process *pp,
vtc_fatal(pp->vl, "YYY %d nlin %d", y, pp->nlin);
x = strtoul(col, NULL, 0);
for(l = 0; l <= 10 && x > pp->ncol; l++) // wait for screen change
- usleep(100000);
+ VTIM_sleep(0.1);
if (x < 0 || x > pp->ncol)
vtc_fatal(pp->vl, "XXX %d ncol %d", x, pp->ncol);
l = strlen(pat);
@@ -344,7 +344,7 @@ term_expect_cursor(const struct process *pp, const char *lin, const char *col)
vtc_fatal(pp->vl, "YYY %d nlin %d", y, pp->nlin);
x = strtoul(col, NULL, 0);
for(l = 0; l < 10 && x > pp->ncol; l++) // wait for screen change
- usleep(100000);
+ VTIM_sleep(0.1);
if (x < 0 || x > pp->ncol)
vtc_fatal(pp->vl, "XXX %d ncol %d", x, pp->ncol);
if (y != 0 && (y-1) != pos->tp_row)
@@ -374,7 +374,7 @@ term_match_text(struct process *pp,
vtc_fatal(pp->vl, "YYY %zd nlin %d", y, pp->nlin);
x = strtoul(col, NULL, 0);
for(l = 0; l < 10 && x > pp->ncol; l++) // wait for screen change
- usleep(100000);
+ VTIM_sleep(0.1);
if (x < 0 || x > pp->ncol)
vtc_fatal(pp->vl, "XXX %zd ncol %d", x, pp->ncol);
@@ -1142,7 +1142,7 @@ cmd_process(CMD_ARGS)
v = p->stdout_bytes;
PTOK(pthread_mutex_unlock(&p->mtx));
vtc_log(p->vl, 4, "Have %ju bytes", v);
- usleep(500000);
+ VTIM_sleep(0.5);
} while(v < u);
continue;
}
diff --git a/bin/varnishtest/vtc_varnish.c b/bin/varnishtest/vtc_varnish.c
index d72242196..12a67b4ff 100644
--- a/bin/varnishtest/vtc_varnish.c
+++ b/bin/varnishtest/vtc_varnish.c
@@ -126,7 +126,7 @@ varnish_fatal_cleanup(const struct varnish *v)
}
if (n == 1)
- usleep(10000);
+ VTIM_sleep(0.01);
} while (n > 0);
}
@@ -193,7 +193,7 @@ wait_stopped(const struct varnish *v)
}
free(r);
r = NULL;
- (void)usleep(200000);
+ VTIM_sleep(0.2);
}
}
/**********************************************************************
@@ -227,7 +227,7 @@ wait_running(const struct varnish *v)
}
free(r);
r = NULL;
- (void)usleep(200000);
+ VTIM_sleep(0.2);
}
}
More information about the varnish-commit
mailing list