From 88ae69f3b7efaa8de5c9d5d50081d6bf83e77ae9 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Thu, 22 Aug 2024 07:57:47 -0600 Subject: test: Fail when an empty line is expected but not present The existing implementation of ut_assert_nextline_empty() cannot distinguish between an empty line and no line at all. It can in fact be called at the end of the recorded output and will happily return success. Adjust the logic so that this condition is detected. Show a failure message in this case. Fix the one test which falls foul of this fix. Signed-off-by: Simon Glass Fixes: 400175b0a7d ("test: Add a way to check each line of console...") Reviewed-by: Mattijs Korpershoek --- common/console.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'common') diff --git a/common/console.c b/common/console.c index 63f78004fdb..85f627297ed 100644 --- a/common/console.c +++ b/common/console.c @@ -845,6 +845,8 @@ int console_record_readline(char *str, int maxlen) { 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); -- cgit v1.3.1