Module Name:    src
Committed By:   dholland
Date:           Mon Nov 21 06:38:18 UTC 2016

Modified Files:
        src/tests/lib/librumpclient: h_execthr.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/lib/librumpclient/h_execthr.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/lib/librumpclient/h_execthr.c
diff -u src/tests/lib/librumpclient/h_execthr.c:1.5 src/tests/lib/librumpclient/h_execthr.c:1.6
--- src/tests/lib/librumpclient/h_execthr.c:1.5	Mon Nov 21 06:19:26 2016
+++ src/tests/lib/librumpclient/h_execthr.c	Mon Nov 21 06:38:18 2016
@@ -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 @@ main(int argc, char *argv[], char *envp[
 	else
 		execd = 0;
 	sprintf(nexec, "%d", execd+1);
+	SAY("execd: %d\n", execd);
 
 	if (rumpclient_init() == -1) {
 		if (execd)
@@ -111,6 +120,7 @@ main(int argc, char *argv[], char *envp[
 			err(1, "init");
 	}
 	mypid = rump_sys_getpid();
+	SAY("rumpclient_init finished.\n");
 
 	if (execd) {
 		canreturn = 1;
@@ -118,27 +128,35 @@ main(int argc, char *argv[], char *envp[
 		    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 @@ main(int argc, char *argv[], char *envp[
 	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 @@ main(int argc, char *argv[], char *envp[
 			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 @@ main(int argc, char *argv[], char *envp[
 			err(1, "pthread_create 3 %d", i);
 	}
 
+	SAY("calling exec...\n");
+
 	/* then, we exec! */
 	execarg[0] = argv[0];
 	execarg[1] = nexec;

Reply via email to