All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Glass <sjg@chromium.org>
To: u-boot@lists.denx.de
Subject: [PATCH v2 05/12] display_options: Drop two spaces before the ASCII column
Date: Sat,  8 May 2021 07:00:00 -0600	[thread overview]
Message-ID: <20210508130007.1708527-4-sjg@chromium.org> (raw)
In-Reply-To: <20210508130007.1708527-1-sjg@chromium.org>

At present with print_buffer() U-Boot shows four spaces between the hex
and ASCII data. Two seems enough and matches print_hex_dump(). Change it.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

(no changes since v1)

 lib/display_options.c |  2 +-
 test/cmd/mem_search.c | 26 +++++++++++++-------------
 test/dm/rtc.c         |  6 +++---
 test/print_ut.c       | 32 ++++++++++++++++----------------
 test/ut.c             |  2 +-
 5 files changed, 34 insertions(+), 34 deletions(-)

diff --git a/lib/display_options.c b/lib/display_options.c
index cd48998b6d4..7752baba2bd 100644
--- a/lib/display_options.c
+++ b/lib/display_options.c
@@ -189,7 +189,7 @@ int print_buffer(ulong addr, const void *data, uint width, uint count,
 				lb.uc[i] = '.';
 		}
 		lb.uc[i] = '\0';
-		printf("    %s\n", lb.uc);
+		printf("  %s\n", lb.uc);
 
 		/* update references */
 		addr += thislinelen * width;
diff --git a/test/cmd/mem_search.c b/test/cmd/mem_search.c
index 94942793a49..f80c9c40687 100644
--- a/test/cmd/mem_search.c
+++ b/test/cmd/mem_search.c
@@ -30,9 +30,9 @@ static int mem_test_ms_b(struct unit_test_state *uts)
 	buf[0x100] = 0x12;
 	ut_assertok(console_record_reset_enable());
 	run_command("ms.b 1 ff 12", 0);
-	ut_assert_nextline("00000030: 00 12 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................");
+	ut_assert_nextline("00000030: 00 12 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................");
 	ut_assert_nextline("--");
-	ut_assert_nextline("000000f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 12    ................");
+	ut_assert_nextline("000000f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 12  ................");
 	ut_assert_nextline("2 matches");
 	ut_assert_console_end();
 
@@ -57,7 +57,7 @@ static int mem_test_ms_w(struct unit_test_state *uts)
 	buf[BUF_SIZE / 2] = 0x1234;
 	ut_assertok(console_record_reset_enable());
 	run_command("ms.w 0 80 1234", 0);
-	ut_assert_nextline("00000030: 0000 0000 1234 0000 0000 0000 0000 0000    ....4...........");
+	ut_assert_nextline("00000030: 0000 0000 1234 0000 0000 0000 0000 0000  ....4...........");
 	ut_assert_nextline("1 match");
 	ut_assert_console_end();
 
@@ -82,7 +82,7 @@ static int mem_test_ms_l(struct unit_test_state *uts)
 	buf[BUF_SIZE / 4] = 0x12345678;
 	ut_assertok(console_record_reset_enable());
 	run_command("ms 0 40 12345678", 0);
-	ut_assert_nextline("00000030: 00000000 00000000 12345678 00000000    ........xV4.....");
+	ut_assert_nextline("00000030: 00000000 00000000 12345678 00000000  ........xV4.....");
 	ut_assert_nextline("1 match");
 	ut_assert_console_end();
 
@@ -212,10 +212,10 @@ static int mem_test_ms_mult(struct unit_test_state *uts)
 	strcpy(buf + BUF_SIZE - strlen(str) + 1, str);
 	ut_assertok(console_record_reset_enable());
 	run_command("ms.b 0 100 68 65 6c 6c 6f", 0);
