Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/lib/librumpclient As a debugging measure for PR 49141, ...



details:   https://anonhg.NetBSD.org/src/rev/4aa5ab2db4e9
branches:  trunk
changeset: 349039:4aa5ab2db4e9
user:      dholland <dholland%NetBSD.org@localhost>
date:      Mon Nov 21 06:38:18 2016 +0000

description:
As a debugging measure for PR 49141, log what this is doing as it runs
to stdout. Hopefully this will get reported when the test fails in the
testbed rather than just causing ATF to report that it printed
unexpected output.

diffstat:

 tests/lib/librumpclient/h_execthr.c |  31 +++++++++++++++++++++++++++++--
 1 files changed, 29 insertions(+), 2 deletions(-)

diffs (115 lines):

diff -r cba4b5f4c1e5 -r 4aa5ab2db4e9 tests/lib/librumpclient/h_execthr.c
--- a/tests/lib/librumpclient/h_execthr.c       Mon Nov 21 06:19:26 2016 +0000
+++ b/tests/lib/librumpclient/h_execthr.c       Mon Nov 21 06:38:18 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: h_execthr.c,v 1.5 2016/11/21 06:19:26 dholland Exp $   */
+/*     $NetBSD: h_execthr.c,v 1.6 2016/11/21 06:38:18 dholland Exp $   */
 
 /*
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -42,6 +42,14 @@
 #include <rump/rumpclient.h>
 #include <rump/rump_syscalls.h>
 
+#define VERBOSE
+
+#ifdef VERBOSE
+#define SAY(...) printf(__VA_ARGS__)
+#else
+#define SAY(...)
+#endif
+
 static int canreturn = 0;
 
 /*
@@ -103,6 +111,7 @@
        else
                execd = 0;
        sprintf(nexec, "%d", execd+1);
+       SAY("execd: %d\n", execd);
 
        if (rumpclient_init() == -1) {
                if (execd)
@@ -111,6 +120,7 @@
                        err(1, "init");
        }
        mypid = rump_sys_getpid();
+       SAY("rumpclient_init finished.\n");
 
        if (execd) {
                canreturn = 1;
@@ -118,27 +128,35 @@
                    wrk, (void *)(uintptr_t)P2_0);
                if (errno != 0)
                        err(1, "exec pthread_create");
+               SAY("startup pthread_create finished.\n");
 
                i = 37;
                rump_sys_write(P2_1, &i, sizeof(i));
                pthread_join(pt, NULL);
+               SAY("startup pthread_join finished.\n");
 
                n = rump_sys_read(P1_0, &i, sizeof(i));
                if (n != -1 || errno != EBADF)
                        errx(1, "post-exec cloexec works");
+               SAY("startup rump_sys_read finished.\n");
 
                getproc(mypid, &p);
+               SAY("startup getproc finished.\n");
                if (p.p_nlwps != 2)
                        errx(1, "invalid nlwps: %lld", (long long)p.p_nlwps);
 
                /* we passed? */
-               if (execd > 10)
+               if (execd > 10) {
+                       SAY("done.\n");
                        exit(0);
+               }
 
                rump_sys_close(P2_0);
                rump_sys_close(P2_1);
        }
 
+       SAY("making pipes...\n");
+
        if (rump_sys_pipe(p1) == -1)
                err(1, "pipe1");
        if (p1[0] != P1_0 || p1[1] != P1_1)
@@ -152,6 +170,8 @@
        if (rump_sys_fcntl(p1[1], F_SETFD, FD_CLOEXEC) == -1)
                err(1, "cloexec");
 
+       SAY("making threads...\n");
+
        for (i = 0; i < NTHR; i++) {
                errno = pthread_create(&pt, NULL,
                    wrk, (void *)(uintptr_t)p1[0]);
@@ -166,14 +186,19 @@
                        err(1, "pthread_create 2 %d", i);
        }
 
+       SAY("waiting for threads to start...\n");
+
        /* wait for all the threads to be enjoying themselves */
        for (;;) {
                getproc(mypid, &p);
+               SAY("getproc finished.\n");
                if (p.p_nlwps == 2*NTHR + 2)
                        break;
                usleep(10000);
        }
 
+       SAY("making some more threads start...\n");
+
        /*
         * load up one more (big) set.  these won't start executing, though,
         * but we're interested in if they create blockage
@@ -185,6 +210,8 @@
                        err(1, "pthread_create 3 %d", i);
        }
 
+       SAY("calling exec...\n");
+
        /* then, we exec! */
        execarg[0] = argv[0];
        execarg[1] = nexec;



Home | Main Index | Thread Index | Old Index