[ITC][nnstreamer][ACR-1722] added two TC for newly added APIs 90/281490/3
authorAnkit Srivastava <ankit.sri1@samsung.com>
Mon, 19 Sep 2022 12:12:08 +0000 (17:42 +0530)
committerAnkit Srivastava <ankit.sri1@samsung.com>
Tue, 20 Sep 2022 06:46:21 +0000 (12:16 +0530)
- Add TCs for newly added APIs by ACR-1722.
  - ITc_nnstreamer_ml_service_launch_destroy_pipeline_p
  - ITc_nnstreamer_ml_service_start_stop_pipeline_p

Change-Id: I546ae99982a3251fe29ff81e849c5af5f25b37ab
Signed-off-by: Ankit Srivastava <ankit.sri1@samsung.com>
src/itc/nnstreamer/ITs-nnstreamer-ml-service.c [changed mode: 0755->0644]
src/itc/nnstreamer/tct-nnstreamer-native_mobile.h
src/itc/nnstreamer/tct-nnstreamer-native_tizeniot.h
src/itc/nnstreamer/tct-nnstreamer-native_tv.h
src/itc/nnstreamer/tct-nnstreamer-native_wearable.h

old mode 100755 (executable)
new mode 100644 (file)
index d1aa69a..75cd0c1
@@ -45,8 +45,8 @@ void ITs_nnstreamer_ml_service_startup(void)
        FPRINTF("[Line : %d][%s] TEST SUIT start-up: ITs_nnstreamer_ml_service_startup\\n", __LINE__, API_NAMESPACE);
 #endif
        g_bIsFeatureMismatched = false;
-        g_bFeatureMLService = false;
-        g_bFeatureML = TCTCheckSystemInfoFeatureSupported(FEATURE_ML, API_NAMESPACE);
+       g_bFeatureMLService = false;
+       g_bFeatureML = TCTCheckSystemInfoFeatureSupported(FEATURE_ML, API_NAMESPACE);
        g_bFeatureMLService = TCTCheckSystemInfoFeatureSupported(FEATURE_ML_SERVICE, API_NAMESPACE);
 
         if (g_bFeatureML && g_bFeatureMLService)
@@ -126,9 +126,9 @@ int ITc_nnstreamer_ml_service_set_get_pipeline_p(void)
     PRINT_RESULT(ML_ERROR_NONE, nRetVal, "ml_service_get_pipeline", NnStreamerGetError(nRetVal));
     if (0 != strcmp (g_Pipeline, get_pipeline))
     {
-        FPRINTF("[Line : %d][%s] Set and Get pipeline value mismatch \\n", __LINE__, API_NAMESPACE);
-         g_free (get_pipeline);
-        return 1;
+               FPRINTF("[Line : %d][%s] Set and Get pipeline value mismatch \\n", __LINE__, API_NAMESPACE);
+               g_free (get_pipeline);
+               return 1;
     }
 
     g_free (get_pipeline);
@@ -144,10 +144,10 @@ int ITc_nnstreamer_ml_service_set_get_pipeline_p(void)
     PRINT_RESULT(ML_ERROR_NONE, nRetVal, "ml_service_get_pipeline", NnStreamerGetError(nRetVal));
     if (0 != strcmp (pipeline2, get_pipeline))
     {
-        FPRINTF("[Line : %d][%s] Set and Get pipeline value mismatch for second key\\n", __LINE__, API_NAMESPACE);
-        g_free (pipeline2);
-         g_free (get_pipeline);
-        return 1;
+       FPRINTF("[Line : %d][%s] Set and Get pipeline value mismatch for second key\\n", __LINE__, API_NAMESPACE);
+       g_free (pipeline2);
+       g_free (get_pipeline);
+       return 1;
     }
     g_free (pipeline2);
     g_free (get_pipeline);
@@ -202,3 +202,150 @@ int ITc_nnstreamer_ml_service_delete_pipeline_p(void)
 
     return 0;
 }
