utc_ecore_con_client_server_get: fix the random failure 81/232181/1
authorAmitesh Singh <singh.amitesh@gmail.com>
Tue, 28 Apr 2020 10:54:10 +0000 (16:24 +0530)
committerChun <jykeon@samsung.com>
Wed, 29 Apr 2020 03:15:04 +0000 (03:15 +0000)
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>
(cherry picked from commit c304b8abee5717510ac061567d143dfc3c49fa59)

TC/ecore/ecore_con/utc_ecore_con_client_server_get.c

index a24ca33e78ab6592a1cba72ba265d6451617cae0..d878ae378a7423ffd10ce15874e1195a363b6fcd 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,