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
23namespace OHOS {
24namespace WuKong {
25const uint32_t INVALIDVALUE = 0xFFFFFFFF;
26const uint32_t WAIT_TIME = 1000000;
27const uint32_t THREE_SECOND = 3000000;
28#define COMPONENT_LEFT_SWAP 0X10000000
29
30#define PARAM_COUNT_TIME_ERROR "has set '-T', can not set '-T' and '-c' at the same time"
31#define PARAM_TIME_COUNT_ERROR "has set '-c', can not set '-c' and '-T' at the same time"
32
33#define SEMPHORE_RUN_NAME "wukong_sem_run"
34#define SEMPHORE_STOP_NAME "wukong_sem_stop"
35
36#define TRACK_LOG_STD() WuKongLogger::GetInstance()->Print(LOG_LEVEL_TRACK, "TRK : (%5d) %s START", __LINE__, __func__)
37#define TRACK_LOG_END() WuKongLogger::GetInstance()->Print(LOG_LEVEL_TRACK, "TRK : (%5d) %s END", __LINE__, __func__)
38#define TRACK_LOG_STR(format, ...) \
39    WuKongLogger::GetInstance()->Print(LOG_LEVEL_TRACK, "TRK : (%5d) %s : " #format, __LINE__, __func__, __VA_ARGS__)
40#define DEBUG_LOG_STR(format, ...) \
41    WuKongLogger::GetInstance()->Print(LOG_LEVEL_DEBUG, "DBG : (%5d) %s : " #format, __LINE__, __func__, __VA_ARGS__)
42#define INFO_LOG_STR(format, ...) \
43    WuKongLogger::GetInstance()->Print(LOG_LEVEL_INFO, "INF : (%5d) %s : " #format, __LINE__, __func__, __VA_ARGS__)
44#define WARN_LOG_STR(format, ...) \
45    WuKongLogger::GetInstance()->Print(LOG_LEVEL_WARN, "WRN : (%5d) %s : " #format, __LINE__, __func__, __VA_ARGS__)
46#define ERROR_LOG_STR(format, ...) \
47    WuKongLogger::GetInstance()->Print(LOG_LEVEL_ERROR, "ERR : (%5d) %s : " #format, __LINE__, __func__, __VA_ARGS__)
48#define TRACK_LOG(str) \
49    WuKongLogger::GetInstance()->Print(LOG_LEVEL_TRACK, "TRK : (%5d) %s : %s", __LINE__, __func__, str)
50#define DEBUG_LOG(str) \
51    WuKongLogger::GetInstance()->Print(LOG_LEVEL_DEBUG, "DBG : (%5d) %s : %s", __LINE__, __func__, str)
52#define INFO_LOG(str) WuKongLogger::GetInstance()->Print(LOG_LEVEL_INFO, "INF : (%5d) %s : %s", __LINE__, __func__, str)
53#define WARN_LOG(str) WuKongLogger::GetInstance()->Print(LOG_LEVEL_WARN, "WRN : (%5d) %s : %s", __LINE__, __func__, str)
54#define ERROR_LOG(str) \
55    WuKongLogger::GetInstance()->Print(LOG_LEVEL_ERROR, "ERR : (%5d) %s : %s", __LINE__, __func__, str)
56#define TEST_RUN_LOG(str) WuKongLogger::GetInstance()->Print(LOG_LEVEL_INFO, "RUN : %s", str)
57}  // namespace WuKong
58}  // namespace OHOS
59#endif  // TEST_WUKONG_COMMON_H
60