[UTC][nnstreamer][Non-ACR] Remove lstat call 01/302701/1
authorYongjoo Ahn <yongjoo1.ahn@samsung.com>
Tue, 12 Dec 2023 06:08:57 +0000 (15:08 +0900)
committerYongjoo Ahn <yongjoo1.ahn@samsung.com>
Tue, 12 Dec 2023 06:28:19 +0000 (15:28 +0900)
- In some environment, the TC got timeout in syscall lstat sometimes.
- Replace the call with g_file_get_contents, and remove unnecessary
  assert

Change-Id: Ic3a0a957c97eca6f905f71c8558669db913a7b2f
Signed-off-by: Yongjoo Ahn <yongjoo1.ahn@samsung.com>
src/utc/nnstreamer/utc-nnstreamer-scenario.c

index fc6e98db0391fe1f750569092b18f68f5eee011c..194298e6863ed6ed275061835193ffa83ab0d44f 100644 (file)
@@ -259,11 +259,13 @@ int utc_nnstreamer_scenario_pipeline_state_test_p3 (void)
   gchar *fullpath = g_build_path ("/", _tmpdir, _dirname, NULL);
   gchar *dir = g_mkdtemp ((gchar *) fullpath);
   gchar *file1 = g_build_path ("/", dir, "valve1", NULL);
+  uint8_t *content = NULL;
+  gsize len = 0;
+
   gchar * pipeline =
       g_strdup_printf
-      ("videotestsrc is-live=true ! videoconvert ! videoscale ! video/x-raw,format=RGBx,width=16,height=16,framerate=10/1 ! tensor_converter ! queue ! valve name=valve1 ! filesink location=\"%s\"",
+      ("videotestsrc is-live=true ! videoconvert ! videoscale ! video/x-raw,format=RGBx,width=16,height=16,framerate=10/1 ! tensor_converter ! queue ! valve name=valve1 ! filesink location=\"%s\" buffer-mode=unbuffered",
       file1);
-  GStatBuf buf;
 
   ml_pipeline_h handle;
   ml_pipeline_state_e state;
@@ -293,10 +295,6 @@ int utc_nnstreamer_scenario_pipeline_state_test_p3 (void)
   status = ml_pipeline_stop (handle);
   assert_eq (status, ML_ERROR_NONE);
 
-  status = g_lstat (file1, &buf);
-  assert_eq (status, 0);
-  assert_eq (buf.st_size, 0);
-
   status = ml_pipeline_start (handle);
   assert_eq (status, ML_ERROR_NONE);
 
@@ -314,11 +312,10 @@ int utc_nnstreamer_scenario_pipeline_state_test_p3 (void)
   status = ml_pipeline_destroy (handle);
   assert_eq (status, ML_ERROR_NONE);
 
-  status = g_lstat (file1, &buf);
-  assert_eq (status, 0);
-  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 */
+  assert_eq (g_file_get_contents (file1, (gchar **) &content, &len, NULL), TRUE);
+  assert_geq (len, 1024);
 
+  g_free (content);
   g_free (fullpath);
   g_free (file1);