utc_ecore_con_client_server_get: fix the random failure 26/232126/1
authorAmitesh Singh <singh.amitesh@gmail.com>
Tue, 28 Apr 2020 10:54:10 +0000 (16:24 +0530)
committerAmitesh Singh <singh.amitesh@gmail.com>
Tue, 28 Apr 2020 11:00:31 +0000 (16:30 +0530)
This TC has been failing randomly on different devices.
The root cause of the failure due to client2 fd coming to -1.
it was happening because of the ecore_main_loop_quit() call after
the data transfer between the first client and server. This is wrong.
While client2 is still in queue for the connection to the server,
the main loop quits after the first connection, which resulted into
failure of client2's connection to server.

To fix this, I'd set the client connection limit to infinite and call loop quit
in a 1.5s timer.
I'd tested this on rpi3 on latest Tizen 6.0 image and it passed all the time.

Change-Id: I73cbcec3cbece3bccfa8948557bea2dc4e3a686f
Signed-off-by: Amitesh Singh <singh.amitesh@gmail.com>
TC/ecore/ecore_con/utc_ecore_con_client_server_get.c

index 31dd041bd2f333298bcaea53fa79a942e0b2a364..fba0cb9fd00369c3f82234a1d90f06136859ab73 100644 (file)
@@ -246,13 +246,18 @@ _data(void *data, int type EINA_UNUSED, void *ev)
         ck_assert_msg(memcmp (event->data, "PONG", sizeof("PONG")) == 0,
                  "[TEST_FAIL]:: %s[%d] : Test has failed (received worng event)..",
                  __FILE__, __LINE__);
-
-        ecore_main_loop_quit();
      }
 
    return ECORE_CALLBACK_RENEW;
 }
 
+static Eina_Bool
+_timeout(void *d)
+{
+   ecore_main_loop_quit();
+   return ECORE_CALLBACK_CANCEL;
+}
+
 /**
  * @addtogroup ecore_con_client_server_get
  * @{
@@ -393,13 +398,12 @@ START_TEST(utc_ecore_con_client_server_get_p)
                  "[TEST_FAIL]:: %s[%d] : Test has failed (wrong timeout from server)..",
                  __FILE__, __LINE__);
 
-
    ret = ecore_con_server_port_get(server);
    ck_assert_msg(ret == server_port,
                  "[TEST_FAIL]:: %s[%d] : Test has failed (wrong port from server)..",
                  __FILE__, __LINE__);
 
-   ecore_con_server_client_limit_set(server, 1, 0);
+   ecore_con_server_client_limit_set(server, -1, 0);
 
    client = ecore_con_server_connect(compl_type, name, server_port,
                                      client_data);
@@ -407,13 +411,14 @@ START_TEST(utc_ecore_con_client_server_get_p)
                  "[TEST_FAIL]:: %s[%d] : Test has failed (failed connect to server)..",
                  __FILE__, __LINE__);
 
-
    client2 = ecore_con_server_connect(compl_type, name, server_port,
                                      client_data);
    ck_assert_msg(client2 != NULL,
                  "[TEST_FAIL]:: %s[%d] : Test has failed (failed connect to server)..",
                  __FILE__, __LINE__);
 
+   ecore_timer_add(1.5, _timeout, NULL);
+
    ecore_main_loop_begin();
 
    ck_assert_msg(ecore_con_server_fd_get(client) != -1,