1 /* 2 * Copyright (c) 2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef TEST_WUKONG_COMMON_H 17 #define TEST_WUKONG_COMMON_H 18 19 #include "errors.h" 20 #include "wukong_logger.h" 21 #include "wukong_util.h" 22 23 namespace OHOS { 24 namespace WuKong { 25 const uint32_t INVALIDVALUE = 0xFFFFFFFF; 26 const uint32_t WAIT_TIME = 1000000; 27 const uint32_t THREE_SECOND = 3000000; 28 const uint32_t LOG_MAX_NUM = 500; 29 #define COMPONENT_LEFT_SWAP 0X10000000 30 31 #define PARAM_COUNT_TIME_ERROR "has set '-T', can not set '-T' and '-c' at the same time" 32 #define PARAM_TIME_COUNT_ERROR "has set '-c', can not set '-c' and '-T' at the same time" 33 34 #define SEMPHORE_RUN_NAME "wukong_sem_run" 35 #define SEMPHORE_STOP_NAME "wukong_sem_stop" 36 37 #define DATA_PATH "/data" 38 #define WUKONG_PATH "/data/local/tmp/wukong/" 39 40 #define TRACK_LOG_STD() WuKongLogger::GetInstance()->Print(LOG_LEVEL_TRACK, "TRK : (%5d) %s START", __LINE__, __func__) 41 #define TRACK_LOG_END() WuKongLogger::GetInstance()->Print(LOG_LEVEL_TRACK, "TRK : (%5d) %s END", __LINE__, __func__) 42 #define TRACK_LOG_STR(format, ...) \ 43 WuKongLogger::GetInstance()->Print(LOG_LEVEL_TRACK, "TRK : (%5d) %s : " #format, __LINE__, __func__, __VA_ARGS__) 44 #define DEBUG_LOG_STR(format, ...) \ 45 WuKongLogger::GetInstance()->Print(LOG_LEVEL_DEBUG, "DBG : (%5d) %s : " #format, __LINE__, __func__, __VA_ARGS__) 46 #define INFO_LOG_STR(format, ...) \ 47 WuKongLogger::GetInstance()->Print(LOG_LEVEL_INFO, "INF : (%5d) %s : " #format, __LINE__, __func__, __VA_ARGS__) 48 #define WARN_LOG_STR(format, ...) \ 49 WuKongLogger::GetInstance()->Print(LOG_LEVEL_WARN, "WRN : (%5d) %s : " #format, __LINE__, __func__, __VA_ARGS__) 50 #define ERROR_LOG_STR(format, ...) \ 51 WuKongLogger::GetInstance()->Print(LOG_LEVEL_ERROR, "ERR : (%5d) %s : " #format, __LINE__, __func__, __VA_ARGS__) 52 #define TRACK_LOG(str) \ 53 WuKongLogger::GetInstance()->Print(LOG_LEVEL_TRACK, "TRK : (%5d) %s : %s", __LINE__, __func__, str) 54 #define DEBUG_LOG(str) \ 55 WuKongLogger::GetInstance()->Print(LOG_LEVEL_DEBUG, "DBG : (%5d) %s : %s", __LINE__, __func__, str) 56 #define INFO_LOG(str) WuKongLogger::GetInstance()->Print(LOG_LEVEL_INFO, "INF : (%5d) %s : %s", __LINE__, __func__, str) 57 #define WARN_LOG(str) WuKongLogger::GetInstance()->Print(LOG_LEVEL_WARN, "WRN : (%5d) %s : %s", __LINE__, __func__, str) 58 #define ERROR_LOG(str) \ 59 WuKongLogger::GetInstance()->Print(LOG_LEVEL_ERROR, "ERR : (%5d) %s : %s", __LINE__, __func__, str) 60 #define TEST_RUN_LOG(str) WuKongLogger::GetInstance()->Print(LOG_LEVEL_INFO, "RUN : %s", str) 61 } // namespace WuKong 62 } // namespace OHOS 63 #endif // TEST_WUKONG_COMMON_H 64