[UTC][Non-ACR][Machine Learning][Sync-up testcases to prepare next APIs] 08/226408/1
authorJaeyun <jy1210.jung@samsung.com>
Mon, 2 Mar 2020 08:43:38 +0000 (17:43 +0900)
committerJaeyun <jy1210.jung@samsung.com>
Mon, 2 Mar 2020 09:55:20 +0000 (18:55 +0900)
Sync-up the testcases with 5.5, now all sources are same in tizen branch.
- change to live src in pipeline description.
- add macro for sleep time.

Change-Id: If7a8c2eb3b679b5af9a4d31bc5e7e0828ac6a75f
Signed-off-by: Jaeyun <jy1210.jung@samsung.com>
src/utc/nnstreamer/utc-nnstreamer-common.h
src/utc/nnstreamer/utc-nnstreamer-pipeline-switch.c
src/utc/nnstreamer/utc-nnstreamer-pipeline.c
src/utc/nnstreamer/utc-nnstreamer-scenario.c

index c50f3405a17702afcbca30553d613d223704d098..7d00a72b4a60d0ae55005bd37d0f1013550ae494 100644 (file)
@@ -9,6 +9,7 @@
 #define API_NAMESPACE   "nnstreamer"
 #define FEATURE_ML    "http://tizen.org/feature/machine_learning"
 #define FEATURE_ML_INFERENCE    "http://tizen.org/feature/machine_learning.inference"
