From: Heinrich Schuchardt Date: Sat, 16 Nov 2024 20:08:22 +0000 (+0100) Subject: test: cmd/hash: check return value of ut_check_console_line X-Git-Url: http://git.dujemihanovic.xyz/img/static/%7B%7B%20%24.Site.BaseURL%20%7D%7Dposts/%7B%7B%20%24style.RelPermalink%20%7D%7D?a=commitdiff_plain;h=3d0da87cd4020f9e14a249c0e080341d668d9426;p=u-boot.git test: cmd/hash: check return value of ut_check_console_line ut_check_console_line() does include an assert. Pass the result to ut_assertok(). Addresses-Coverity-ID: 514958 Error handling issues Fixes: 7dfafcd65ef3 ("test: unit test for hash command") Signed-off-by: Heinrich Schuchardt --- diff --git a/test/cmd/hash.c b/test/cmd/hash.c index 2fcec9cadc..296dd762b3 100644 --- a/test/cmd/hash.c +++ b/test/cmd/hash.c @@ -33,11 +33,13 @@ static int dm_test_cmd_hash_md5(struct unit_test_state *uts) strstr(uts->actual_str, "md5 for ")); ut_assert(strstr(uts->actual_str, "d41d8cd98f00b204e9800998ecf8427e")); - ut_check_console_line(uts, "d41d8cd98f00b204e9800998ecf8427e"); + ut_assertok(ut_check_console_line(uts, + "d41d8cd98f00b204e9800998ecf8427e")); if (!CONFIG_IS_ENABLED(HASH_VERIFY)) { ut_assert(run_command("hash -v sha256 $loadaddr 0 foo", 0)); - ut_check_console_line(uts, "hash - compute hash message digest"); + ut_assertok(ut_check_console_line( + uts, "hash - compute hash message digest")); return 0; } @@ -77,12 +79,13 @@ static int dm_test_cmd_hash_sha256(struct unit_test_state *uts) strstr(uts->actual_str, "sha256 for ")); ut_assert(strstr(uts->actual_str, "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855")); - ut_check_console_line(uts, - "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"); + ut_assertok(ut_check_console_line( + uts, "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855")); if (!CONFIG_IS_ENABLED(HASH_VERIFY)) { ut_assert(run_command("hash -v sha256 $loadaddr 0 foo", 0)); - ut_check_console_line(uts, "hash - compute hash message digest"); + ut_assertok(ut_check_console_line( + uts, "hash - compute hash message digest")); return 0; }