-	ut_assert_nextline("00000010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 68 65    ..............he");
-	ut_assert_nextline("00000020: 6c 6c 6f 00 00 00 00 00 00 00 00 00 00 00 00 00    llo.............");
+	ut_assert_nextline("00000010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 68 65  ..............he");
+	ut_assert_nextline("00000020: 6c 6c 6f 00 00 00 00 00 00 00 00 00 00 00 00 00  llo.............");
 	ut_assert_nextline("--");
-	ut_assert_nextline("00000060: 00 00 00 68 65 6c 6c 6f 00 00 00 00 00 00 00 00    ...hello........");
+	ut_assert_nextline("00000060: 00 00 00 68 65 6c 6c 6f 00 00 00 00 00 00 00 00  ...hello........");
 	ut_assert_nextline("2 matches");
 	ut_assert_console_end();
 	unmap_sysmem(buf);
@@ -242,12 +242,12 @@ static int mem_test_ms_s(struct unit_test_state *uts)
 	strcpy(buf + 0xa1, str2);
 	ut_assertok(console_record_reset_enable());
 	run_command("ms.s 0 100 hello", 0);
-	ut_assert_nextline("00000010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 68 65    ..............he");
-	ut_assert_nextline("00000020: 6c 6c 6f 00 00 00 00 00 00 00 00 00 00 00 00 00    llo.............");
+	ut_assert_nextline("00000010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 68 65  ..............he");
+	ut_assert_nextline("00000020: 6c 6c 6f 00 00 00 00 00 00 00 00 00 00 00 00 00  llo.............");
 	ut_assert_nextline("--");
-	ut_assert_nextline("00000060: 00 00 00 68 65 6c 6c 6f 00 00 00 00 00 00 00 00    ...hello........");
+	ut_assert_nextline("00000060: 00 00 00 68 65 6c 6c 6f 00 00 00 00 00 00 00 00  ...hello........");
 	ut_assert_nextline("--");
-	ut_assert_nextline("000000a0: 00 68 65 6c 6c 6f 74 68 65 72 65 00 00 00 00 00    .hellothere.....");
+	ut_assert_nextline("000000a0: 00 68 65 6c 6c 6f 74 68 65 72 65 00 00 00 00 00  .hellothere.....");
 	ut_assert_nextline("3 matches");
 	ut_assert_console_end();
 
@@ -257,7 +257,7 @@ static int mem_test_ms_s(struct unit_test_state *uts)
 
 	ut_assertok(console_record_reset_enable());
 	run_command("ms.s 0 100 hello there", 0);
-	ut_assert_nextline("000000a0: 00 68 65 6c 6c 6f 74 68 65 72 65 00 00 00 00 00    .hellothere.....");
+	ut_assert_nextline("000000a0: 00 68 65 6c 6c 6f 74 68 65 72 65 00 00 00 00 00  .hellothere.....");
 	ut_assert_nextline("1 match");
 	ut_assert_console_end();
 
@@ -284,7 +284,7 @@ static int mem_test_ms_limit(struct unit_test_state *uts)
 	buf[0x76] = 0x12;
 	ut_assertok(console_record_reset_enable());
 	run_command("ms.b -l2 1 ff 12", 0);
-	ut_assert_nextline("00000030: 00 12 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................");
+	ut_assert_nextline("00000030: 00 12 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................");
 	ut_assert_nextline("--");
 	ut_assert_nextlinen("00000060: 00 00 12 00 00 00 00 00 00 00 00 00 00 00 00 00");
 	ut_assert_nextline("2 matches (repeat command to check for more)");
diff --git a/test/dm/rtc.c b/test/dm/rtc.c
index 8ab997c87d1..c7f9f8f0ce7 100644
--- a/test/dm/rtc.c
+++ b/test/dm/rtc.c
@@ -204,7 +204,7 @@ static int dm_test_rtc_cmd_rw(struct unit_test_state *uts)
 	ut_assert_console_end();
 
 	run_command("rtc read 0x30 2", 0);
-	ut_assert_nextline("00000030: aa bb                                              ..");
+	ut_assert_nextline("00000030: aa bb                                            ..");
 	ut_assert_console_end();
 
 	run_command("rtc dev 1", 0);