+#define SLEEP_TIME  1000000
 
 #define IS_SUPPORT_FEATURE \
 do { \
@@ -26,7 +27,7 @@ do {\
   int counter = 0;\
   while ((state == ML_PIPELINE_STATE_PAUSED || \
           state == ML_PIPELINE_STATE_READY) && counter < 20) {\
-    g_usleep (50000);\
+    g_usleep (SLEEP_TIME);\
     counter ++;\
     status = ml_pipeline_get_state (handle, &state);\
     assert_eq (status, ML_ERROR_NONE);\
index afeaf7361404de8f699af04fc5f85a6d128ceb94..ecf19c387a5dc4f4baa4f4e94b5583b595d4a88d 100644 (file)
@@ -48,7 +48,7 @@ void utc_nnstreamer_pipeline_switch_startup(void)
 
   pipeline = g_strdup ("input-selector name=ins ! tensor_converter ! tensor_sink name=sinkx "
       "videotestsrc is-live=true ! videoconvert ! ins.sink_0 "
-      "videotestsrc num-buffers=3 is-live=true ! videoconvert ! ins.sink_1");
+      "videotestsrc is-live=true ! videoconvert ! ins.sink_1");
 
   count_sink = (guint *) g_malloc (sizeof (guint));
   *count_sink = 0;
index d91d9430cf28fecbb4cb02fe27600fe30e6a9d5e..953731600836c6d6869d1b2d3daf2689e6e30f95 100644 (file)
@@ -221,16 +221,17 @@ int utc_ml_pipeline_stop_p (void)
   assert_neq (state, ML_PIPELINE_STATE_UNKNOWN);
   assert_neq (state, ML_PIPELINE_STATE_NULL);
 
-  g_usleep (50000); /* 50ms is good for general systems, but not enough for emulators to start gst pipeline. Let a few frames flow. */
+  g_usleep (SLEEP_TIME); /* SLEEP_TIME is good for general systems, but not enough for emulators to start gst pipeline. Let a few frames flow. */
   status = ml_pipeline_get_state (handle, &state);
   assert_eq (status, ML_ERROR_NONE);
   wait_for_start (handle, state, status);
   assert_eq (state, ML_PIPELINE_STATE_PLAYING);
 
+  g_usleep (SLEEP_TIME); /* Let a few frames flow. */
   status = ml_pipeline_stop (handle);
   assert_eq (status, ML_ERROR_NONE);
-  g_usleep (50000); /* 50ms. Let a few frames flow. */
 
+  g_usleep (SLEEP_TIME); /* Let a few frames flow. */
   status = ml_pipeline_get_state (handle, &state);
   assert_eq (status, ML_ERROR_NONE);
   assert_eq (state, ML_PIPELINE_STATE_PAUSED);
index cf8f7a3137db3cc360dafc477f2083323b2ef268..ae89d22d293bdadbbe80b12fbc4be904720bd325 100644 (file)
@@ -164,7 +164,7 @@ int utc_nnstreamer_scenario_pipeline_state_test_p1 (void)
   assert_neq (state, ML_PIPELINE_STATE_UNKNOWN);
   assert_neq (state, ML_PIPELINE_STATE_NULL);
 
-  g_usleep (50000); /* 50ms is good for general systems, but not enough for emulators to start gst pipeline. Let a few frames flow. */
+  g_usleep (SLEEP_TIME); /* SLEEP_TIME is good for general systems, but not enough for emulators to start gst pipeline. Let a few frames flow. */
   status = ml_pipeline_get_state (handle, &state);
   assert_eq (status, ML_ERROR_NONE);
   wait_for_start (handle, state, status);
@@ -172,7 +172,7 @@ int utc_nnstreamer_scenario_pipeline_state_test_p1 (void)
 
   status = ml_pipeline_stop (handle);
   assert_eq (status, ML_ERROR_NONE);
-  g_usleep (50000); /* 50ms. Let a few frames flow. */
+  g_usleep (SLEEP_TIME); /* Let a few frames flow. */
 
   status = ml_pipeline_get_state (handle, &state);
   assert_eq (status, ML_ERROR_NONE);
@@ -207,7 +207,7 @@ int utc_nnstreamer_scenario_pipeline_state_test_p2 (void)
   assert_neq (state, ML_PIPELINE_STATE_UNKNOWN);
   assert_neq (state, ML_PIPELINE_STATE_NULL);
 
-  g_usleep (50000); /* 50ms is good for general systems, but not enough for emulators to start gst pipeline. Let a few frames flow. */
+  g_usleep (SLEEP_TIME); /* SLEEP_TIME is good for general systems, but not enough for emulators to start gst pipeline. Let a few frames flow. */
   status = ml_pipeline_get_state (handle, &state);
   assert_eq (status, ML_ERROR_NONE);
   wait_for_start (handle, state, status);
@@ -215,7 +215,7 @@ int utc_nnstreamer_scenario_pipeline_state_test_p2 (void)
 
   status = ml_pipeline_stop (handle);
   assert_eq (status, ML_ERROR_NONE);
-  g_usleep (50000); /* 50ms. Let a few frames flow. */
+  g_usleep (SLEEP_TIME); /* Let a few frames flow. */
 
   status = ml_pipeline_get_state (handle, &state);
   assert_eq (status, ML_ERROR_NONE);
@@ -227,7 +227,7 @@ int utc_nnstreamer_scenario_pipeline_state_test_p2 (void)
   assert_neq (state, ML_PIPELINE_STATE_UNKNOWN);
   assert_neq (state, ML_PIPELINE_STATE_NULL);
 
-  g_usleep (50000); /* 50ms. Enough to empty the queue */
+  g_usleep (SLEEP_TIME); /* Enough to empty the queue */
   status = ml_pipeline_stop (handle);
   assert_eq (status, ML_ERROR_NONE);
 
@@ -280,7 +280,7 @@ int utc_nnstreamer_scenario_pipeline_state_test_p3 (void)
   status = ml_pipeline_start (handle);
   assert_eq (status, ML_ERROR_NONE);
 
-  g_usleep (50000); /* 50ms. Wait for the pipeline stgart. */
+  g_usleep (SLEEP_TIME); /* Wait for the pipeline stgart. */
   status = ml_pipeline_get_state (handle, &state);
   assert_eq (status, ML_ERROR_NONE); /* At this moment, it can be READY, PAUSED, or PLAYING */
   assert_neq (state, ML_PIPELINE_STATE_UNKNOWN);
@@ -303,7 +303,7 @@ int utc_nnstreamer_scenario_pipeline_state_test_p3 (void)
   status = ml_pipeline_valve_release_handle (valve1); /* release valve handle */
   assert_eq (status, ML_ERROR_NONE);
 
-  g_usleep (500000); /* 500ms. Let a few frames flow. (10Hz x 0.5s --> 5)*/
+  g_usleep (SLEEP_TIME); /* Let a few frames flow. (10Hz x 0.5s --> 5)*/
 
   status = ml_pipeline_stop (handle);
   assert_eq (status, ML_ERROR_NONE);
@@ -313,8 +313,7 @@ int utc_nnstreamer_scenario_pipeline_state_test_p3 (void)
 
   status = g_lstat (file1, &buf);
   assert_eq (status, 0);
-  assert_geq (buf.st_size, 2048); /* At least two frames during 500ms */
-  assert_leq (buf.st_size, 6144); /* At most six frames during 500ms */
+  assert_geq (buf.st_size, 2048); /* At least two frames during SLEEP_TIME */
   assert_eq (buf.st_size % 1024, 0); /* It should be divided by 1024 */
 
   g_free (fullpath);
@@ -401,24 +400,11 @@ int utc_nnstreamer_scenario_sink_p1 (void)
 
   status = ml_pipeline_start (handle);
   assert_eq (status, ML_ERROR_NONE);
-  g_usleep (10000); /* 10ms. Wait a bit. */
-  status = ml_pipeline_get_state (handle, &state);
-  assert_eq (status, ML_ERROR_NONE); /* At this moment, it can be READY, PAUSED, or PLAYING */
-  assert_neq (state, ML_PIPELINE_STATE_UNKNOWN);
-  assert_neq (state, ML_PIPELINE_STATE_NULL);
-
-  g_usleep (100000); /* 100ms. Let a few frames flow. */
-  status = ml_pipeline_get_state (handle, &state);
-  assert_eq (status, ML_ERROR_NONE);
-  assert_eq (state, ML_PIPELINE_STATE_PLAYING);
+  g_usleep (SLEEP_TIME * 2); /* Wait a bit. */
 
   status = ml_pipeline_stop (handle);
   assert_eq (status, ML_ERROR_NONE);
-  g_usleep (10000); /* 10ms. Wait a bit. */
-
-  status = ml_pipeline_get_state (handle, &state);
-  assert_eq (status, ML_ERROR_NONE);
-  assert_eq (state, ML_PIPELINE_STATE_PAUSED);
+  g_usleep (SLEEP_TIME); /* Wait a bit. */
 
   status = ml_pipeline_sink_unregister (sinkhandle);
   assert_eq (status, ML_ERROR_NONE);
@@ -466,18 +452,11 @@ int utc_nnstreamer_scenario_sink_p2 (void)
   status = ml_pipeline_start (handle);
   assert_eq (status, ML_ERROR_NONE);
 
-  g_usleep (100000); /* 100ms. Let a few frames flow. */
-  status = ml_pipeline_get_state (handle, &state);
-  assert_eq (status, ML_ERROR_NONE);
-  assert_eq (state, ML_PIPELINE_STATE_PLAYING);
+  g_usleep (SLEEP_TIME * 2); /* Let a few frames flow. */
 
   status = ml_pipeline_stop (handle);
   assert_eq (status, ML_ERROR_NONE);
-  g_usleep (10000); /* 10ms. Wait a bit. */
-
-  status = ml_pipeline_get_state (handle, &state);
-  assert_eq (status, ML_ERROR_NONE);
-  assert_eq (state, ML_PIPELINE_STATE_PAUSED);
+  g_usleep (SLEEP_TIME); /* Wait a bit. */
 
   status = ml_pipeline_sink_unregister (sinkhandle);
   assert_eq (status, ML_ERROR_NONE);
@@ -509,7 +488,7 @@ int utc_nnstreamer_scenario_sink_error_cases_n (void)
   int status;
   guint *count_sink;
 
-  gchar * pipeline = g_strdup ("videotestsrc num-buffers=3 ! videoconvert ! valve name=valvex ! tensor_converter ! tensor_sink name=sinkx");
+  gchar * pipeline = g_strdup ("videotestsrc is-live=true ! videoconvert ! valve name=valvex ! tensor_converter ! tensor_sink name=sinkx");
 
   count_sink = (guint *) g_malloc (sizeof (guint));
   *count_sink = 0;
@@ -547,11 +526,13 @@ int utc_nnstreamer_scenario_sink_error_cases_n (void)
   status = ml_pipeline_start (handle);
   assert_eq (status, ML_ERROR_NONE);
 
-  g_usleep (100000); /* 100ms. Let a few frames flow. */
+  g_usleep (SLEEP_TIME); /* Let a few frames flow. */
 
   status = ml_pipeline_stop (handle);
   assert_eq (status, ML_ERROR_NONE);
 
+  g_usleep (SLEEP_TIME); /* Let a few frames flow. */
+
   status = ml_pipeline_sink_unregister (sinkhandle);
   assert_eq (status, ML_ERROR_NONE);
 
@@ -605,7 +586,7 @@ int utc_nnstreamer_scenario_src_p (void)
 
   status = ml_pipeline_start (handle);
   assert_eq (status, ML_ERROR_NONE);
-  g_usleep (10000); /* 10ms. Wait a bit. */
+  g_usleep (SLEEP_TIME); /* Wait a bit. */
   status = ml_pipeline_get_state (handle, &state);
   assert_eq (status, ML_ERROR_NONE); /* At this moment, it can be READY, PAUSED, or PLAYING */
   assert_neq (state, ML_PIPELINE_STATE_UNKNOWN);
@@ -652,11 +633,11 @@ int utc_nnstreamer_scenario_src_p (void)
 
   status = ml_pipeline_src_input_data (srchandle, data1, ML_PIPELINE_BUF_POLICY_DO_NOT_FREE);
   assert_eq (status, ML_ERROR_NONE);
-  g_usleep (50000); /* 50ms. Wait a bit. */
+  g_usleep (SLEEP_TIME); /* Wait a bit. */
 
   status = ml_pipeline_src_input_data (srchandle, data1, ML_PIPELINE_BUF_POLICY_DO_NOT_FREE);
   assert_eq (status, ML_ERROR_NONE);
-  g_usleep (50000); /* 50ms. Wait a bit. */
+  g_usleep (SLEEP_TIME); /* Wait a bit. */
 
   status = ml_pipeline_src_release_handle (srchandle);
   assert_eq (status, ML_ERROR_NONE);
@@ -695,13 +676,13 @@ int utc_nnstreamer_scenario_src_p (void)
     status = ml_pipeline_src_input_data (srchandle, data2, ML_PIPELINE_BUF_POLICY_AUTO_FREE);
     assert_eq (status, ML_ERROR_NONE);
 
-    g_usleep (50000); /* 50ms. Wait a bit. */
+    g_usleep (SLEEP_TIME); /* Wait a bit. */
   }
 
   status = ml_pipeline_src_release_handle (srchandle);
   assert_eq (status, ML_ERROR_NONE);
 
-  g_usleep (50000); /* Wait for the pipeline to flush all */
+  g_usleep (SLEEP_TIME); /* Wait for the pipeline to flush all */
 
   status = ml_pipeline_destroy (handle);
   assert_eq (status, ML_ERROR_NONE);
@@ -858,7 +839,7 @@ int utc_nnstreamer_scenario_switch_pipeline_p1 (void)
 
   gchar * pipeline = g_strdup ("input-selector name=ins ! tensor_converter ! tensor_sink name=sinkx "
       "videotestsrc is-live=true ! videoconvert ! ins.sink_0 "
-      "videotestsrc num-buffers=3 is-live=true ! videoconvert ! ins.sink_1");
+      "videotestsrc is-live=true ! videoconvert ! ins.sink_1");
 
   count_sink = (guint *) g_malloc (sizeof (guint));
   *count_sink = 0;
