+MEM_TEST(mem_test_ms_cont, UT_TESTF_CONSOLE_REC);
+
+/* Test that an 'ms' command with continuation stops at the end of the range */
+static int mem_test_ms_cont_end(struct unit_test_state *uts)
+{
+ char *const args[] = {"ms.b", "1", "ff", "12"};
+ int repeatable;
+ u8 *buf;
+
+ buf = map_sysmem(0, BUF_SIZE);
+ memset(buf, '\0', BUF_SIZE);
+ buf[0x0] = 0x12;
+ buf[0x31] = 0x12;
+ buf[0xff] = 0x12;
+ buf[0x100] = 0x12;
+ ut_assertok(console_record_reset_enable());
+ run_command("ms.b 1 ff 12", 0);
+ ut_assert_nextlinen("00000030");
+ ut_assert_nextlinen("--");
+ ut_assert_nextlinen("000000f0");
+ ut_assert_nextlinen("2 matches");
+ ut_assert_console_end();
+
+ /*
+ * run_command() ignoes the repeatable flag when using hush, so call
+ * cmd_process() directly.
+ *
+ * This should produce no matches.
+ */
+ ut_assertok(console_record_reset_enable());
+ cmd_process(CMD_FLAG_REPEAT, 4, args, &repeatable, NULL);
+ ut_assert_nextlinen("0 matches");
+ ut_assert_console_end();
+
+ /* One more time */
+ ut_assertok(console_record_reset_enable());
+ cmd_process(CMD_FLAG_REPEAT, 4, args, &repeatable, NULL);
+ ut_assert_nextlinen("0 matches");
+ ut_assert_console_end();
+
+ unmap_sysmem(buf);
+
+ return 0;
+}
+MEM_TEST(mem_test_ms_cont_end, UT_TESTF_CONSOLE_REC);