1
0
mirror of https://github.com/libssh2/libssh2.git synced 2025-07-28 01:41:49 +03:00

test_auth_keyboard_info_request: fix to return failure

Before this patch, this test returned success even when one of its tests
failed. Fix it by returning 1 in case any of the tests fails.

This issue masked a CMake build bug with logging enabled. Subject to an
upcoming patch.

Cherry-picked from #1037
This commit is contained in:
Viktor Szakats
2023-05-08 00:38:30 +00:00
parent 731e74e26b
commit 84d31d0ca7

View File

@ -302,25 +302,28 @@ int test_case(int num,
int main(void)
{
int ret = 0;
int i;
for(i = 0; i < TEST_CASES_LEN; i++) {
test_case(i + 1,
test_cases[i].data,
test_cases[i].data_len,
NULL,
test_cases[i].expected);
if(test_case(i + 1,
test_cases[i].data,
test_cases[i].data_len,
NULL,
test_cases[i].expected))
ret = 1;
}
for(i = 0; i < FAILED_MALLOC_TEST_CASES_LEN; i++) {
int tc = i + TEST_CASES_LEN + 1;
int malloc_call_num = 3 + i;
test_case(tc,
failed_malloc_test_cases[i].data,
failed_malloc_test_cases[i].data_len,
&malloc_call_num,
failed_malloc_test_cases[i].expected);
if(test_case(tc,
failed_malloc_test_cases[i].data,
failed_malloc_test_cases[i].data_len,
&malloc_call_num,
failed_malloc_test_cases[i].expected))
ret = 1;
}
return 0;
return ret;
}