monitor: move to tools
[platform/core/uifw/libtdm.git] / utests / src / ut_tdm.h
index 9e4accd..63662e1 100644 (file)
@@ -38,8 +38,9 @@ extern bool enable_porting_debug;
 #define TDM_WRN(fmt, args...)  tdm_log_print(TDM_LOG_LEVEL_WRN, fmt, ##args)
 #define TDM_ERR(fmt, args...)  tdm_log_print(TDM_LOG_LEVEL_ERR, fmt, ##args)
 
-#define TDM_UT_INFO(fmt, args...) tdm_log_print_stdout(TDM_LOG_LEVEL_INFO, fmt, ##args)
-#define TDM_UT_ERR(fmt, args...)  tdm_log_print_stdout(TDM_LOG_LEVEL_ERR, fmt, ##args)
+#define TDM_UT_INFO(fmt, args...) tdm_log_printf(TDM_LOG_LEVEL_INFO, fmt, ##args)
+#define TDM_UT_WRN(fmt, args...)  tdm_log_printf(TDM_LOG_LEVEL_WRN, fmt, ##args)
+#define TDM_UT_ERR(fmt, args...)  tdm_log_printf(TDM_LOG_LEVEL_ERR, fmt, ##args)
 
 #define TDM_UT_ENTRY() \
     TDM_ERR("--------------------------------------------- %s", typeid(*this).name())
@@ -47,13 +48,13 @@ extern bool enable_porting_debug;
 #define TDM_UT_CHECK_FLAG(FLAG) \
        do {\
                if(!(FLAG)) \
-                       TDM_UT_INFO("[          ] not supported");\
+                       TDM_UT_WRN("[          ] not supported");\
        } while(0)
 
 #define TDM_UT_SKIP_FLAG(FLAG) \
        do {\
                if(!(FLAG)) {\
-                       TDM_UT_INFO("[  SKIPPED ] not supported");\
+                       TDM_UT_WRN("[  SKIPPED ] not supported");\
                        return;\
                }\
        } while(0)
@@ -104,46 +105,6 @@ extern bool enable_porting_debug;
                } \
        } while(0)
 
-#define TDM_UT_ASK_YNR(fmt, ...) \
-       do { \
-               if (enable_porting_debug) { \
-                       char ch; \
-                       printf(fmt" [Y]es, [n]o, [r]etry: ", ##__VA_ARGS__); \
-                       do { \
-                               ch = getchar(); \
-                               if (ch == '\n') \
-                                       ch = 'y'; \
-                               else { \
-                                       char tch; \
-                                       while ((tch = getchar()) != '\n' && tch != EOF); \
-                               } \
-                       } while (ch != 'y' && ch != 'Y' && ch != 'n' && ch != 'N' && ch != 'r' && ch != 'R'); \
-                       if (ch == 'n' || ch == 'N') \
-                               GTEST_FATAL_FAILURE_("tc failed"); \
-                       if (ch == 'r' || ch == 'R') \
-                               goto retry; \
-               } \
-       } while (0)
-
-#define TDM_UT_ASK_YN(fmt, ...) \
-                       do { \
-                               if (enable_porting_debug) { \
-                                       char ch; \
-                                       printf(fmt" [Y]es, [n]o: ", ##__VA_ARGS__); \
-                                       do { \
-                                               ch = getchar(); \
-                                               if (ch == '\n') \
-                                                       ch = 'y'; \
-                                               else { \
-                                                       char tch; \
-                                                       while ((tch = getchar()) != '\n' && tch != EOF); \
-                                               } \
-                                       } while (ch != 'y' && ch != 'Y' && ch != 'n' && ch != 'N'); \
-                                       if (ch == 'n' || ch == 'N') \
-                                               GTEST_FATAL_FAILURE_("tc failed"); \
-                               } \
-                       } while (0)
-
 #define TDM_UT_SIZE_ALIGN(value, base) (((value) + ((base) - 1)) & ~((base) - 1))
 
 #define TDM_UT_DUMP_DIR          "/tmp/tdm_dump"
@@ -277,4 +238,21 @@ public:
        void TearDown(void) { TDMBackendBasic::TearDown(); }
 };
 
+char ut_tdm_backend_getchar(void);
+
+#define TDM_UT_ASK_YNR(fmt, ...) \
+       do { \
+               if (enable_porting_debug) { \
+                       char ch; \
+                       do { \
+                               printf(fmt" [Y]es, [n]o, [r]etry): ", ##__VA_ARGS__); \
+                               ch = ut_tdm_backend_getchar(); \
+                       } while(ch != 'y' && ch != 'n' && ch != 'r'); \
+                       if (ch == 'n') \
+                               GTEST_FATAL_FAILURE_("tc failed"); \
+                       if (ch == 'r') \
+                               goto retry; \
+               } \
+       } while (0)
+
 #endif // _UT_TDM_H_