aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2023-05-02 13:08:11 -0700
committerZorro Lang <zlang@kernel.org>2023-05-14 21:48:06 +0800
commit8c5f19b701eae8c9a255ed51cd12ad18c88259fa (patch)
tree26d698cc714f187d3e42866079b338c78249e59d
parente35817daa103d6c8dd670fc0acef7f2247e10a9f (diff)
downloadxfstests-dev-8c5f19b701eae8c9a255ed51cd12ad18c88259fa.tar.gz
fsx: fix indenting of columns in bad buffers report
When file corruption is detected, make the columns of the report line up correctly even in the diff output. Although the .out.bad file contains this (with spaces to demonstrate unequivocally what happens when tabs are formatted as 8-column indent): OFFSET GOOD BAD RANGE 0x2c000 0x0000 0xd6c1 0x00000 diffing the good and bad golden output yields poorly formatted output: +OFFSET GOOD BAD RANGE +0x2c000 0x0000 0xd6c1 0x00000 Replace the tabs with columns indented with printf width specifiers so that the test output gets this: OFFSET GOOD BAD RANGE 0x2c000 0x0000 0xd6c1 0x0 ...which always lines up the columns regardless of the user's tab display settings or diff inserting plus signs. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Zorro Lang <zlang@redhat.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
-rw-r--r--ltp/fsx.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/ltp/fsx.c b/ltp/fsx.c
index c76b06ca76..ffa64cfa00 100644
--- a/ltp/fsx.c
+++ b/ltp/fsx.c
@@ -669,17 +669,18 @@ check_buffers(char *buf, unsigned offset, unsigned size)
if (memcmp(good_buf + offset, buf, size) != 0) {
prt("READ BAD DATA: offset = 0x%x, size = 0x%x, fname = %s\n",
offset, size, fname);
- prt("OFFSET\tGOOD\tBAD\tRANGE\n");
+ prt("%-10s %-6s %-6s %s\n", "OFFSET", "GOOD", "BAD", "RANGE");
while (size > 0) {
c = good_buf[offset];
t = buf[i];
if (c != t) {
if (n < 16) {
bad = short_at(&buf[i]);
- prt("0x%05x\t0x%04x\t0x%04x", offset,
- short_at(&good_buf[offset]), bad);
+ prt("0x%-8x 0x%04x 0x%04x 0x%x\n",
+ offset,
+ short_at(&good_buf[offset]), bad,
+ n);
op = buf[offset & 1 ? i+1 : i];
- prt("\t0x%05x\n", n);
if (op)
prt("operation# (mod 256) for "
"the bad data may be %u\n",