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

bbcombotest patch



bbcombotest in 4.4.0 (probably 4.3.0 too) was failing for me with the
error:
Could not access hobbitd board, error 0

I found that line:
if ((hobbitdresult != BB_OK) || (board == NULL)) {
always evaled true due to board being set to NULL  at the start of the
function and then never being set again.

Also I didn't like that a yellow status didn't trip the combo test
color, so that is the last part.

So here is a patch:

Index: bbcombotest.c
===================================================================
--- bbcombotest.c       (revision 6223)
+++ bbcombotest.c       (working copy)
@@ -209,20 +209,16 @@
        int result = COL_CLEAR;
        char *pattern, *found, *colstr;

-       if (board == NULL) {
                sendreturn_t *sres = newsendreturnbuf(1, NULL);

                hobbitdresult = sendmessage("hobbitdboard
fields=hostname,testname,color", NULL, BBTALK_TIMEOUT, sres);
+    board = getsendreturnstr(sres, 1);
                if ((hobbitdresult != BB_OK) || (board == NULL)) {
                        board = "";
                        *errptr += sprintf(*errptr, "Could not access
hobbitd board, error %d\n", hobbitdresult);
                        return COL_CLEAR;
                }
-               else {
-                       board = getsendreturnstr(sres, 1);
-               }
                freesendreturnbuf(sres);
-       }

        pattern = (char *)malloc(1 + strlen(hostname) + 1 +
strlen(testname) + 1 + 1);
        sprintf(pattern, "\n%s|%s|", hostname, testname);
@@ -275,7 +271,7 @@
        }

        if (*color == -1) return -1;
-       else return ( (*color == COL_GREEN) || (*color == COL_YELLOW) ||
(*color == COL_CLEAR) );
+       else return ( (*color == COL_GREEN) || (*color == COL_CLEAR) );
 }