[libsoup/autobahn-integration-new: 2/2] autobahn-test.c: Add several debug messages and support for extra env variables



commit d8ca6d7f3147c7737ba946b788a2f1ccc2f1b940
Author: Diego Pino Garcia <dpino igalia com>
Date:   Wed Mar 24 02:46:25 2021 +0000

    autobahn-test.c: Add several debug messages and support for extra env variables

 tests/autobahn/autobahn-test.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
---
diff --git a/tests/autobahn/autobahn-test.c b/tests/autobahn/autobahn-test.c
index 929a415d..51be305e 100644
--- a/tests/autobahn/autobahn-test.c
+++ b/tests/autobahn/autobahn-test.c
@@ -28,7 +28,8 @@
 static char *address = "ws://localhost:9001";
 static char *agent = "libsoup";
 
-static unsigned long int AUTOBAHN_TEST_TIMEOUT = 20;
+
+static unsigned long int AUTOBAHN_TEST_TIMEOUT = 120;
 
 typedef void (*ConnectionFunc) (SoupWebsocketConnection *socket_connection,
                                 gint type,
@@ -120,11 +121,15 @@ connect_and_run (SoupSession *session, char *path, ConnectionFunc method, gpoint
         soup_session_websocket_connect_async (session, message, NULL, NULL, G_PRIORITY_DEFAULT, NULL, 
on_connect, ctx);
 
         time_t now = time(NULL);
+        if (getenv ("AUTOBAHN_TEST_TIMEOUT")) {
+                AUTOBAHN_TEST_TIMEOUT = atol (getenv ("AUTOBAHN_TEST_TIMEOUT"));
+        }
         const time_t threshold = now + AUTOBAHN_TEST_TIMEOUT;
 
         char timestr[32];
         strftime(timestr, 32, "%Y-%m-%d %H:%M:%S", localtime(&now));
         fprintf(stderr, "### Run %s (%s)\n", uri, timestr);
+        time_t start = now;
         while (!ctx->done) {
                 g_main_context_iteration (async_context, TRUE);
                 now = time(NULL);
@@ -140,6 +145,7 @@ connect_and_run (SoupSession *session, char *path, ConnectionFunc method, gpoint
                         return;
                 }
         }
+        fprintf(stderr, "### Test '%s' elapsed %lu seconds\n", uri, (now - start));
 
         g_object_unref (message);
         g_free (uri);
@@ -269,6 +275,13 @@ int main (int argc, char *argv[])
                 num_cases = num_case;
         }
 
+        if (getenv ("AUTOBAHN_NUM_CASE_START")) {
+                num_case = atol (getenv ("AUTOBAHN_NUM_CASE_START"));
+        }
+        if (getenv ("AUTOBAHN_NUM_CASE_END")) {
+                num_cases = atol (getenv ("AUTOBAHN_NUM_CASE_END"));
+        }
+
         if (getenv ("AUTOBAHN_TEST_TIMEOUT"))
                 AUTOBAHN_TEST_TIMEOUT = atol (getenv ("AUTOBAHN_TEST_TIMEOUT"));
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]