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