+
+/*
+* @testcase                    ITc_nnstreamer_ml_service_launch_destroy_pipeline_p
+* @since_tizen                 7.0
+* @author                      SRID(shobhit.v)
+* @reviewer                    SRID(ankit.sr1)
+* @type                        auto
+* @description                 launch and destroy pipeline
+* @scenario                    launch pipeline and destroy pipeline
+* @apicovered                  ml_service_set_pipeline, ml_service_launch_pipeline, ml_service_get_pipeline_state, ml_service_destroy, and ml_service_delete_pipeline
+* @passcase                    When ml_service_set_pipeline, ml_service_launch_pipeline, ml_service_get_pipeline_state, and ml_service_destroy are successful.
+* @failcase                    If target API fails or any precondition API fails
+* @precondition                        None
+* @postcondition               None
+*/
+//& purpose: API to Check for launch and destroy pipeline of ml service handle
+//& type: auto
+int ITc_nnstreamer_ml_service_launch_destroy_pipeline_p(void)
+{
+       START_TEST_ML_SERVICE;
+
+       const gchar *key = "ServiceName";
+       gchar *test_pipeline = "videotestsrc ! fakesink";
+       ml_service_h service_handle = NULL;
+
+       /* set simple pipeline */
+       int nRetVal = ml_service_set_pipeline(key, test_pipeline);
+       PRINT_RESULT(ML_ERROR_NONE, nRetVal, "ml_service_set_pipeline", NnStreamerGetError(nRetVal));
+
+       /* launch the pipeline and check the state */
+       nRetVal = ml_service_launch_pipeline(key, &service_handle);
+       ML_SERVICE_FEATURE_CHECK;
+       PRINT_RESULT(ML_ERROR_NONE, nRetVal, "ml_service_launch_pipeline", NnStreamerGetError(nRetVal));
+       if (service_handle == NULL)
+       {
+               FPRINTF("[Line : %d][%s] service handle value remains NULL\\n", __LINE__, API_NAMESPACE);
+               ml_service_destroy(service_handle);
+               ml_service_delete_pipeline(key);
+               return 1;
+       }
+
+       nRetVal = ml_service_get_pipeline_state(service_handle, &state);
+       PRINT_RESULT(ML_ERROR_NONE, nRetVal, "ml_service_get_pipeline_state", NnStreamerGetError(nRetVal));
+       if (state != ML_PIPELINE_STATE_PAUSED)
+       {
+               FPRINTF("[Line : %d][%s] state value mismatch for service handle\\n", __LINE__, API_NAMESPACE);
+               ml_service_destroy(service_handle);
+               ml_service_delete_pipeline(key);
+               return 1;
+       }
+
+       /*destroy the pipeline*/
+       nRetVal = ml_service_destroy(service_handle);
+       ML_SERVICE_FEATURE_CHECK;
+       PRINT_RESULT(ML_ERROR_NONE, nRetVal, "ml_service_destroy", NnStreamerGetError(nRetVal));
+
+       /* delete finished service */
+       nRetVal = ml_service_delete_pipeline(key);
+       PRINT_RESULT_NORETURN(ML_ERROR_NONE, nRetVal, "ml_service_delete_pipeline", NnStreamerGetError(nRetVal));
+       return 0;
+}
+
+/*
+* @testcase                    ITc_nnstreamer_ml_service_start_stop_pipeline_p
+* @since_tizen                 7.0
+* @author                      SRID(shobhit.v)
+* @reviewer                    SRID(ankit.sr1)
+* @type                        auto
+* @description                 start and stop pipeline of launched ml service handle
+* @scenario                    start pipeline and stop pipeline
+* @apicovered                  ml_service_set_pipeline, ml_service_launch_pipeline, ml_service_get_pipeline_state, ml_service_destroy, and ml_service_delete_pipeline
+* @passcase                    When ml_service_set_pipeline, ml_service_launch_pipeline, ml_service_get_pipeline_state, ml_service_start_pipeline, ml_service_stop_pipeline, and ml_service_destroy are successful.
+* @failcase                    If target API fails or any precondition API fails
+* @precondition                        None
+* @postcondition               None
+*/
+//& purpose: API to Check for start and stop pipeline feature in launched ml service handle
+//& type: auto
+int ITc_nnstreamer_ml_service_start_stop_pipeline_p(void)
+{
+       START_TEST_ML_SERVICE;
+
+       const gchar *key = "ServiceName";
+       gchar *test_pipeline = "videotestsrc ! fakesink";
+       ml_service_h service_handle = NULL;
+
+       /* set simple pipeline */
+       int nRetVal = ml_service_set_pipeline(key, test_pipeline);
+       PRINT_RESULT(ML_ERROR_NONE, nRetVal, "ml_service_set_pipeline", NnStreamerGetError(nRetVal));
+
+       /* launch the pipeline and check the state */
+       nRetVal = ml_service_launch_pipeline(key, &service_handle);
+       PRINT_RESULT(ML_ERROR_NONE, nRetVal, "ml_service_launch_pipeline", NnStreamerGetError(nRetVal));
+       if (service_handle == NULL)
+       {
+               FPRINTF("[Line : %d][%s] service handle value remains NULL\\n", __LINE__, API_NAMESPACE);
+               return 1;
+       }
+
+       nRetVal = ml_service_get_pipeline_state(service_handle, &state);
+       PRINT_RESULT_CLEANUP(ML_ERROR_NONE, nRetVal, "ml_service_get_pipeline_state", NnStreamerGetError(nRetVal), ml_service_start_pipeline(service_handle); ml_service_stop_pipeline(service_handle); ml_service_destroy(service_handle); ml_service_delete_pipeline(key));
+       if (state != ML_PIPELINE_STATE_PAUSED)
+       {
+               FPRINTF("[Line : %d][%s] state value mismatch for service handle\\n", __LINE__, API_NAMESPACE);
+               return 1;
+       }
+
+       /* start the pipeline and check the state */
+       nRetVal = ml_service_start_pipeline(service_handle);
+       ML_SERVICE_FEATURE_CHECK;
+       PRINT_RESULT_CLEANUP(ML_ERROR_NONE, nRetVal, "ml_service_start_pipeline", NnStreamerGetError(nRetVal), ml_service_stop_pipeline(service_handle); ml_service_destroy(service_handle); ml_service_delete_pipeline(key));
+
+       nRetVal = ml_service_get_pipeline_state(service_handle, &state);
+       PRINT_RESULT_CLEANUP(ML_ERROR_NONE, nRetVal, "ml_service_get_pipeline_state", NnStreamerGetError(nRetVal), ml_service_stop_pipeline(service_handle); ml_service_destroy(service_handle); ml_service_delete_pipeline(key));
+       if (state != ML_PIPELINE_STATE_PLAYING)
+       {
+               FPRINTF("[Line : %d][%s] state value mismatch for service handle\\n", __LINE__, API_NAMESPACE);
+               ml_service_stop_pipeline(service_handle);
+               ml_service_destroy(service_handle);
+               ml_service_delete_pipeline(key);
+               return 1;
+       }
+
+       /* stop the pipeline and check the state */
+       nRetVal = ml_service_stop_pipeline(service_handle);
+       ML_SERVICE_FEATURE_CHECK;
+       PRINT_RESULT_CLEANUP(ML_ERROR_NONE, nRetVal, "ml_service_stop_pipeline", NnStreamerGetError(nRetVal), ml_service_destroy(service_handle); ml_service_delete_pipeline(key));
+
+       nRetVal = ml_service_get_pipeline_state(service_handle, &state);
+       PRINT_RESULT_CLEANUP(ML_ERROR_NONE, nRetVal, "ml_service_get_pipeline_state", NnStreamerGetError(nRetVal), ml_service_destroy(service_handle); ml_service_delete_pipeline(key));
+       if (state != ML_PIPELINE_STATE_PAUSED)
+       {
+               FPRINTF("[Line : %d][%s] state value mismatch for service handle\\n", __LINE__, API_NAMESPACE);
+               ml_service_destroy(service_handle);
+               ml_service_delete_pipeline(key);
+               return 1;
+       }
+
+       /*destroy the pipeline*/
+       nRetVal = ml_service_destroy(service_handle);
+       PRINT_RESULT_NORETURN(ML_ERROR_NONE, nRetVal, "ml_service_destroy", NnStreamerGetError(nRetVal));
+
+       /* delete finished service */
+       nRetVal = ml_service_delete_pipeline(key);
+       PRINT_RESULT_NORETURN(ML_ERROR_NONE, nRetVal, "ml_service_delete_pipeline", NnStreamerGetError(nRetVal));
+       return 0;
+}
index b6431600789b4cacb030091c28dd8d74c429141c..bbf5be2e28ddc896369aed0a26b58d0082c202ed 100644 (file)
@@ -86,6 +86,8 @@ extern int ITc_nnstreamer_ml_service_delete_pipeline_p(void);
 extern int ITc_nnstreamer_ml_option_create_destroy_p(void);
 extern int ITc_nnstreamer_ml_option_set_p(void);
 extern int ITc_nnstreamer_single_ml_single_open_with_option_p(void);
