• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED.
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_SUITE_LOG_H
17 #define TEST_SUITE_LOG_H
18 
19 #include <stdint.h>
20 #include "common_def.h"
21 #include "errcode.h"
22 
23 #ifdef __cplusplus
24 #if __cplusplus
25 extern "C" {
26 #endif /* __cplusplus */
27 #endif /* __cplusplus */
28 
29 /**
30  * @defgroup test_common_testsuite_log Log
31  * @ingroup  test_common_testsuite
32  * @{
33  */
34 
35 /**
36  * @if Eng
37  * @brief  Register Test Suite Channel to the log.
38  * @else
39  * @brief  将测试套件的逻辑通道注册给记录。
40  * @endif
41  */
42 void test_suite_log_get_channel_funcs(void);
43 
44 /**
45  * @if Eng
46  * @brief  Logs a char over Test Suite Channel.
47  * @param  [in]  data the string to log.
48  * @else
49  * @brief  通过测试套件通道记录一个字符。
50  * @param  [in]  data 要记录的字符。
51  * @endif
52  */
53 
54 void test_suite_log_char(char data);
55 
56 /**
57  * @if Eng
58  * @brief  Logs a string over Test Suite Channel.
59  * @param  [in]  str the string to log.
60  * @else
61  * @brief  通过测试套件通道记录一个字符串。
62  * @param  [in]  str 要记录的字符串。
63  * @endif
64  */
65 void test_suite_log_string(const char *str);
66 
67 
68 /**
69  * @if Eng
70  * @brief  Logs a string with argument over Test Suite Channel.
71  * @param  [in]  str the string with argument to log.
72  * @else
73  * @brief  通过测试套件通道记录一个字符串。
74  * @param  [in]  str 要记录的字符串。
75  * @endif
76  */
77 void test_suite_log_stringf(const char *str, ...);
78 
79 /**
80  * @if Eng
81  * @brief  Logs a string over Test Suite Channel and adds "\r\n" at the end.
82  * @param  [in]  line the string to log.
83  * @else
84  * @brief  通过测试套件通道记录一个字符串并换行。
85  * @param  [in]  line 要记录的字符串。
86  * @endif
87  */
88 void test_suite_log_line(char *line);
89 
90 /**
91  * @if Eng
92  * @brief  Log latest test result.
93  * @param  [in]  result latest test result. For details, see @ref errcode_t.
94  * @else
95  * @brief  记录最后一次测试的结果。
96  * @param  [in]  result 最近一次的测试结果。 参考 see @ref errcode_t 。
97  * @endif
98  */
99 void test_suite_log_set_test_result(int result);
100 
101 /**
102  * @if Eng
103  * @brief  Get latest test result.
104  * @retval ERRCODE_SUCC Test success.
105  * @retval Other        Test failed. For details, see @ref errcode_t.
106  * @else
107  * @brief  获取最后一次的测试结果。
108  * @retval ERRCODE_SUCC 测试成功。
109  * @retval Other        测试失败。 参考 see @ref errcode_t 。
110  * @endif
111  */
112 int test_suite_log_get_test_result(void);
113 
114 /**
115  * @}
116  */
117 
118 #ifdef __cplusplus
119 #if __cplusplus
120 }
121 #endif /* __cplusplus */
122 #endif /* __cplusplus */
123 
124 #endif
125