nbd-tester-client: analyse bad data using hash function huersistic
[nbd.git] / nbd-tester-client.c
index 6145997..134652c 100644 (file)
@@ -1087,7 +1087,12 @@ int integrity_test(gchar* hostname, int port, char* name, int sock,
                                        if (checkbuf(dbuf, blkhash[blknum], blknum))
                                        {
                                                retval=-1;
-                                               snprintf(errstr, errstr_len, "Bad reply data: seq %08x", blkhash[blknum]);
+                                               snprintf(errstr, errstr_len, "Bad reply data: I wanted blk %08x, seq %08x but I got (at a guess) blk %08x, seq %08x",
+                                                        (unsigned int) blknum,
+                                                        blkhash[blknum],
+                                                        ((uint32_t *)(dbuf))[0],
+                                                        ((uint32_t *)(dbuf))[1]
+                                                        );
                                                goto err_open;
                                                
                                        }
@@ -1183,6 +1188,9 @@ int main(int argc, char**argv) {
        int testflags=0;
        testfunc test = throughput_test;
 
+       /* Ignore SIGPIPE as we want to pick up the error from write() */
+       signal (SIGPIPE, SIG_IGN);
+
        if(argc<3) {
                g_message("%d: Not enough arguments", (int)getpid());
                g_message("%d: Usage: %s <hostname> <port>", (int)getpid(), argv[0]);