#include <unistd.h>
#include <string.h>
#include <sys/stat.h>
-#if 0 /* KDH */
-#include <system_info.h>
-#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;
}\
}
-#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;
}
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" ); \
fprintf(stdout, ##__VA_ARGS__ ); \
fprintf(stdout, "\n" ); \
} while(0)
+//=======================================================================================
-#endif
#ifdef __cplusplus
}
#include <gtest/gtest.h>
-
-#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 );
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
-
-#endif