{
if (gd->flags & GD_FLG_RECORD_OVF)
return -ENOSPC;
+ if (console_record_isempty())
+ return -ENOENT;
return membuff_readline((struct membuff *)&gd->console_out, str,
maxlen, '\0', false);
* @str: Place to put string
* @maxlen: Maximum length of @str including nul terminator
* Return: length of string returned, or -ENOSPC if the console buffer was
- * overflowed by the output
+ * overflowed by the output, or -ENOENT if there was nothing to read
*/
int console_record_readline(char *str, int maxlen);
ut_asserteq(0, run_command("bootflow cmdline set mary abc", 0));
ut_asserteq(0, run_command("bootflow cmdline set mary", 0));
- ut_assert_nextline_empty();
-
ut_assert_console_end();
return 0;
ut_fail(uts, __FILE__, __LINE__, __func__,
"Console record buffer too small - increase CONFIG_CONSOLE_RECORD_OUT_SIZE");
return ret;
+ } else if (ret == -ENOENT) {
+ strcpy(uts->actual_str, "<no-more-output>");
}
- return 0;
+ return ret;
}
int ut_check_console_line(struct unit_test_state *uts, const char *fmt, ...)
return -EOVERFLOW;
}
ret = readline_check(uts);
- if (ret < 0)
- return ret;
+ if (ret == -ENOENT)
+ return 1;
return strcmp(uts->expect_str, uts->actual_str);
}