Test execution time improvement: remove random usleeps from ecore thread tests
authorManoj Kumar <manoj.km@samsung.com>
Fri, 13 Jul 2018 06:46:48 +0000 (12:16 +0530)
committerYeongjong Lee <yj34.lee@samsung.com>
Mon, 6 Aug 2018 03:06:15 +0000 (12:06 +0900)
Change-Id: I3ca8e4abcd4acead41635146c1a03a14d51c04fa

TC/eina/eina_thread/utc_eina_thread_functional.c

index 70292a8034aafcc7ad6dc9a18f5a9fb1fba269ca..51e03b0ee4944387372ce61b448fd3d566dfef2b 100644 (file)
@@ -57,7 +57,6 @@ th1_do(void *data EINA_UNUSED, Ecore_Thread *th EINA_UNUSED)
         Msg *msg;
         void *ref;
 
-        usleep((rand() % 10) * 1000);
         msg = eina_thread_queue_send(thq1, sizeof(Msg), &ref);
         if (!msg)
           ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
@@ -83,7 +82,6 @@ th2_do(void *data EINA_UNUSED, Ecore_Thread *th EINA_UNUSED)
         if (!msg)
           ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
         val = msg->value;
-        usleep((rand() % 20) * 1000);
         eina_thread_queue_wait_done(thq1, ref);
 
         msg = eina_thread_queue_send(thq2, sizeof(Msg), &ref);
@@ -188,7 +186,6 @@ th41_do(void *data EINA_UNUSED, Ecore_Thread *th EINA_UNUSED)
         Msg5 *msg;
         void *ref;
 
-        usleep((rand() % 10) * 1000);
         msg = eina_thread_queue_send(thq1, sizeof(Msg5), &ref);
         if (!msg)
           ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
@@ -213,7 +210,6 @@ th42_do(void *data EINA_UNUSED, Ecore_Thread *th EINA_UNUSED)
         if (!msg)
           ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
         val = msg->value;
-        usleep((rand() % 20) * 1000);
         eina_thread_queue_wait_done(thq1, ref);
 
         msg = eina_thread_queue_send(thq2, sizeof(Msg5), &ref);
@@ -356,9 +352,9 @@ END_TEST
  * @{
  * @objective Test eina_thread_queue_wait functions.
  * @n Input Data:
- * @li Thread 1 task: function th1_do. This function allocate a message to send down a thread queue and send this messge into queue. Repeat this until value not equal 1000  with random delay (((rand() % 10) * 1000)).
+ * @li Thread 1 task: function th1_do. This function allocate a message to send down a thread queue and send this messge into queue. Repeat this until value not equal 1000.
  * @li Thread 2 task: function th2_do. This function fetch a message from thread queue by thread1 sends. After that
- send  values back into thread queue. Repeat this until value not equal 1000 times random delay (((rand() % 20) * 1000)).
+ send  values back into thread queue. Repeat this until value not equal 1000 times.
  * @li Inital value for count 99.
  *
  * @procedure
@@ -400,7 +396,6 @@ START_TEST(utc_eina_thread_wait)
         if (msg->value != (val + 1))
           ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
         val = msg->value;
-        usleep((rand() % 30) * 1000);
         eina_thread_queue_wait_done(thq2, ref);
         if (val == 1000) break;
      }
@@ -433,10 +428,10 @@ END_TEST
  * @step 1 Launch a thread to run a thspeed1_do task that can talk back to the main thread.
  * @step 2 Allocate a message to send down a thread queue
  * @step 3 Check that amount of sent messages not less than 1000000.
- * @step 4 If messages less than 1000000 are received, wait 100ms. (Check the number of received messages every 1ms)
+ * @step 4 If messages less than 1000000 are received, wait 100us. (Check the number of received messages every 1us)
  *
  * @passcondition
- * All checks passed within 100ms and no segmentation fault.
+ * All checks passed within 100us and no segmentation fault.
  * @}
  * @}
  */
@@ -468,7 +463,7 @@ START_TEST(utc_eina_thread_queue_send)
           {
              ck_abort_msg("[TEST_FAIL]:: %s[%d] : Failed to receive messages. (%d/1000000) messages have been received.", __FILE__, __LINE__, mcount);
           }
-        usleep(1000); // Wait 1ms
+        usleep(1); // Wait 1us
         mcount = msgs;
      }
    printf("[TEST_PASS]:: %s[%d] : Test has passed.\n", __FILE__, __LINE__);
@@ -695,14 +690,9 @@ START_TEST(utc_eina_thread_queue_poll)
                   ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
                }
              val = msg->value;
-             usleep((rand() % 10) * 1000);
              eina_thread_queue_wait_done(thq2, ref);
              if (val == 1100) break;
           }
-        else
-          {
-             usleep((rand() % 10) * 1000);
-          }
      }
    printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
 }