Module Name: src
Committed By: pooka
Date: Mon Jan 10 19:51:37 UTC 2011
Modified Files:
src/tests/rump/rumpkern: t_sp.sh
src/tests/rump/rumpkern/h_client: h_stresscli.c
Log Message:
Make sure stressclient worker threads complete their operation
instead of hanging.
To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/rump/rumpkern/t_sp.sh
cvs rdiff -u -r1.3 -r1.4 src/tests/rump/rumpkern/h_client/h_stresscli.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/tests/rump/rumpkern/t_sp.sh
diff -u src/tests/rump/rumpkern/t_sp.sh:1.5 src/tests/rump/rumpkern/t_sp.sh:1.6
--- src/tests/rump/rumpkern/t_sp.sh:1.5 Thu Jan 6 07:00:28 2011
+++ src/tests/rump/rumpkern/t_sp.sh Mon Jan 10 19:51:37 2011
@@ -1,4 +1,4 @@
-# $NetBSD: t_sp.sh,v 1.5 2011/01/06 07:00:28 pooka Exp $
+# $NetBSD: t_sp.sh,v 1.6 2011/01/10 19:51:37 pooka Exp $
#
# Copyright (c) 2010 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -60,7 +60,7 @@
export RUMP_SERVER=unix://commsock
atf_check -s exit:0 rump_server ${RUMP_SERVER}
- atf_check -s exit:0 $(atf_get_srcdir)/h_client/h_stresscli ${1}
+ atf_check -s exit:0 -e ignore $(atf_get_srcdir)/h_client/h_stresscli $1
}
fork()
Index: src/tests/rump/rumpkern/h_client/h_stresscli.c
diff -u src/tests/rump/rumpkern/h_client/h_stresscli.c:1.3 src/tests/rump/rumpkern/h_client/h_stresscli.c:1.4
--- src/tests/rump/rumpkern/h_client/h_stresscli.c:1.3 Mon Jan 10 14:05:03 2011
+++ src/tests/rump/rumpkern/h_client/h_stresscli.c Mon Jan 10 19:51:37 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: h_stresscli.c,v 1.3 2011/01/10 14:05:03 pooka Exp $ */
+/* $NetBSD: h_stresscli.c,v 1.4 2011/01/10 19:51:37 pooka Exp $ */
#include <sys/types.h>
#include <sys/atomic.h>
@@ -17,12 +17,13 @@
static unsigned int syscalls;
static pid_t mypid;
+static volatile sig_atomic_t doquit;
static void
signaali(int sig)
{
- _exit(0);
+ doquit = 1;
}
static const int hostnamemib[] = { CTL_KERN, KERN_HOSTNAME };
@@ -35,7 +36,7 @@
char buf[256];
size_t blen;
- for (;;) {
+ while (!doquit) {
pid_t pidi;
blen = sizeof(buf);
if (rump_sys___sysctl(hostnamemib, __arraycount(hostnamemib),
@@ -63,7 +64,7 @@
int
main(int argc, char *argv[])
{
- pthread_t pt;
+ pthread_t pt[NTHR-1];
pid_t clis[NCLI];
pid_t apid;
int ncli = 0;
@@ -94,10 +95,15 @@
signal(SIGUSR1, signaali);
for (j = 0; j < NTHR-1; j++)
- if (pthread_create(&pt, NULL,
+ if (pthread_create(&pt[j], NULL,
client, NULL) != 0)
err(1, "pthread create");
client(NULL);
+ for (j = 0; j < NTHR-1; j++)
+ pthread_join(pt[j], NULL);
+ membar_consumer();
+ fprintf(stderr, "done %d\n", syscalls);
+ exit(0);
/* NOTREACHED */
default:
ncli++;