+extern int ITc_nnstreamer_ml_service_launch_destroy_pipeline_p(void);
+extern int ITc_nnstreamer_ml_service_start_stop_pipeline_p(void);
 
 testcase tc_array[] = {
 {"ITc_nnstreamer_pipeline_ml_pipeline_construct_destroy_p", ITc_nnstreamer_pipeline_ml_pipeline_construct_destroy_p, ITs_nnstreamer_pipeline_startup, ITs_nnstreamer_pipeline_cleanup},
@@ -140,6 +142,8 @@ testcase tc_array[] = {
 {"ITc_nnstreamer_ml_option_create_destroy_p", ITc_nnstreamer_ml_option_create_destroy_p, ITs_nnstreamer_capi_startup, ITs_nnstreamer_capi_cleanup},
 {"ITc_nnstreamer_ml_option_set_p", ITc_nnstreamer_ml_option_set_p, ITs_nnstreamer_capi_startup, ITs_nnstreamer_capi_cleanup},
 {"ITc_nnstreamer_single_ml_single_open_with_option_p", ITc_nnstreamer_single_ml_single_open_with_option_p, ITs_nnstreamer_tensors_single_startup, ITs_nnstreamer_tensors_single_cleanup},
+{"ITc_nnstreamer_ml_service_launch_destroy_pipeline_p",ITc_nnstreamer_ml_service_launch_destroy_pipeline_p,ITs_nnstreamer_ml_service_startup, ITs_nnstreamer_ml_service_cleanup},
+{"ITc_nnstreamer_ml_service_start_stop_pipeline_p",ITc_nnstreamer_ml_service_start_stop_pipeline_p,ITs_nnstreamer_ml_service_startup, ITs_nnstreamer_ml_service_cleanup},
   {NULL, NULL}
 };
 
index fb95c59ddecb6ab9153d5ebdbe08eaa88cde900e..11a532699896e19eb683092cac8af792fce4760b 100644 (file)
@@ -86,6 +86,8 @@ extern int ITc_nnstreamer_ml_service_delete_pipeline_p(void);
 extern int ITc_nnstreamer_ml_option_create_destroy_p(void);
 extern int ITc_nnstreamer_ml_option_set_p(void);
 extern int ITc_nnstreamer_single_ml_single_open_with_option_p(void);
+extern int ITc_nnstreamer_ml_service_launch_destroy_pipeline_p(void);
+extern int ITc_nnstreamer_ml_service_start_stop_pipeline_p(void);
 
 testcase tc_array[] = {
 {"ITc_nnstreamer_pipeline_ml_pipeline_construct_destroy_p", ITc_nnstreamer_pipeline_ml_pipeline_construct_destroy_p, ITs_nnstreamer_pipeline_startup, ITs_nnstreamer_pipeline_cleanup},
@@ -140,6 +142,8 @@ testcase tc_array[] = {
 {"ITc_nnstreamer_ml_option_create_destroy_p", ITc_nnstreamer_ml_option_create_destroy_p, ITs_nnstreamer_capi_startup, ITs_nnstreamer_capi_cleanup},
 {"ITc_nnstreamer_ml_option_set_p", ITc_nnstreamer_ml_option_set_p, ITs_nnstreamer_capi_startup, ITs_nnstreamer_capi_cleanup},
 {"ITc_nnstreamer_single_ml_single_open_with_option_p", ITc_nnstreamer_single_ml_single_open_with_option_p, ITs_nnstreamer_tensors_single_startup, ITs_nnstreamer_tensors_single_cleanup},
+{"ITc_nnstreamer_ml_service_launch_destroy_pipeline_p",ITc_nnstreamer_ml_service_launch_destroy_pipeline_p,ITs_nnstreamer_ml_service_startup, ITs_nnstreamer_ml_service_cleanup},
+{"ITc_nnstreamer_ml_service_start_stop_pipeline_p",ITc_nnstreamer_ml_service_start_stop_pipeline_p,ITs_nnstreamer_ml_service_startup, ITs_nnstreamer_ml_service_cleanup},
   {NULL, NULL}
 };
 
index 6899a150e4df8243a47765646779b51b38ad194f..a43aecde14e27276e490b80925e47c18f2166979 100644 (file)
@@ -85,6 +85,8 @@ extern int ITc_nnstreamer_ml_service_delete_pipeline_p(void);
 extern int ITc_nnstreamer_ml_option_create_destroy_p(void);
 extern int ITc_nnstreamer_ml_option_set_p(void);
 extern int ITc_nnstreamer_single_ml_single_open_with_option_p(void);
+extern int ITc_nnstreamer_ml_service_launch_destroy_pipeline_p(void);
+extern int ITc_nnstreamer_ml_service_start_stop_pipeline_p(void);
 
 testcase tc_array[] = {
 {"ITc_nnstreamer_pipeline_ml_pipeline_construct_destroy_p", ITc_nnstreamer_pipeline_ml_pipeline_construct_destroy_p, ITs_nnstreamer_pipeline_startup, ITs_nnstreamer_pipeline_cleanup},
@@ -138,6 +140,8 @@ testcase tc_array[] = {
 {"ITc_nnstreamer_ml_option_create_destroy_p", ITc_nnstreamer_ml_option_create_destroy_p, ITs_nnstreamer_capi_startup, ITs_nnstreamer_capi_cleanup},
 {"ITc_nnstreamer_ml_option_set_p", ITc_nnstreamer_ml_option_set_p, ITs_nnstreamer_capi_startup, ITs_nnstreamer_capi_cleanup},
 {"ITc_nnstreamer_single_ml_single_open_with_option_p", ITc_nnstreamer_single_ml_single_open_with_option_p, ITs_nnstreamer_tensors_single_startup, ITs_nnstreamer_tensors_single_cleanup},
+{"ITc_nnstreamer_ml_service_launch_destroy_pipeline_p",ITc_nnstreamer_ml_service_launch_destroy_pipeline_p,ITs_nnstreamer_ml_service_startup, ITs_nnstreamer_ml_service_cleanup},
+{"ITc_nnstreamer_ml_service_start_stop_pipeline_p",ITc_nnstreamer_ml_service_start_stop_pipeline_p,ITs_nnstreamer_ml_service_startup, ITs_nnstreamer_ml_service_cleanup},
   {NULL, NULL}
 };
 
index fb95c59ddecb6ab9153d5ebdbe08eaa88cde900e..11a532699896e19eb683092cac8af792fce4760b 100644 (file)
@@ -86,6 +86,8 @@ extern int ITc_nnstreamer_ml_service_delete_pipeline_p(void);
 extern int ITc_nnstreamer_ml_option_create_destroy_p(void);
 extern int ITc_nnstreamer_ml_option_set_p(void);
 extern int ITc_nnstreamer_single_ml_single_open_with_option_p(void);
+extern int ITc_nnstreamer_ml_service_launch_destroy_pipeline_p(void);
+extern int ITc_nnstreamer_ml_service_start_stop_pipeline_p(void);
 
 testcase tc_array[] = {
 {"ITc_nnstreamer_pipeline_ml_pipeline_construct_destroy_p", ITc_nnstreamer_pipeline_ml_pipeline_construct_destroy_p, ITs_nnstreamer_pipeline_startup, ITs_nnstreamer_pipeline_cleanup},
@@ -140,6 +142,8 @@ testcase tc_array[] = {
 {"ITc_nnstreamer_ml_option_create_destroy_p", ITc_nnstreamer_ml_option_create_destroy_p, ITs_nnstreamer_capi_startup, ITs_nnstreamer_capi_cleanup},
 {"ITc_nnstreamer_ml_option_set_p", ITc_nnstreamer_ml_option_set_p, ITs_nnstreamer_capi_startup, ITs_nnstreamer_capi_cleanup},
 {"ITc_nnstreamer_single_ml_single_open_with_option_p", ITc_nnstreamer_single_ml_single_open_with_option_p, ITs_nnstreamer_tensors_single_startup, ITs_nnstreamer_tensors_single_cleanup},
+{"ITc_nnstreamer_ml_service_launch_destroy_pipeline_p",ITc_nnstreamer_ml_service_launch_destroy_pipeline_p,ITs_nnstreamer_ml_service_startup, ITs_nnstreamer_ml_service_cleanup},
+{"ITc_nnstreamer_ml_service_start_stop_pipeline_p",ITc_nnstreamer_ml_service_start_stop_pipeline_p,ITs_nnstreamer_ml_service_startup, ITs_nnstreamer_ml_service_cleanup},
   {NULL, NULL}
 };