1 /*
2 * Copyright (c) 2023-2023 Huawei Device Co., Ltd. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without modification,
5 * are permitted provided that the following conditions are met:
6 *
7 * 1. Redistributions of source code must retain the above copyright notice, this list of
8 * conditions and the following disclaimer.
9 *
10 * 2. Redistributions in binary form must reproduce the above copyright notice, this list
11 * of conditions and the following disclaimer in the documentation and/or other materials
12 * provided with the distribution.
13 *
14 * 3. Neither the name of the copyright holder nor the names of its contributors may be used
15 * to endorse or promote products derived from this software without specific prior written
16 * permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
20 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
22 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
27 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30 #include <cstdio>
31 #include <climits>
32 #include <gtest/gtest.h>
33 #include "It_process_fs_test.h"
34
PrintTest(const CHAR * fmt,...)35 VOID PrintTest(const CHAR *fmt, ...)
36 {
37 #ifdef PRINT_TEST
38 va_list ap;
39 if (g_osLkHook != nullptr) {
40 va_start(ap, fmt);
41 printf(fmt, ap);
42 va_end(ap);
43 }
44 #endif
45 }
46
GenProcPidPath(int pid)47 std::string GenProcPidPath(int pid)
48 {
49 std::ostringstream buf;
50 buf << "/proc/" << pid;
51 return buf.str();
52 }
53
GenProcPidContainerPath(int pid,char * name)54 std::string GenProcPidContainerPath(int pid, char *name)
55 {
56 std::ostringstream buf;
57 buf << "/proc/" << pid << "/container/" << name;
58 return buf.str();
59 }
60
61
62 using namespace testing::ext;
63 namespace OHOS {
64 class ProcessFsTest : public testing::Test {
65 public:
SetUpTestCase(void)66 static void SetUpTestCase(void) {}
TearDownTestCase(void)67 static void TearDownTestCase(void) {}
68 };
69
70 #if defined(LOSCFG_USER_TEST_SMOKE)
71 /**
72 * @tc.name: Process_fs_Test_001
73 * @tc.desc: Process mount directory test
74 * @tc.type: FUNC
75 * @tc.require: issueI6AEVV
76 * @tc.author:
77 */
78 HWTEST_F(ProcessFsTest, ItProcessFs001, TestSize.Level0)
79 {
80 ItProcessFs001();
81 }
82
83 /**
84 * @tc.name: Process_fs_Test_002
85 * @tc.desc: System memory information acquisition test
86 * @tc.type: FUNC
87 * @tc.require: issueI6AMVG
88 * @tc.author:
89 */
90 HWTEST_F(ProcessFsTest, ItProcessFs002, TestSize.Level0)
91 {
92 ItProcessFs002();
93 }
94
95 /**
96 * @tc.name: Process_fs_Test_003
97 * @tc.desc: Get the file system type information supported by the system test
98 * @tc.type: FUNC
99 * @tc.require: issueI6AMVG
100 * @tc.author:
101 */
102 HWTEST_F(ProcessFsTest, ItProcessFs003, TestSize.Level0)
103 {
104 ItProcessFs003();
105 }
106
107 /**
108 * @tc.name: Process_fs_Test_004
109 * @tc.desc: Process memory information acquisition test
110 * @tc.type: FUNC
111 * @tc.require: issueI6AMVG
112 * @tc.author:
113 */
114 HWTEST_F(ProcessFsTest, ItProcessFs004, TestSize.Level0)
115 {
116 ItProcessFs004();
117 }
118
119 /**
120 * @tc.name: Process_fs_Test_005
121 * @tc.desc: Process cpup information acquisition test
122 * @tc.type: FUNC
123 * @tc.require: issueI6AMVG
124 * @tc.author:
125 */
126
127 HWTEST_F(ProcessFsTest, ItProcessFs005, TestSize.Level0)
128 {
129 ItProcessFs005();
130 }
131
132 /**
133 * @tc.name: Process_fs_Test_007
134 * @tc.desc: Process mount directory test
135 * @tc.type: FUNC
136 * @tc.require: issueI6AEVV
137 * @tc.author:
138 */
139 HWTEST_F(ProcessFsTest, ItProcessFs007, TestSize.Level0)
140 {
141 ItProcessFs007();
142 }
143
144 /**
145 * @tc.name: Process_fs_Test_008
146 * @tc.desc: Process mount directory test
147 * @tc.type: FUNC
148 * @tc.require: issueI6APW2
149 * @tc.author:
150 */
151 HWTEST_F(ProcessFsTest, ItProcessFs008, TestSize.Level0)
152 {
153 ItProcessFs008();
154 }
155
156 /**
157 * @tc.name: Process_fs_Test_010
158 * @tc.desc: Process mount directory test
159 * @tc.type: FUNC
160 * @tc.require: issueI6AEVV
161 * @tc.author:
162 */
163 HWTEST_F(ProcessFsTest, ItProcessFs010, TestSize.Level0)
164 {
165 ItProcessFs010();
166 }
167
168 /**
169 * @tc.name: Process_fs_Test_011
170 * @tc.desc: Process mount directory test
171 * @tc.type: FUNC
172 * @tc.require: issueI6E2LG
173 * @tc.author:
174 */
175 HWTEST_F(ProcessFsTest, ItProcessFs011, TestSize.Level0)
176 {
177 ItProcessFs011();
178 }
179
180 /**
181 * @tc.name: Process_fs_Test_012
182 * @tc.desc: Process mount directory test
183 * @tc.type: FUNC
184 * @tc.require: issueI6AEVV
185 * @tc.author:
186 */
187 HWTEST_F(ProcessFsTest, ItProcessFs012, TestSize.Level0)
188 {
189 ItProcessFs012();
190 }
191
192 /**
193 * @tc.name: Process_fs_Test_013
194 * @tc.desc: Process mount directory test
195 * @tc.type: FUNC
196 * @tc.require: issueI6AEVV
197 * @tc.author:
198 */
199 HWTEST_F(ProcessFsTest, ItProcessFs013, TestSize.Level0)
200 {
201 ItProcessFs013();
202 }
203
204 /**
205 * @tc.name: Process_fs_Test_014
206 * @tc.desc: Process mount directory test
207 * @tc.type: FUNC
208 * @tc.require: issueI6AEVV
209 * @tc.author:
210 */
211 HWTEST_F(ProcessFsTest, ItProcessFs014, TestSize.Level0)
212 {
213 ItProcessFs014();
214 }
215
216 /**
217 * @tc.name: Process_fs_Test_015
218 * @tc.desc: Process mount directory test
219 * @tc.type: FUNC
220 * @tc.require: issueI6AEVV
221 * @tc.author:
222 */
223 HWTEST_F(ProcessFsTest, ItProcessFs015, TestSize.Level0)
224 {
225 ItProcessFs015();
226 }
227
228 /**
229 * @tc.name: Process_fs_Test_021
230 * @tc.desc: Process mount directory test
231 * @tc.type: FUNC
232 * @tc.require: issueI6AVMY
233 * @tc.author:
234 */
235 HWTEST_F(ProcessFsTest, ItProcessFs021, TestSize.Level0)
236 {
237 ItProcessFs021();
238 }
239
240 /**
241 * @tc.name: Process_fs_Test_022
242 * @tc.desc: Process mount directory test
243 * @tc.type: FUNC
244 * @tc.require: issueI6B0A3
245 * @tc.author:
246 */
247 HWTEST_F(ProcessFsTest, ItProcessFs022, TestSize.Level0)
248 {
249 ItProcessFs022();
250 }
251 #endif
252 }
253