Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/rump/rumpkern/h_client Limit test duration based on wa...
details: https://anonhg.NetBSD.org/src/rev/f18575eeb48e
branches: trunk
changeset: 761788:f18575eeb48e
user: pooka <pooka%NetBSD.org@localhost>
date: Mon Feb 07 20:05:09 2011 +0000
description:
Limit test duration based on wall time instead of loops
(took a long time on slow platforms).
diffstat:
tests/rump/rumpkern/h_client/h_sigcli.c | 16 ++++++++++++++--
1 files changed, 14 insertions(+), 2 deletions(-)
diffs (43 lines):
diff -r 1bab2bdf40e2 -r f18575eeb48e tests/rump/rumpkern/h_client/h_sigcli.c
--- a/tests/rump/rumpkern/h_client/h_sigcli.c Mon Feb 07 19:34:39 2011 +0000
+++ b/tests/rump/rumpkern/h_client/h_sigcli.c Mon Feb 07 20:05:09 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: h_sigcli.c,v 1.2 2011/01/10 19:30:21 pooka Exp $ */
+/* $NetBSD: h_sigcli.c,v 1.3 2011/02/07 20:05:09 pooka Exp $ */
#include <sys/types.h>
#include <sys/sysctl.h>
@@ -35,6 +35,7 @@
main(void)
{
char buf[128];
+ time_t tstart;
struct itimerval itv;
size_t hnbsize;
int i;
@@ -57,13 +58,24 @@
if (setitimer(ITIMER_REAL, &itv, NULL) == -1)
err(1, "itimer");
- for (i = 0; i < 20000; i++) {
+ tstart = time(NULL);
+ for (i = 0;; i++) {
blen = sizeof(buf);
if (rump_sys___sysctl(hostnamemib, __arraycount(hostnamemib),
buf, &blen, NULL, 0) == -1)
err(1, "sysctl");
if (strcmp(buf, hostnamebuf) != 0)
errx(1, "main hostname");
+
+ /*
+ * check every 100 cycles to avoid doing
+ * nothing but gettimeofday()
+ */
+ if (i == 100) {
+ if (time(NULL) - tstart > 5)
+ break;
+ i = 0;
+ }
}
if (!sigexecs) {
Home |
Main Index |
Thread Index |
Old Index