summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Vladimir Marko <vmarko@google.com> 2018-04-12 10:08:58 +0100
committer Vladimir Marko <vmarko@google.com> 2018-04-12 10:10:09 +0100
commit3f4a0bc6a7d824e9da8ffbd2745f6856abaa8306 (patch)
tree09fb1283dcf61560df88d204a2674aae7352ea26
parent6c3533991522d036cbb5a656c44f63bf633a2925 (diff)
Add extra output when patchoat_test fails.
Print up to 16 bytes of the data from the first difference. Test: m test-art-host-gtest-patchoat_test Bug: 70918261 Change-Id: Icd0247c3a745bfca0bc9745c8756452cd9b89feb
-rw-r--r--patchoat/patchoat_test.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/patchoat/patchoat_test.cc b/patchoat/patchoat_test.cc
index 974ed3217d..69728ae051 100644
--- a/patchoat/patchoat_test.cc
+++ b/patchoat/patchoat_test.cc
@@ -24,6 +24,7 @@
#include "android-base/stringprintf.h"
#include "android-base/strings.h"
+#include "base/hex_dump.h"
#include "base/leb128.h"
#include "dexopt_test.h"
#include "runtime.h"
@@ -320,6 +321,12 @@ class PatchoatTest : public DexoptTest {
if (image1[i] != image2[i]) {
*error_msg =
StringPrintf("%s and %s differ at offset %zu", filename1.c_str(), filename2.c_str(), i);
+ size_t hexdump_size = std::min<size_t>(16u, size - i);
+ HexDump dump1(&image1[i], hexdump_size, /* show_actual_addresses */ false, /* prefix */ "");
+ HexDump dump2(&image2[i], hexdump_size, /* show_actual_addresses */ false, /* prefix */ "");
+ std::ostringstream oss;
+ oss << "\n" << dump1 << "\n" << dump2;
+ *error_msg += oss.str();
return true;
}
}