@@ -215,7 +215,7 @@ static int dm_test_rtc_cmd_rw(struct unit_test_state *uts)
 	ut_assert_console_end();
 
 	run_command("rtc read 0x30 2", 0);
-	ut_assert_nextline("00000030: cc dd                                              ..");
+	ut_assert_nextline("00000030: cc dd                                            ..");
 	ut_assert_console_end();
 
 	/*
@@ -227,7 +227,7 @@ static int dm_test_rtc_cmd_rw(struct unit_test_state *uts)
 	ut_assert_console_end();
 
 	run_command("rtc read 0x30 2", 0);
-	ut_assert_nextline("00000030: aa bb                                              ..");
+	ut_assert_nextline("00000030: aa bb                                            ..");
 	ut_assert_console_end();
 
 	return 0;
diff --git a/test/print_ut.c b/test/print_ut.c
index b4dc902d0de..9562db6ec3c 100644
--- a/test/print_ut.c
+++ b/test/print_ut.c
@@ -161,52 +161,52 @@ static int print_display_buffer(struct unit_test_state *uts)
 	/* bytes */
 	console_record_reset();
 	print_buffer(0, buf, 1, 0x12, 0);
-	ut_assert_nextline("00000000: 00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff    ..\"3DUfw........");
-	ut_assert_nextline("00000010: 10 00                                              ..");
+	ut_assert_nextline("00000000: 00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff  ..\"3DUfw........");
+	ut_assert_nextline("00000010: 10 00                                            ..");
 	ut_assert_console_end();
 
 	/* line length */
 	console_record_reset();
 	print_buffer(0, buf, 1, 0x12, 8);
-	ut_assert_nextline("00000000: 00 11 22 33 44 55 66 77    ..\"3DUfw");
-	ut_assert_nextline("00000008: 88 99 aa bb cc dd ee ff    ........");
-	ut_assert_nextline("00000010: 10 00                      ..");
+	ut_assert_nextline("00000000: 00 11 22 33 44 55 66 77  ..\"3DUfw");
+	ut_assert_nextline("00000008: 88 99 aa bb cc dd ee ff  ........");
+	ut_assert_nextline("00000010: 10 00                    ..");
 	ut_assert_console_end();
 
 	/* long line */
 	console_record_reset();
 	buf[0x41] = 0x41;
 	print_buffer(0, buf, 1, 0x42, 0x40);
-	ut_assert_nextline("00000000: 00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ..\"3DUfw........................................................");
-	ut_assert_nextline("00000040: 00 41                                                                                                                                                                                              .A");
+	ut_assert_nextline("00000000: 00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ..\"3DUfw........................................................");
+	ut_assert_nextline("00000040: 00 41                                                                                                                                                                                            .A");
 	ut_assert_console_end();
 
 	/* address */
 	console_record_reset();
 	print_buffer(0x12345678, buf, 1, 0x12, 0);
-	ut_assert_nextline("12345678: 00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff    ..\"3DUfw........");
-	ut_assert_nextline("12345688: 10 00                                              ..");
+	ut_assert_nextline("12345678: 00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff  ..\"3DUfw........");
+	ut_assert_nextline("12345688: 10 00                                            ..");
 	ut_assert_console_end();
 
 	/* 16-bit */
 	console_record_reset();
 	print_buffer(0, buf, 2, 9, 0);
-	ut_assert_nextline("00000000: 1100 3322 5544 7766 9988 bbaa ddcc ffee    ..\"3DUfw........");
-	ut_assert_nextline("00000010: 0010                                       ..");
+	ut_assert_nextline("00000000: 1100 3322 5544 7766 9988 bbaa ddcc ffee  ..\"3DUfw........");
+	ut_assert_nextline("00000010: 0010                                     ..");
 	ut_assert_console_end();
 
 	/* 32-bit */
 	console_record_reset();
 	print_buffer(0, buf, 4, 5, 0);
