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