tbm_module: add tbm_module_bo_exportd_key and use it
[platform/core/uifw/libtbm.git] / haltests / tc_tbm.h
index 7393f8d..21b703d 100644 (file)
 #include <list>
 #include <climits>
 #include <pthread.h>
-#include <gtest/gtest.h>
+#include <gmock/gmock.h>
 #include <stdlib.h>
 #include <tbm_bufmgr_int.h>
 #include <wayland-server-protocol.h>
+#include <tbm_log.h>
+
+#undef TBM_DBG
+#undef TBM_INFO
+#undef TBM_WRN
+#undef TBM_ERR
+#define TBM_DBG(fmt, args...)  tbm_log_print(TBM_LOG_LEVEL_DBG, fmt, ##args)
+#define TBM_INFO(fmt, args...) tbm_log_print(TBM_LOG_LEVEL_INFO, fmt, ##args)
+#define TBM_WRN(fmt, args...)  tbm_log_print(TBM_LOG_LEVEL_WRN, fmt, ##args)
+#define TBM_ERR(fmt, args...)  tbm_log_print(TBM_LOG_LEVEL_ERR, fmt, ##args)
+
+#define TBM_UT_INFO(fmt, args...) tbm_log_print_stdout(TBM_LOG_LEVEL_INFO, fmt, ##args)
+#define TBM_UT_WRN(fmt, args...)  tbm_log_print_stdout(TBM_LOG_LEVEL_WRN, fmt, ##args)
+#define TBM_UT_ERR(fmt, args...)  tbm_log_print_stdout(TBM_LOG_LEVEL_ERR, fmt, ##args)
 
 #define TBM_UT_ENTRY() \
     TBM_INFO("--------------------------------------------- %s", typeid(*this).name())
 #define TBM_UT_CHECK_FLAG(FLAG) \
        do {\
                if(!(FLAG)) \
-                       TBM_INFO("[          ] not supported");\
+                       TBM_UT_INFO("     [          ] not supported");\
+                       EXPECT_TRUE(0);\
        } while(0)
 
 #define TBM_UT_SKIP_FLAG(FLAG) \
        do {\
-               if(!(FLAG)) {\
-                       TBM_INFO("[  SKIPPED ] not supported");\
+               if((FLAG)) {\
+                       TBM_UT_INFO("     [  SKIPPED ] not supported");\
+                       EXPECT_TRUE(1);\
                        return;\
                }\
        } while(0)
 
 #define TBM_UT_NEVER_GET_HERE() \
        do {\
-               TBM_INFO("!!! TBM UT NEVER GET HERE !!!");\
+               TBM_UT_INFO("!!! TBM UT NEVER GET HERE !!!");\
        } while(0)
 #define TBM_UT_RETURN_IF_FAIL(cond) { \
        if (!(cond)) { \
-               TBM_ERR("[%s,%d] '%s' failed", __FUNCTION__, __LINE__, #cond); \
+               TBM_UT_ERR("[%s,%d] '%s' failed", __FUNCTION__, __LINE__, #cond); \
                return; \
        } \
 }
 #define TBM_UT_RETURN_FALSE_IF_FAIL(cond) { \
        if (!(cond)) { \
-               TBM_ERR("[%s,%d] '%s' failed", __FUNCTION__, __LINE__, #cond); \
+               TBM_UT_ERR("[%s,%d] '%s' failed", __FUNCTION__, __LINE__, #cond); \
                return false; \
        } \
 }
 #define TBM_UT_GOTO_IF_FAIL(cond, dst) { \
        if (!(cond)) { \
-               TBM_ERR("[%s,%d] '%s' failed", __FUNCTION__, __LINE__, #cond); \
+               TBM_UT_ERR("[%s,%d] '%s' failed", __FUNCTION__, __LINE__, #cond); \
                goto dst; \
        } \
 }
 
 #define TBM_UT_DUMP_DIR            "/tmp/tbm_dump"
-#define UT_TBM_INVALID_VALUE       -42
+#define TBM_UT_INVALID_VALUE       -42
 #define TBM_UT_INVALID_UINT_VALUE  99999
-#define UT_TBM_BO_SIZE             1024
-#define UT_TBM_SURFACE_QUEUE_SIZE  4
+#define TBM_UT_BO_SIZE             1024
+#define TBM_UT_SURFACE_QUEUE_SIZE  4
 
 using ::testing::TestWithParam;
 using ::testing::Bool;
 using ::testing::Values;
 using ::testing::Combine;
 
-class TBMEnv : public TestWithParam< ::testing::tuple<bool, bool, const char*> >
+class TBMEnv : public TestWithParam< std::tuple<bool, bool, const char*> >
 {
 public:
        void SetUp(void);