From 7e99fb3aae6e1df35dc1dce51056b02ff8648ce8 Mon Sep 17 00:00:00 2001 From: John Safranek Date: Mon, 10 Oct 2022 10:50:50 -0700 Subject: [PATCH] API Test Fix The echoserver will check the return on the shutdown function for success and socket error. Socket error is for the peer already having shut down their socket. This is mapped back to success so it shuts down cleanly. Add this behavior to the API test client in the test for SFTP recv read command test. --- tests/api.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/api.c b/tests/api.c index 5bc47735..cb3f0ff2 100644 --- a/tests/api.c +++ b/tests/api.c @@ -938,7 +938,13 @@ static void test_wolfSSH_SFTP_SendReadPacket(void) } } - AssertIntEQ(wolfSSH_shutdown(ssh), WS_SUCCESS); + argsCount = wolfSSH_shutdown(ssh); + if (argsCount == WS_SOCKET_ERROR_E) { + /* If the socket is closed on shutdown, peer is gone, this is OK. */ + argsCount = WS_SUCCESS; + } + AssertIntEQ(argsCount, WS_SUCCESS); + wolfSSH_free(ssh); wolfSSH_CTX_free(ctx); ThreadJoin(serThread);