[gnutls-devel] GnuTLS | Reduce runtime for timeout tests (#636)

Development of GNU's TLS library gnutls-devel at lists.gnutls.org
Sun Dec 2 19:02:56 CET 2018


Not using virt-time.h, just using a custom pull_timeout function (replaces select()). WDYT ?
```
diff --git a/tests/handshake-timeout.c b/tests/handshake-timeout.c
index 52c21f69b4..5e8afe3564 100644
--- a/tests/handshake-timeout.c
+++ b/tests/handshake-timeout.c
@@ -61,6 +61,14 @@ static void client_log_func(int level, const char *str)
        fprintf(stderr, "client|<%d>| %s", level, str);
 }
 
+static int pull_timeout_func(gnutls_transport_ptr_t fd, unsigned int ms)
+{
+       (void)fd;
+       (void)ms;
+
+       return 0;
+}
+
 static void client(int fd, int wait)
 {
        int ret;
@@ -90,6 +98,9 @@ static void client(int fd, int wait)
 
        gnutls_transport_set_int(session, fd);
 
+       if (wait)
+               gnutls_transport_set_pull_timeout_function(session, pull_timeout_func);
+
        /* Perform the TLS handshake
         */
        do {
@@ -151,7 +162,7 @@ static void server(int fd, int wait)
        gnutls_transport_set_int(session, fd);
 
        if (wait) {
-               sec_sleep(25);
+               sleep(1);
        } else {
                do {
                        ret = gnutls_handshake(session);
```

-- 
Reply to this email directly or view it on GitLab: https://gitlab.com/gnutls/gnutls/issues/636#note_121671514
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gnupg.org/pipermail/gnutls-devel/attachments/20181202/3982a49e/attachment.html>


More information about the Gnutls-devel mailing list