Skip to content

Commit

Permalink
Merge pull request #1826 from jimklimov/zproc-selftest-delay
Browse files Browse the repository at this point in the history
Problem: zproc selftest too verbose by default now
  • Loading branch information
jimklimov authored Dec 28, 2017
2 parents d319778 + 0aff6a6 commit 5c5a73c
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions src/zproc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1065,15 +1065,17 @@ zproc_test (bool verbose)

// execute the binary. It runs in own actor, which monitor the process and
// pass data accross pipes and zeromq sockets
zsys_debug("zproc_test() : launching helper '%s'", file );
if (verbose)
zsys_debug("zproc_test() : launching helper '%s'", file );
zproc_run (self);
zpoller_t *poller = zpoller_new (zproc_stdout (self), NULL);

// kill the binary, it never ends, but the test must:
// termination also flushes the output streams so we can
// read them entirely; note that other process runs in
// parallel to this thread
zsys_debug("zproc_test() : sleeping 4000 msec to gather some output from helper");
if (verbose)
zsys_debug("zproc_test() : sleeping 4000 msec to gather some output from helper");
zclock_sleep (4000);
zproc_kill (self, SIGTERM);
zproc_wait (self, true);
Expand All @@ -1090,15 +1092,18 @@ zproc_test (bool verbose)

if (!which) {
if (stdout_read) {
zsys_debug("zproc_test() : did not get stdout from helper, but we already have some (%" PRIi64 " msec remaining to retry)", (zproc_timeout_msec - zproc_test_elapsed_msec) );
if (verbose)
zsys_debug("zproc_test() : did not get stdout from helper, but we already have some (%" PRIi64 " msec remaining to retry)", (zproc_timeout_msec - zproc_test_elapsed_msec) );
break;
}
if (zproc_timeout_msec > zproc_test_elapsed_msec) {
zsys_debug("zproc_test() : did not get stdout from helper, %" PRIi64 " msec remaining to retry", (zproc_timeout_msec - zproc_test_elapsed_msec) );
if (verbose)
zsys_debug("zproc_test() : did not get stdout from helper, %" PRIi64 " msec remaining to retry", (zproc_timeout_msec - zproc_test_elapsed_msec) );
continue;
}
// ...else : we've slept a lot and got no response; kill the helper
zsys_debug("zproc_test() : did not get stdout from helper, patience expired (%" PRIi64 " msec remaining to retry)", (zproc_timeout_msec - zproc_test_elapsed_msec) );
if (verbose)
zsys_debug("zproc_test() : did not get stdout from helper, patience expired (%" PRIi64 " msec remaining to retry)", (zproc_timeout_msec - zproc_test_elapsed_msec) );
break;
}

Expand All @@ -1112,7 +1117,8 @@ zproc_test (bool verbose)
assert (frame);
assert (zframe_data (frame));
if (!stdout_read) {
zsys_debug("zproc_test() : got stdout from helper, %" PRIi64 " msec was remaining to retry", (zproc_timeout_msec - zproc_test_elapsed_msec));
if (verbose)
zsys_debug("zproc_test() : got stdout from helper, %" PRIi64 " msec was remaining to retry", (zproc_timeout_msec - zproc_test_elapsed_msec));
assert (!strncmp(
"czmq is great\n",
(char*) zframe_data (frame),
Expand All @@ -1128,7 +1134,8 @@ zproc_test (bool verbose)
}

// should not get there
zsys_debug("zproc_test() : reached the unreachable point (unexpected zpoller result), %" PRIi64 " msec was remaining to retry", (zproc_timeout_msec - zproc_test_elapsed_msec) );
if (verbose)
zsys_debug("zproc_test() : reached the unreachable point (unexpected zpoller result), %" PRIi64 " msec was remaining to retry", (zproc_timeout_msec - zproc_test_elapsed_msec) );
assert (false);
}

Expand Down

0 comments on commit 5c5a73c

Please sign in to comment.