From c7dee2990f57f793138fc59a3f10870cd36033df Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Tue, 22 Jun 2021 11:44:05 +0900 Subject: [PATCH] tc: skip the testcase when api does not support. skip some tbm_surface api which may not be supported. Change-Id: I0e143746004c5a81c8ab87501bc9eaa57907361a --- haltests/tc_tbm.h | 6 +++--- haltests/tc_tbm_surface_internal.cpp | 29 ++++++++++++++++++----------- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/haltests/tc_tbm.h b/haltests/tc_tbm.h index 21b703d..65196c5 100644 --- a/haltests/tc_tbm.h +++ b/haltests/tc_tbm.h @@ -64,10 +64,10 @@ EXPECT_TRUE(0);\ } while(0) -#define TBM_UT_SKIP_FLAG(FLAG) \ +#define TBM_UT_RETURN_TRUE_NOT_SUPPORTED(error) \ do {\ - if((FLAG)) {\ - TBM_UT_INFO(" [ SKIPPED ] not supported");\ + if((error == TBM_ERROR_NOT_SUPPORTED)) {\ + TBM_UT_WRN(" [ SKIPPED ] not supported");\ EXPECT_TRUE(1);\ return;\ }\ diff --git a/haltests/tc_tbm_surface_internal.cpp b/haltests/tc_tbm_surface_internal.cpp index 6b64b17..9823e01 100644 --- a/haltests/tc_tbm_surface_internal.cpp +++ b/haltests/tc_tbm_surface_internal.cpp @@ -687,12 +687,15 @@ TEST_F(TBMSurfaceInternal, DeleteUserDataSuccess) TEST_F(TBMSurfaceInternal, ExportNegative_InvalidParameters) { tbm_error_e error = TBM_ERROR_NONE; - - TBM_UT_SKIP_FLAG(!bufmgr->use_hal_tbm); + tbm_surface_buffer_data *buffer_data = NULL; // invalid surface test - EXPECT_EQ(tbm_surface_internal_export(invalid_surface, &error), nullptr); + buffer_data = tbm_surface_internal_export(invalid_surface, &error); + // skip this test if this api is not supported. + TBM_UT_RETURN_TRUE_NOT_SUPPORTED(error); + EXPECT_STREQ(tbm_error_str(error), tbm_error_str(TBM_ERROR_INVALID_PARAMETER)); + EXPECT_EQ(buffer_data, nullptr); } TEST_F(TBMSurfaceInternal, ExportPositive_Success) @@ -701,11 +704,12 @@ TEST_F(TBMSurfaceInternal, ExportPositive_Success) tbm_surface_buffer_data *buffer_data = NULL; unsigned int i; - TBM_UT_SKIP_FLAG(!bufmgr->use_hal_tbm); + buffer_data = tbm_surface_internal_export(surface, &error); + // skip this test if this api is not supported. + TBM_UT_RETURN_TRUE_NOT_SUPPORTED(error); - EXPECT_NE((buffer_data = tbm_surface_internal_export(surface, &error)), nullptr); EXPECT_STREQ(tbm_error_str(error), tbm_error_str(TBM_ERROR_NONE)); - + EXPECT_NE(buffer_data, nullptr); // verify the member variables of tbm_surface_buffer_data if (buffer_data) { EXPECT_GT(buffer_data->num_fds, 0); @@ -720,10 +724,12 @@ TEST_F(TBMSurfaceInternal, ImportNegative_InvalidParameters) tbm_error_e error = TBM_ERROR_NONE; tbm_surface_h surface1 = NULL; - TBM_UT_SKIP_FLAG(!bufmgr->use_hal_tbm); + // invalid surface test + surface1 = tbm_surface_internal_import(NULL, NULL, &error); + TBM_UT_RETURN_TRUE_NOT_SUPPORTED(error); - EXPECT_EQ((surface1 = tbm_surface_internal_import(NULL, NULL, &error)), nullptr); EXPECT_STREQ(tbm_error_str(error), tbm_error_str(TBM_ERROR_INVALID_PARAMETER)); + EXPECT_EQ(surface1, nullptr); } TEST_F(TBMSurfaceInternal, ImportPositive_Success) @@ -734,11 +740,12 @@ TEST_F(TBMSurfaceInternal, ImportPositive_Success) tbm_surface_h surface1 = NULL; unsigned int i; - TBM_UT_SKIP_FLAG(!bufmgr->use_hal_tbm); - // export surface_data - EXPECT_NE((buffer_data = tbm_surface_internal_export(surface, &error)), nullptr); + buffer_data = tbm_surface_internal_export(surface, &error); + TBM_UT_RETURN_TRUE_NOT_SUPPORTED(error); + EXPECT_STREQ(tbm_error_str(error), tbm_error_str(TBM_ERROR_NONE)); + EXPECT_NE(buffer_data, nullptr); // verify the member variables of tbm_surface_buffer_data if (buffer_data) { -- 2.7.4