-	ut_assert_nextline("00000000: 33221100 77665544 bbaa9988 ffeeddcc    ..\"3DUfw........");
-	ut_assert_nextline("00000010: 00000010                               ....");
+	ut_assert_nextline("00000000: 33221100 77665544 bbaa9988 ffeeddcc  ..\"3DUfw........");
+	ut_assert_nextline("00000010: 00000010                             ....");
 	ut_assert_console_end();
 
 	/* 64-bit */
 	console_record_reset();
 	print_buffer(0, buf, 8, 3, 0);
-	ut_assert_nextline("00000000: 7766554433221100 ffeeddccbbaa9988    ..\"3DUfw........");
-	ut_assert_nextline("00000010: 0000000000000010                     ........");
+	ut_assert_nextline("00000000: 7766554433221100 ffeeddccbbaa9988  ..\"3DUfw........");
+	ut_assert_nextline("00000010: 0000000000000010                   ........");
 	ut_assert_console_end();
 
 	/* ASCII */
@@ -218,7 +218,7 @@ static int print_display_buffer(struct unit_test_state *uts)
 		buf[4 + i] = 126 + i;
 	buf[8] = 255;
 	print_buffer(0, buf, 1, 10, 0);
-	ut_assert_nextline("00000000: 00 1f 20 21 7e 7f 80 81 ff 99                      .. !~.....");
+	ut_assert_nextline("00000000: 00 1f 20 21 7e 7f 80 81 ff 99                    .. !~.....");
 	ut_assert_console_end();
 
 	unmap_sysmem(buf);
diff --git a/test/ut.c b/test/ut.c
index 350509a2926..1eec2a57dff 100644
--- a/test/ut.c
+++ b/test/ut.c
@@ -151,7 +151,7 @@ int ut_check_console_dump(struct unit_test_state *uts, int total_bytes)
 		if (str[8] != ':' || str[9] != ' ')
 			return 1;
 
-		bytes = len - 8 - 2 - 3 * 16 - 4;
+		bytes = len - 8 - 2 - 3 * 16 - 2;
 		upto += bytes;
 	}
 
-- 
2.31.1.607.g51e8a6a459-goog

  parent reply	other threads:[~2021-05-08 13:00 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-08 12:59 [PATCH v2 00/12] display_options: Start to unify print_buffer() and hexdump Simon Glass
2021-05-08 12:59 ` [PATCH v2 01/12] console: Report an error when output buffer is exhausted Simon Glass
2021-05-08 12:59 ` [PATCH v2 02/12] test: Detect when expect_str is too small Simon Glass
2021-05-08 12:59 ` [PATCH v2 03/12] test: Convert print tests to use ut framework Simon Glass
2021-05-08 12:59 ` [PATCH v2 04/12] test: Add a test for print_buffer() Simon Glass
2021-05-08 13:00 ` Simon Glass [this message]
2021-05-08 13:00 ` [PATCH v2 06/12] hexdump: Move API to header file Simon Glass
2021-05-08 13:00 ` [PATCH v2 07/12] hexdump: Add support for sandbox Simon Glass
2021-05-08 13:00 ` [PATCH v2 08/12] hexdump: Support any rowsize Simon Glass
2021-05-08 13:00 ` [PATCH v2 09/12] hexdump: Allow ctrl-c to interrupt output Simon Glass
2021-05-08 13:00 ` [PATCH v2 10/12] display_options: Split print_buffer() into two functions Simon Glass
2021-05-08 13:00 ` [PATCH v2 11/12] log: Add support for logging a buffer Simon Glass
2021-05-08 13:00 ` [PATCH v2 12/12] RFC: display_options: Use print_hex_dump() for print_buffer() Simon Glass
2021-06-08 21:43 ` [PATCH v2 00/12] display_options: Start to unify print_buffer() and hexdump Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210508130007.1708527-4-sjg@chromium.org \
    --to=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.