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 Give the stress queen two modes...



details:   https://anonhg.NetBSD.org/src/rev/2967aa885373
branches:  trunk
changeset: 760731:2967aa885373
user:      pooka <pooka%NetBSD.org@localhost>
date:      Wed Jan 12 11:37:45 2011 +0000

description:
Give the stress queen two modes: one which nicely suggests an exit
and another one which keeps moet et chandon in her pretty cabinet.

diffstat:

 tests/rump/rumpkern/h_client/h_stresscli.c |  31 +++++++++++++++++++++++------
 1 files changed, 24 insertions(+), 7 deletions(-)

diffs (62 lines):

diff -r 21ce9daad6d7 -r 2967aa885373 tests/rump/rumpkern/h_client/h_stresscli.c
--- a/tests/rump/rumpkern/h_client/h_stresscli.c        Wed Jan 12 11:12:25 2011 +0000
+++ b/tests/rump/rumpkern/h_client/h_stresscli.c        Wed Jan 12 11:37:45 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: h_stresscli.c,v 1.6 2011/01/12 11:12:25 pooka Exp $    */
+/*     $NetBSD: h_stresscli.c,v 1.7 2011/01/12 11:37:45 pooka Exp $    */
 
 #include <sys/types.h>
 #include <sys/atomic.h>
@@ -69,12 +69,20 @@
        pid_t apid;
        int ncli = 0;
        int i = 0, j;
-       int status;
+       int status, thesig;
        int rounds;
 
-       if (argc != 2)
+       if (argc != 2 && argc != 3)
                errx(1, "need roundcount");
 
+       if (argc == 3) {
+               if (strcmp(argv[2], "kill") != 0)
+                       errx(1, "optional 3rd param must be kill");
+               thesig = SIGKILL;
+       } else {
+               thesig = SIGUSR1;
+       }
+
        signal(SIGUSR1, signaali);
 
        memset(clis, 0, sizeof(clis));
@@ -115,16 +123,25 @@
                }
 
                usleep(100000);
-               kill(clis[i], SIGUSR1);
+               kill(clis[i], thesig);
 
                apid = wait(&status);
                if (apid != clis[i])
                        errx(1, "wanted pid %d, got %d\n", clis[i], apid);
                clis[i] = 0;
                ncli--;
-               if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) {
-                       fprintf(stderr, "child died with 0x%x\n", status);
-                       exit(1);
+               if (thesig == SIGUSR1) {
+                       if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) {
+                               fprintf(stderr, "child died with 0x%x\n",
+                                   status);
+                               exit(1);
+                       }
+               } else {
+                       if (!WIFSIGNALED(status) || WTERMSIG(status) != thesig){
+                               fprintf(stderr, "child died with 0x%x\n",
+                                   status);
+                               exit(1);
+                       }
                }
        }
 



Home | Main Index | Thread Index | Old Index