@@ -898,12 +879,12 @@ int utc_nnstreamer_scenario_switch_pipeline_p1 (void)
   status = ml_pipeline_start (handle);
   assert_eq (status, ML_ERROR_NONE);
 
-  g_usleep (50000);
+  g_usleep (SLEEP_TIME);
   status = ml_pipeline_get_state (handle, &state);
   assert_eq (status, ML_ERROR_NONE);
   wait_for_start (handle, state, status);
 
-  g_usleep (300000); /* 300ms. Let a few frames flow. */
+  g_usleep (SLEEP_TIME); /* Let a few frames flow. */
 
   status = ml_pipeline_stop (handle);
   assert_eq (status, ML_ERROR_NONE);
@@ -917,7 +898,7 @@ int utc_nnstreamer_scenario_switch_pipeline_p1 (void)
   status = ml_pipeline_destroy (handle);
   assert_eq (status, ML_ERROR_NONE);
 
-  assert_eq (*count_sink, 3U);
+  assert (*count_sink > 0U);
 
   assert (pipe_state->paused);
   assert (pipe_state->playing);
@@ -996,11 +977,13 @@ int utc_nnstreamer_scenario_switch_pipeline_p2 (void)
   status = ml_pipeline_start (handle);
   assert_eq (status, ML_ERROR_NONE);
 
