[Pkg-nagios-changes] [pkg-mod-gearman] 30/48: more debug output on test errors

Stig Sandbeck Mathisen ssm at debian.org
Sun Nov 24 22:38:11 UTC 2013


This is an automated email from the git hooks/post-receive script.

ssm pushed a commit to branch master
in repository pkg-mod-gearman.

commit ec4ddf5b506199fdf537193d4dfd43db966f4640
Author: Sven Nierlein <Sven.Nierlein at consol.de>
Date:   Fri Nov 1 01:13:12 2013 +0100

    more debug output on test errors
---
 t/02-full.c | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/t/02-full.c b/t/02-full.c
index 304ba0a..31309e0 100644
--- a/t/02-full.c
+++ b/t/02-full.c
@@ -286,7 +286,6 @@ void wait_for_empty_queue(char *queue, int timeout) {
         rc = get_gearman_server_data(stats, &message, &version, "localhost", GEARMAND_TEST_PORT);
         if( rc == STATE_OK ) {
             for(x=0; x<stats->function_num;x++) {
-                //diag("%s %d %d\n", stats->function[x]->queue, stats->function[x]->waiting, stats->function[x]->running);
                 if(stats->function[x]->waiting == 0 &&
                    stats->function[x]->running == 0 &&
                    !strcmp( stats->function[x]->queue, queue )
@@ -301,6 +300,24 @@ void wait_for_empty_queue(char *queue, int timeout) {
         sleep(1);
     }
 
+    // print some debug info
+    if(tries >= timeout) {
+        stats = malloc(sizeof(mod_gm_server_status_t));
+        rc = get_gearman_server_data(stats, &message, &version, "localhost", GEARMAND_TEST_PORT);
+        diag("get_gearman_server_data:  rc: %d\n", rc);
+        diag("get_gearman_server_data: msg: %s\n", message);
+        diag("get_gearman_server_data: ver: %s\n", version);
+        if( rc == STATE_OK ) {
+            diag("%-7s % 7s % 7s\n", "queue", "waiting", "running");
+            for(x=0; x<stats->function_num;x++) {
+                diag("%-7s % 7d % 7d\n", stats->function[x]->queue, stats->function[x]->waiting, stats->function[x]->running);
+            }
+        }
+        free(message);
+        free(version);
+        free_mod_gm_status_server(stats);
+    }
+
     ok(tries < timeout, "queue %s empty after %d seconds", queue, tries);
     return;
 }
@@ -374,7 +391,7 @@ int main (int argc, char **argv, char **env) {
 
     /* wait one second and catch died procs */
     sleep(1);
-        while((chld = waitpid(-1, &status, WNOHANG)) != -1 && chld > 0) {
+    while((chld = waitpid(-1, &status, WNOHANG)) != -1 && chld > 0) {
         diag( "waitpid() %d exited with %d\n", chld, status);
         status = 0;
     }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-nagios/pkg-mod-gearman



More information about the Pkg-nagios-changes mailing list