From 5655dc58a995a043316c35b1114f84bdbf3da78c Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Fri, 20 Dec 2019 12:36:59 +0100 Subject: executor: make syz_compare output more handy to use --- executor/common_test.h | 17 +++++++++-------- pkg/csource/generated.go | 17 +++++++++-------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/executor/common_test.h b/executor/common_test.h index d06cf5bd7..ebbff1517 100644 --- a/executor/common_test.h +++ b/executor/common_test.h @@ -44,20 +44,21 @@ static long syz_exit(volatile long status) static long syz_compare(volatile long want, volatile long want_len, volatile long got, volatile long got_len) { if (want_len != got_len) { - debug("syz_compare: want_len=%lu got_len=%lu data:\n", want_len, got_len); - debug_dump_data((char*)got, got_len); errno = EBADF; - return -1; + goto error; } if (memcmp((void*)want, (void*)got, want_len)) { - debug("syz_compare: data differs, want:\n"); - debug_dump_data((char*)want, want_len); - debug("got:\n"); - debug_dump_data((char*)got, got_len); errno = EINVAL; - return -1; + goto error; } return 0; + +error: + debug("syz_compare: want (%lu):\n", want_len); + debug_dump_data((char*)want, want_len); + debug("got (%lu):\n", got_len); + debug_dump_data((char*)got, got_len); + return -1; } #endif diff --git a/pkg/csource/generated.go b/pkg/csource/generated.go index 6a360746c..074b7bcb0 100644 --- a/pkg/csource/generated.go +++ b/pkg/csource/generated.go @@ -6026,20 +6026,21 @@ static long syz_exit(volatile long status) static long syz_compare(volatile long want, volatile long want_len, volatile long got, volatile long got_len) { if (want_len != got_len) { - debug("syz_compare: want_len=%lu got_len=%lu data:\n", want_len, got_len); - debug_dump_data((char*)got, got_len); errno = EBADF; - return -1; + goto error; } if (memcmp((void*)want, (void*)got, want_len)) { - debug("syz_compare: data differs, want:\n"); - debug_dump_data((char*)want, want_len); - debug("got:\n"); - debug_dump_data((char*)got, got_len); errno = EINVAL; - return -1; + goto error; } return 0; + +error: + debug("syz_compare: want (%lu):\n", want_len); + debug_dump_data((char*)want, want_len); + debug("got (%lu):\n", got_len); + debug_dump_data((char*)got, got_len); + return -1; } #endif -- cgit mrf-deployment