diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2018-05-12 09:04:28 +0200 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2018-05-12 09:04:28 +0200 |
commit | 9f69c8576b636616aac8f4d212c3d59c0412220f (patch) | |
tree | b72f4ca3cc31c47a0400187be9fdb78986ea9107 | |
parent | b49bfde8cf4d9dc10a365da4a7dddd904718b4eb (diff) | |
download | gnutls-9f69c8576b636616aac8f4d212c3d59c0412220f.tar.gz |
tests: fix failures in cxx example
Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
-rw-r--r-- | tests/sanity-cpp.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/tests/sanity-cpp.cpp b/tests/sanity-cpp.cpp index 70f9e55d9b..c477629db8 100644 --- a/tests/sanity-cpp.cpp +++ b/tests/sanity-cpp.cpp @@ -150,6 +150,7 @@ static void test_handshake(void **glob_state, const char *prio, } catch (std::exception &ex) { std::cerr << "Exception caught: " << ex.what() << std::endl; + fail(); } sret = cret = GNUTLS_E_AGAIN; @@ -159,7 +160,8 @@ static void test_handshake(void **glob_state, const char *prio, try { cret = client.handshake(); } catch(gnutls::exception &ex) { - if (ex.get_code() == GNUTLS_E_INTERRUPTED || ex.get_code() == GNUTLS_E_AGAIN) + cret = ex.get_code(); + if (cret == GNUTLS_E_INTERRUPTED || cret == GNUTLS_E_AGAIN) cret = GNUTLS_E_AGAIN; } } @@ -167,7 +169,8 @@ static void test_handshake(void **glob_state, const char *prio, try { sret = server.handshake(); } catch(gnutls::exception &ex) { - if (ex.get_code() == GNUTLS_E_INTERRUPTED || ex.get_code() == GNUTLS_E_AGAIN) + sret = ex.get_code(); + if (sret == GNUTLS_E_INTERRUPTED || sret == GNUTLS_E_AGAIN) sret = GNUTLS_E_AGAIN; } } @@ -175,6 +178,10 @@ static void test_handshake(void **glob_state, const char *prio, while ((cret == GNUTLS_E_AGAIN || (cret == 0 && sret == GNUTLS_E_AGAIN)) && (sret == GNUTLS_E_AGAIN || (sret == 0 && cret == GNUTLS_E_AGAIN))); + if (sret < 0 || cret < 0) { + fail(); + } + try { client.send(MSG, sizeof(MSG)-1); ret = server.recv(buffer, sizeof(buffer)); @@ -187,6 +194,7 @@ static void test_handshake(void **glob_state, const char *prio, } catch (std::exception &ex) { std::cerr << "Exception caught: " << ex.what() << std::endl; + fail(); } return; |