-  g_usleep (200000); /* 200ms. Let a few frames flow. */
+  g_usleep (SLEEP_TIME); /* Let a few frames flow. */
 
   status = ml_pipeline_stop (handle);
   assert_eq (status, ML_ERROR_NONE);
 
+  g_usleep (SLEEP_TIME); /* Let a few frames flow. */
+
   status = ml_pipeline_sink_unregister (sinkhandle0);
   assert_eq (status, ML_ERROR_NONE);
 
@@ -1038,7 +1021,7 @@ int utc_nnstreamer_scenario_switch_pipeline_error_cases_n (void)
 
   gchar * pipeline = g_strdup ("input-selector name=ins ! tensor_converter ! tensor_sink name=sinkx "
       "videotestsrc is-live=true ! videoconvert ! ins.sink_0 "
-      "videotestsrc num-buffers=3 ! videoconvert ! ins.sink_1");
+      "videotestsrc is-live=true ! videoconvert ! ins.sink_1");
 
   status = ml_pipeline_construct (pipeline, NULL, NULL, &handle);
   assert_eq (status, ML_ERROR_NONE);
@@ -1063,7 +1046,7 @@ int utc_nnstreamer_scenario_switch_pipeline_error_cases_n (void)
   status = ml_pipeline_switch_get_handle (handle, "ins", &type, NULL);
   assert_eq (status, ML_ERROR_INVALID_PARAMETER);
 
-  /* succesfully get switch handle if the param type is null */
+  /* successfully get switch handle if the param type is null */
   status = ml_pipeline_switch_get_handle (handle, "ins", NULL, &switchhandle);
   assert_eq (status, ML_ERROR_NONE);