From 7a4adeafeb162a3c10533dc7ad0a585d882110f1 Mon Sep 17 00:00:00 2001 From: DongHun Kwak Date: Wed, 22 Apr 2020 20:27:06 +0900 Subject: [PATCH] Refactoring removed unused code Change-Id: I7fb2a0bf9814df4bd3f868b4d27e034f759603b3 --- unittest/include/tct_common.h | 25 +++-------- unittest/tct-base-utils-core.cpp | 96 ---------------------------------------- 2 files changed, 6 insertions(+), 115 deletions(-) diff --git a/unittest/include/tct_common.h b/unittest/include/tct_common.h index aa09cc9..33c87bc 100755 --- a/unittest/include/tct_common.h +++ b/unittest/include/tct_common.h @@ -29,21 +29,13 @@ extern "C" { #include #include #include -#if 0 /* KDH */ -#include -#endif #define CONFIG_LINE_LEN_MAX 2048 #define CONFIG_VALUE_LEN_MAX 1024 -#if 0 /* KDH */ -#define UTC_LOG "/tmp/utclog_core" -#define TC_RESULT "/tmp/tcresult" -#else -#define UTC_LOG "utc.log" +#define UTC_LOG "utc.log" #define ERR_UTC_LOG "utc_error.log" -#define TC_RESULT "tc_result.log" -#endif +#define TC_RESULT "tc_result.log" FILE *g_fpLog; FILE *g_fpLogDump; @@ -201,12 +193,6 @@ else \ }\ } -#if 0 /* KDH */ -bool TCTCheckSystemInfoFeatureSupported(char* pszKey, char* pszModuleName); -char* TCTSystemInfoGetError(int nRet); -bool GetValueFromConfigFile(char* pstrKeyString, char* pstrValue, char* pstrModule); -bool GetValueForTCTSetting(char* pstrKeyString, char* pstrValue, char* pstrModule); -#else bool TCTCheckSystemInfoFeatureSupported(char* pszKey, char* pszModuleName){ return false; } @@ -219,9 +205,10 @@ bool GetValueFromConfigFile(char* pstrKeyString, char* pstrValue, char* pstrModu bool GetValueForTCTSetting(char* pstrKeyString, char* pstrValue, char* pstrModule){ return false; } -#endif -#if 1 /* KDH : Add Macro */ +//======================================================================================= +// changed logging macro +//======================================================================================= #define dlog_print( type, tag, ...) do{ \ fprintf(stdout, ##__VA_ARGS__ ); \ fprintf(stdout, "\n" ); \ @@ -231,8 +218,8 @@ bool GetValueForTCTSetting(char* pstrKeyString, char* pstrValue, char* pstrModul fprintf(stdout, ##__VA_ARGS__ ); \ fprintf(stdout, "\n" ); \ } while(0) +//======================================================================================= -#endif #ifdef __cplusplus } diff --git a/unittest/tct-base-utils-core.cpp b/unittest/tct-base-utils-core.cpp index 0ffd32c..332e5db 100644 --- a/unittest/tct-base-utils-core.cpp +++ b/unittest/tct-base-utils-core.cpp @@ -55,100 +55,6 @@ extern "C" { #include - -#if 0 /* KDH */ -static bool app_create(void *data) -{ - return true; -} - -static void app_control(app_control_h app_control, void *data) -{ - char* pszGetTCName = NULL; - int i=0, result=0, nRet=0; - nRet = app_control_get_extra_data(app_control, "testcase_name", &pszGetTCName); - if(nRet != APP_CONTROL_ERROR_NONE) - { - dlog_print(DLOG_ERROR, "NativeTCT", "[%s:%d] app_control_get_extra_data returns error = %d", __FUNCTION__, __LINE__, nRet); - PRINT_UTC_LOG("\\n[%s][Line : %d]Unable to fetch test case name: app_control_get_extra_data API call fails\\n", __FILE__, __LINE__); - PRINT_TC_RESULT("%d",1); - FREE_MEMORY_TC(pszGetTCName); - return; - } - - dlog_print(DLOG_INFO, "NativeTCT", "[%s:%d] Executing TC Name = %s", __FUNCTION__, __LINE__, pszGetTCName); - for ( i = 0; tc_array[i].name; i++ ) - { - if ( 0 == strncmp(pszGetTCName, tc_array[i].name, strlen(pszGetTCName)) ) - { - DUMP_UTC_ERRLOG(); - dlog_print(DLOG_INFO, "NativeTCT", "%s : Startup begin", pszGetTCName); - if ( tc_array[i].startup ) - { - tc_array[i].startup(); - } - dlog_print(DLOG_INFO, "NativeTCT", "%s : Startup end", pszGetTCName); - - dlog_print(DLOG_INFO, "NativeTCT", "%s : Body begin", pszGetTCName); - result = tc_array[i].function(); - dlog_print(DLOG_INFO, "NativeTCT", "%s returns value = %d", pszGetTCName, result); - dlog_print(DLOG_INFO, "NativeTCT", "%s : Body end", pszGetTCName); - - dlog_print(DLOG_INFO, "NativeTCT", "%s : Cleanup begin", pszGetTCName); - if ( tc_array[i].cleanup ) - { - tc_array[i].cleanup(); - } - dlog_print(DLOG_INFO, "NativeTCT", "%s : Cleanup end", pszGetTCName); - - CLOSE_UTC_ERRLOG(); - PRINT_TC_RESULT("%d",result); - FREE_MEMORY_TC(pszGetTCName); - return; - } - } - - dlog_print(DLOG_ERROR, "NativeTCT", "[%s:%d] Unable to execute %s : Unknown Test Case Name", __FUNCTION__, __LINE__, pszGetTCName); - PRINT_UTC_LOG("\\n[%s][Line : %d]Unable to execute %s : Unknown Test Case Name\\n", __FILE__, __LINE__, pszGetTCName); - PRINT_TC_RESULT("%d",1); - FREE_MEMORY_TC(pszGetTCName); - return; -} - -static void app_terminate(void *data) -{ - dlog_print(DLOG_INFO, "NativeTCT", "[%s:%d] Application Package is now Terminating", __FUNCTION__, __LINE__); -} - -int main(int argc, char *argv[]) -{ - int ret = 0; - - - ui_app_lifecycle_callback_s event_callback = {0,}; - event_callback.create = app_create; - event_callback.terminate = app_terminate; - event_callback.app_control = app_control; - - //setting gcda file location for coverage - setenv("GCOV_PREFIX","/tmp",1); - dlog_print(DLOG_INFO, "NativeTCT", "[%s:%d] Coverage *.gcda File location set to /tmp/home/abuild/rpmbuild/BUILD/ ", __FUNCTION__, __LINE__); - - dlog_print(DLOG_INFO, "NativeTCT", "[%s:%d] Application Main Function is Invoked", __FUNCTION__, __LINE__); - ret = ui_app_main(argc, argv, &event_callback, NULL); - if (ret != APP_ERROR_NONE) - { - dlog_print(DLOG_ERROR, "NativeTCT", "Application ui_app_main call gets failed. err = %d", ret); - PRINT_UTC_LOG("\\n[%s][Line : %d]Application ui_app_main call gets failed. err = %d\\n", __FILE__, __LINE__, ret); - PRINT_TC_RESULT("%d",1); - return ret; - } - - dlog_print(DLOG_INFO, "NativeTCT", "[%s:%d] Application Package is Terminated", __FUNCTION__, __LINE__); - return ret; -} -#else - TEST(base_utils, base_utils){ char *pszGetTCName = NULL; pszGetTCName = (char*)malloc( 256 ); @@ -205,5 +111,3 @@ int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } - -#endif -- 2.7.4