diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2015-05-17 21:11:14 +0200 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2015-05-17 21:12:09 +0200 |
commit | 3f02591f640d5d270c21edd02dd5539013a8e443 (patch) | |
tree | 63715c238bf9ed4f488f1d0f86568ae838e7d4a1 | |
parent | e9e95c063fba0a805cd0b7d8da66ec3f4e96c8ec (diff) | |
download | gnutls-3f02591f640d5d270c21edd02dd5539013a8e443.tar.gz |
tests: enhance the no-signal check to include proper data sending
-rw-r--r-- | tests/no-signal.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/tests/no-signal.c b/tests/no-signal.c index b8074311a4..2e541c9fb3 100644 --- a/tests/no-signal.c +++ b/tests/no-signal.c @@ -54,11 +54,15 @@ void sigpipe(int sig) exit(1); } +#define BUF_SIZE 64 + static void client(int fd) { int ret; gnutls_anon_client_credentials_t anoncred; gnutls_session_t session; + char buf[BUF_SIZE]; + char buf2[BUF_SIZE]; /* Need to enable anonymous KX specifically. */ global_init(); @@ -92,6 +96,20 @@ static void client(int fd) } while (ret < 0 && (ret == GNUTLS_E_AGAIN || ret == GNUTLS_E_INTERRUPTED)); + ret = gnutls_record_recv(session, buf, sizeof(buf)); + if (ret < 0 || ret != sizeof(buf)) { + kill(getppid(), SIGPIPE); + fail("client: recv failed"); + } + if (debug) + success("client: received %d bytes\n", ret); + + memset(buf2, 0, sizeof(buf)); + if (memcmp(buf, buf2, sizeof(buf)) != 0) { + kill(getppid(), SIGPIPE); + fail("client: recv data failed"); + } + close(fd); gnutls_deinit(session); gnutls_anon_free_client_credentials(anoncred); @@ -114,7 +132,7 @@ static void server(int fd) gnutls_anon_server_credentials_t anoncred; gnutls_session_t session; int ret; - char buf[64]; + char buf[BUF_SIZE]; unsigned i; /* this must be called once in the program */ |