1 /*
2 * Copyright (c) 2021 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 #include "subcommand_record_test.h"
17
18 #include <algorithm>
19 #include <chrono>
20 #include <cinttypes>
21 #include <sched.h>
22 #include <sstream>
23 #include <thread>
24
25 #include <poll.h>
26 #include <unistd.h>
27
28 #include "command.h"
29 #include "debug_logger.h"
30 #include "utilities.h"
31 #include <sys/stat.h>
32
33 using namespace std::literals::chrono_literals;
34 using namespace testing::ext;
35 using namespace std;
36 using namespace OHOS::HiviewDFX;
37 namespace OHOS {
38 namespace Developtools {
39 namespace HiPerf {
40 static const std::string TEST_FILE = "/data/local/tmp/perf.data";
41
42 class SubCommandRecordTest : public testing::Test {
43 public:
44 static void SetUpTestCase(void);
45 static void TearDownTestCase(void);
46 void SetUp();
47 void TearDown();
48
49 void TestEvents(std::string &opt, std::string &uk);
50
51 static void TestRecordCommand(const std::string &option, bool expect = true,
52 bool fixPid = true);
53
54 size_t GetFileSize(const char* fileName);
55
56 static constexpr size_t TEST_SIZE_F100_DWARF_SYSTEM = 1.4E4 * 1024;
57 static constexpr size_t TEST_SIZE_F500_DWARF_SYSTEM = 3.6E4 * 1024;
58 static constexpr size_t TEST_SIZE_F1000_DWARF_SYSTEM = 5.9E4 * 1024;
59 static constexpr size_t TEST_SIZE_F2000_DWARF_SYSTEM = 8.3E4 * 1024;
60 static constexpr size_t TEST_SIZE_F4000_DWARF_SYSTEM = 1.7E5 * 1024;
61 static constexpr size_t TEST_SIZE_F8000_DWARF_SYSTEM = 3.5E5 * 1024;
62 static constexpr size_t TEST_SIZE_F100_FP_SYSTEM = 8E3 * 1024;
63 static constexpr size_t TEST_SIZE_F500_FP_SYSTEM = 2E4 * 1024;
64 static constexpr size_t TEST_SIZE_F1000_FP_SYSTEM = 3E4 * 1024;
65 static constexpr size_t TEST_SIZE_F2000_FP_SYSTEM = 4E4 * 1024;
66 static constexpr size_t TEST_SIZE_F4000_FP_SYSTEM = 8E4 * 1024;
67 static constexpr size_t TEST_SIZE_F8000_FP_SYSTEM = 1.6E5 * 1024;
68
69 static constexpr size_t TEST_SIZE_F100_DWARF_PROCESS = 5.6E3 * 1024;
70 static constexpr size_t TEST_SIZE_F500_DWARF_PROCESS = 1.6E4 * 1024;
71 static constexpr size_t TEST_SIZE_F1000_DWARF_PROCESS = 2.9E4 * 1024;
72 static constexpr size_t TEST_SIZE_F2000_DWARF_PROCESS = 6.1E4 * 1024;
73 static constexpr size_t TEST_SIZE_F4000_DWARF_PROCESS = 5.8E4 * 1024;
74 static constexpr size_t TEST_SIZE_F8000_DWARF_PROCESS = 1.2E5 * 1024;
75 static constexpr size_t TEST_SIZE_F100_FP_PROCESS = 3.6E3 * 1024;
76 static constexpr size_t TEST_SIZE_F500_FP_PROCESS = 8.8E3 * 1024;
77 static constexpr size_t TEST_SIZE_F1000_FP_PROCESS = 1.5E4 * 1024;
78 static constexpr size_t TEST_SIZE_F2000_FP_PROCESS = 3.1E4 * 1024;
79 static constexpr size_t TEST_SIZE_F4000_FP_PROCESS = 6.2E4 * 1024;
80 static constexpr size_t TEST_SIZE_F8000_FP_PROCESS = 1.3E5 * 1024;
81 };
82
SetUpTestCase()83 void SubCommandRecordTest::SetUpTestCase() {}
84
TearDownTestCase()85 void SubCommandRecordTest::TearDownTestCase() {}
86
SetUp()87 void SubCommandRecordTest::SetUp()
88 {
89 SubCommand::ClearSubCommands(); // clear the subCommands left from other UT
90 ASSERT_EQ(SubCommand::GetSubCommands().size(), 0u);
91 SubCommandRecord::RegisterSubCommandRecord();
92 ASSERT_EQ(SubCommand::GetSubCommands().size(), 1u);
93 }
94
TearDown()95 void SubCommandRecordTest::TearDown()
96 {
97 ASSERT_EQ(SubCommand::GetSubCommands().size(), 1u);
98 SubCommand::ClearSubCommands();
99 ASSERT_EQ(SubCommand::GetSubCommands().size(), 0u);
100 MemoryHold::Get().Clean();
101 }
102
TestRecordCommand(const std::string & option,bool expect,bool fixPid)103 void SubCommandRecordTest::TestRecordCommand(const std::string &option, bool expect, bool fixPid)
104 {
105 StdoutRecord stdoutRecord;
106
107 std::string cmdString = "record ";
108 if (fixPid) {
109 cmdString += "--app com.ohos.launcher ";
110 }
111 cmdString += " " + option;
112 printf("command : %s\n", cmdString.c_str());
113
114 // it need load some symbols and much more log
115 stdoutRecord.Start();
116 const auto startTime = chrono::steady_clock::now();
117 bool ret = Command::DispatchCommand(cmdString);
118 const auto costMs = std::chrono::duration_cast<std::chrono::milliseconds>(
119 chrono::steady_clock::now() - startTime);
120 std::string stringOut = stdoutRecord.Stop();
121
122 printf("run %" PRId64 " ms return %s(expect %s)\n", (uint64_t)costMs.count(), ret ? "true" : "false",
123 expect ? "true" : "false");
124 EXPECT_EQ(expect, ret);
125 }
126
GetFileSize(const char * fileName)127 size_t SubCommandRecordTest::GetFileSize(const char* fileName)
128 {
129 if (fileName == nullptr) {
130 return 0;
131 }
132 struct stat statbuf;
133 stat(fileName, &statbuf);
134 size_t fileSize = statbuf.st_size;
135 return fileSize;
136 }
137
138 // app package name
139 HWTEST_F(SubCommandRecordTest, PackageName, TestSize.Level1)
140 {
141 TestRecordCommand("-d 2 --app com.ohos.launcher ", true, false);
142 }
143
144 HWTEST_F(SubCommandRecordTest, PackageNameErr, TestSize.Level1)
145 {
146 TestRecordCommand("-d 2 --app package_name ", false, false);
147 }
148
149 // check app milliseconds
150 /**
151 * @tc.name: CheckAppMsMin
152 * @tc.desc: Test chkms minimum value
153 * @tc.type: FUNC
154 * @tc.require: issueI5R305
155 */
156 HWTEST_F(SubCommandRecordTest, CheckAppMsMin, TestSize.Level1)
157 {
158 TestRecordCommand("-d 0.5 --chkms 1 ");
159 }
160
161 /**
162 * @tc.name: CheckAppMsMinErr
163 * @tc.desc: Test chkms less than minimum value
164 * @tc.type: FUNC
165 * @tc.require: issueI5R305
166 */
167 HWTEST_F(SubCommandRecordTest, CheckAppMsMinErr, TestSize.Level1)
168 {
169 TestRecordCommand("-d 0.5 --chkms 0 ", false);
170 }
171
172 /**
173 * @tc.name: CheckAppMsMax
174 * @tc.desc: Test chkms maximum value
175 * @tc.type: FUNC
176 * @tc.require: issueI5R305
177 */
178 HWTEST_F(SubCommandRecordTest, CheckAppMsMax, TestSize.Level1)
179 {
180 TestRecordCommand("-d 0.5 --chkms 200 ");
181 }
182
183 /**
184 * @tc.name: CheckAppMsMaxErr
185 * @tc.desc: Test chkms more than maximum value
186 * @tc.type: FUNC
187 * @tc.require: issueI5R305
188 */
189 HWTEST_F(SubCommandRecordTest, CheckAppMsMaxErr, TestSize.Level1)
190 {
191 TestRecordCommand("-d 0.5 --chkms 201 ", false);
192 }
193
194 /**
195 * @tc.name: CheckAppMsInputErr
196 * @tc.desc: Test erro type of chkms
197 * @tc.type: FUNC
198 * @tc.require: issueI5R305
199 */
200 HWTEST_F(SubCommandRecordTest, CheckAppMsInputErr, TestSize.Level1)
201 {
202 TestRecordCommand("-d 0.5 --chkms abc ", false);
203 }
204 // stop seconds
205 HWTEST_F(SubCommandRecordTest, StopSecondsMin, TestSize.Level1)
206 {
207 TestRecordCommand("-d 0.1 ");
208 }
209
210 HWTEST_F(SubCommandRecordTest, StopSecondsMinErr, TestSize.Level1)
211 {
212 TestRecordCommand("-d 0.099 ", false);
213 }
214
215 HWTEST_F(SubCommandRecordTest, StopSecondsMax, TestSize.Level1)
216 {
217 std::string opt = "-d 10000.0 ";
218 opt += " ls "; // because UT don't need wait so long
219 TestRecordCommand(opt, true, false);
220 }
221
222 HWTEST_F(SubCommandRecordTest, StopSecondsMaxErr, TestSize.Level1)
223 {
224 std::string opt = "-d 10000.1 ";
225 opt += " ";
226 TestRecordCommand(opt, false);
227 }
228
229 // system wide
230 HWTEST_F(SubCommandRecordTest, SystemWide, TestSize.Level1)
231 {
232 TestRecordCommand("-d 2 -a ", true, false);
233 }
234
235 // trackedCommand_
236 HWTEST_F(SubCommandRecordTest, TrackedCommandErr, TestSize.Level1)
237 {
238 TestRecordCommand("-d 2 -a aa ", false, false);
239 }
240
241 // --app and -p
242 HWTEST_F(SubCommandRecordTest, HasTargetErr, TestSize.Level1)
243 {
244 TestRecordCommand("--app test -p 123 -d 3 ", false, false);
245 }
246
247 HWTEST_F(SubCommandRecordTest, HasTargetErr1, TestSize.Level1)
248 {
249 TestRecordCommand("-d 3 ", false, false);
250 }
251
252 // exclude hiperf
253 HWTEST_F(SubCommandRecordTest, ExcludePerf, TestSize.Level1)
254 {
255 TestRecordCommand("-d 2 -a --exclude-hiperf ", true, false);
256 }
257
258 HWTEST_F(SubCommandRecordTest, ExcludePerfErr, TestSize.Level1)
259 {
260 TestRecordCommand("-d 2 --exclude-hiperf ", false, true);
261 }
262
263 // select cpu
264 HWTEST_F(SubCommandRecordTest, SelectCpu, TestSize.Level1)
265 {
266 TestRecordCommand("-d 2 -c 0 ");
267 }
268
269 HWTEST_F(SubCommandRecordTest, SelectCpuMulti, TestSize.Level1)
270 {
271 int maxCpuid = sysconf(_SC_NPROCESSORS_CONF);
272 std::string opt = "-d 2 -e sw-task-clock -c ";
273 for (int i = 0; i < maxCpuid; i++) {
274 opt += std::to_string(i);
275 opt += ",";
276 }
277 opt.pop_back();
278 opt += " ";
279 TestRecordCommand(opt);
280 }
281
282 HWTEST_F(SubCommandRecordTest, SelectCpuMinErr, TestSize.Level1)
283 {
284 TestRecordCommand("-d 2 -c -1 ", false);
285 }
286
287 HWTEST_F(SubCommandRecordTest, SelectCpuMaxErr, TestSize.Level1)
288 {
289 int maxCpuid = sysconf(_SC_NPROCESSORS_CONF);
290 std::string opt = "-d 2 -c ";
291 opt += std::to_string(maxCpuid);
292 opt += " ";
293 TestRecordCommand(opt, false);
294 }
295
296 HWTEST_F(SubCommandRecordTest, SelectCpuInputErr, TestSize.Level1)
297 {
298 TestRecordCommand("-d 2 -c abc ", false);
299 }
300
301 // --control
302 HWTEST_F(SubCommandRecordTest, CheckControlErr, TestSize.Level1)
303 {
304 TestRecordCommand("-a --control st", false, false);
305 }
306
307 // cpu percent
308 HWTEST_F(SubCommandRecordTest, CpuLimitMin, TestSize.Level1)
309 {
310 TestRecordCommand("-d 2 --cpu-limit 1 ");
311 }
312
313 HWTEST_F(SubCommandRecordTest, CpuLimitErr, TestSize.Level1)
314 {
315 TestRecordCommand("-d 2 --cpu-limit 0 ", false);
316 }
317
318 HWTEST_F(SubCommandRecordTest, CpuLimitMax, TestSize.Level1)
319 {
320 TestRecordCommand("-d 2 --cpu-limit 100 ");
321 }
322
323 HWTEST_F(SubCommandRecordTest, CpuLimitMaxErr, TestSize.Level1)
324 {
325 TestRecordCommand("-d 2 --cpu-limit 101 ", false);
326 }
327
328 HWTEST_F(SubCommandRecordTest, CpuLimitInputErr, TestSize.Level1)
329 {
330 TestRecordCommand("-d 2 --cpu-limit abc ", false);
331 }
332
333 // frequency
334 HWTEST_F(SubCommandRecordTest, FrequncyMin, TestSize.Level1)
335 {
336 TestRecordCommand("-d 2 -f 1 ");
337 }
338
339 HWTEST_F(SubCommandRecordTest, FrequncyMinErr, TestSize.Level1)
340 {
341 TestRecordCommand("-d 2 -f 0 ", false);
342 }
343
344 HWTEST_F(SubCommandRecordTest, FrequncyMax, TestSize.Level1)
345 {
346 TestRecordCommand("-d 2 -f 100000 ");
347 }
348
349 HWTEST_F(SubCommandRecordTest, FrequncyMaxErr, TestSize.Level1)
350 {
351 TestRecordCommand("-d 2 -f 100001 ", false);
352 }
353
354 HWTEST_F(SubCommandRecordTest, FrequncyInputErr, TestSize.Level1)
355 {
356 TestRecordCommand("-d 2 -f abc ", false);
357 }
358
359 // period
360 HWTEST_F(SubCommandRecordTest, PeriodMin, TestSize.Level1)
361 {
362 TestRecordCommand("-d 2 --period 1 ");
363 }
364
365 HWTEST_F(SubCommandRecordTest, PeriodMinErr, TestSize.Level1)
366 {
367 TestRecordCommand("-d 2 --period 0 ", false);
368 }
369
370 HWTEST_F(SubCommandRecordTest, PeriodMax, TestSize.Level1)
371 {
372 std::string opt = "-d 2 --period ";
373 opt += std::to_string(INT_MAX);
374 opt += " ";
375 TestRecordCommand(opt);
376 }
377
378 HWTEST_F(SubCommandRecordTest, PeriodMaxErr, TestSize.Level1)
379 {
380 std::string opt = "-d 2 --period ";
381 uint32_t value = static_cast<uint32_t>(INT_MAX) + 1;
382 opt += std::to_string(value);
383 opt += " ";
384 TestRecordCommand(opt, false);
385 }
386
387 HWTEST_F(SubCommandRecordTest, PeriodInputErr, TestSize.Level1)
388 {
389 TestRecordCommand("-d 2 --period abc ", false);
390 }
391
392 HWTEST_F(SubCommandRecordTest, PeriodAndFrequncyConflict, TestSize.Level1)
393 {
394 TestRecordCommand("-d 2 -f 2000 --period 10 ", false);
395 }
396
TestEvents(std::string & opt,std::string & uk)397 void SubCommandRecordTest::TestEvents(std::string &opt, std::string &uk)
398 {
399 PerfEvents perfEvents;
400 for (auto type : TYPE_CONFIGS) {
401 auto configs = perfEvents.GetSupportEvents(type.first);
402 if (configs.empty()) {
403 continue;
404 }
405
406 const int MAX_TESTEVENT = 5;
407 int testEventCount = MAX_TESTEVENT;
408 std::string cmdline = opt;
409 for (auto config : configs) {
410 if (testEventCount <= 0) {
411 break;
412 }
413 cmdline += config.second;
414 cmdline += uk;
415 cmdline += ",";
416 testEventCount--;
417 }
418 cmdline.pop_back(); // remove the last ','
419 TestRecordCommand(cmdline);
420 TearDown();
421 SetUp();
422 }
423 }
424
425 // select events
426 HWTEST_F(SubCommandRecordTest, SelectEvents, TestSize.Level1)
427 {
428 std::string opt = "-d 2 -c 0 -e ";
429 std::string uk = "";
430 TestEvents(opt, uk);
431 }
432
433 HWTEST_F(SubCommandRecordTest, SelectEventsUser, TestSize.Level1)
434 {
435 std::string opt = "-d 2 -c 0 -e ";
436 std::string uk = ":u";
437 TestEvents(opt, uk);
438 }
439
440 HWTEST_F(SubCommandRecordTest, SelectEventsKernel, TestSize.Level1)
441 {
442 std::string opt = "-d 2 -c 0 -e ";
443 std::string uk = ":k";
444 TestEvents(opt, uk);
445 }
446
447 HWTEST_F(SubCommandRecordTest, SelectEventsErr, TestSize.Level1)
448 {
449 TestRecordCommand("-d 2 -c 0 -e what ", false);
450 }
451
452 // select group events
453 HWTEST_F(SubCommandRecordTest, GroupEvents, TestSize.Level1)
454 {
455 std::string opt = "-d 2 -c 0 -g ";
456 std::string uk = "";
457 TestEvents(opt, uk);
458 }
459
460 HWTEST_F(SubCommandRecordTest, GroupEventsUser, TestSize.Level1)
461 {
462 std::string opt = "-d 2 -c 0 -g ";
463 std::string uk = ":u";
464 TestEvents(opt, uk);
465 }
466
467 HWTEST_F(SubCommandRecordTest, GroupEventsKernal, TestSize.Level1)
468 {
469 std::string opt = "-d 2 -c 0 -g ";
470 std::string uk = ":k";
471 TestEvents(opt, uk);
472 }
473
474 HWTEST_F(SubCommandRecordTest, GroupEventsErr, TestSize.Level1)
475 {
476 TestRecordCommand("-d 2 -c 0 -g what ", false);
477 }
478
479 HWTEST_F(SubCommandRecordTest, NoInherit, TestSize.Level1)
480 {
481 TestRecordCommand("-d 2 --no-inherit ");
482 }
483
484 // select pid
485 HWTEST_F(SubCommandRecordTest, SelectPid, TestSize.Level1)
486 {
487 TestRecordCommand("-d 2 -p 1 ", true, false);
488 }
489
490 HWTEST_F(SubCommandRecordTest, SelectPidMulti, TestSize.Level1)
491 {
492 TestRecordCommand("-d 2 -p 1,2,3 ", true, false);
493 }
494
495 HWTEST_F(SubCommandRecordTest, SelectPidMinErr, TestSize.Level1)
496 {
497 TestRecordCommand("-d 2 -p 0 ", false, false);
498 }
499
500 HWTEST_F(SubCommandRecordTest, SelectPidMinErr1, TestSize.Level1)
501 {
502 TestRecordCommand("-d 2 -p -1 ", false, false);
503 }
504
505 HWTEST_F(SubCommandRecordTest, SelectPidErr, TestSize.Level1)
506 {
507 TestRecordCommand("-d 2 -p 99999999 ", false, false);
508 }
509
510 HWTEST_F(SubCommandRecordTest, SelectPidInputErr, TestSize.Level1)
511 {
512 TestRecordCommand("-d 2 -p abc ", false, false);
513 }
514
515 HWTEST_F(SubCommandRecordTest, SelectPidInputConfict, TestSize.Level1)
516 {
517 TestRecordCommand("-d 2 -a -p 1 ", false, false);
518 }
519
520 // select tid
521 HWTEST_F(SubCommandRecordTest, SelectTid, TestSize.Level1)
522 {
523 TestRecordCommand("-d 2 -t 1 ", true, false);
524 }
525
526 HWTEST_F(SubCommandRecordTest, SelectTidMulti, TestSize.Level1)
527 {
528 TestRecordCommand("-d 2 -t 1,2,3 ", true, false);
529 }
530
531 HWTEST_F(SubCommandRecordTest, SelectTidMinErr, TestSize.Level1)
532 {
533 TestRecordCommand("-d 2 -t 0 ", false, false);
534 }
535
536 HWTEST_F(SubCommandRecordTest, SelectTidErr, TestSize.Level1)
537 {
538 TestRecordCommand("-d 2 -t 99999999 ", false, false);
539 }
540
541 HWTEST_F(SubCommandRecordTest, SelectTidInputErr, TestSize.Level1)
542 {
543 TestRecordCommand("-d 2 -t abc ", false, false);
544 }
545
546 // cpu off
547 HWTEST_F(SubCommandRecordTest, CpuOff, TestSize.Level1)
548 {
549 TestRecordCommand("-d 2 --offcpu ");
550 }
551
552 HWTEST_F(SubCommandRecordTest, BranchFilterAny, TestSize.Level1)
553 {
554 #if is_ohos
555 TestRecordCommand("-d 2 -j any ", false); // broad doesn't support
556 #else
557 TestRecordCommand("-d 2 -j any ");
558 #endif
559 }
560
561 HWTEST_F(SubCommandRecordTest, BranchFilterAnyCall, TestSize.Level1)
562 {
563 #if is_ohos
564 TestRecordCommand("-d 2 -j any_call ", false); // broad doesn't support
565 #else
566 TestRecordCommand("-d 2 -j any_call ");
567 #endif
568 }
569
570 HWTEST_F(SubCommandRecordTest, BranchFilterIndCall, TestSize.Level1)
571 {
572 #if is_ohos
573 TestRecordCommand("-d 2 -j ind_call ", false); // broad doesn't support
574 #else
575 TestRecordCommand("-d 2 -j ind_call ");
576 #endif
577 }
578
579 HWTEST_F(SubCommandRecordTest, BranchFilterAnyRet, TestSize.Level1)
580 {
581 #if is_ohos
582 TestRecordCommand("-d 2 -j any_ret ", false); // broad doesn't support
583 #else
584 TestRecordCommand("-d 2 -j any_ret ");
585 #endif
586 }
587
588 HWTEST_F(SubCommandRecordTest, BranchFilterOnlyCall, TestSize.Level1)
589 {
590 TestRecordCommand("-d 2 -j call ", false);
591 }
592
593 HWTEST_F(SubCommandRecordTest, BranchFilterAll, TestSize.Level1)
594 {
595 #if is_ohos
596 TestRecordCommand("-d 2 -j any,any_call,any_ret,ind_call,u,k ", false); // broad doesn't support
597 #else
598 TestRecordCommand("-d 2 -j any,any_call,any_ret,ind_call,u,k ");
599 #endif
600 }
601
602 HWTEST_F(SubCommandRecordTest, BranchFilterInputErr, TestSize.Level1)
603 {
604 TestRecordCommand("-d 2 -j what ", false);
605 }
606
607 HWTEST_F(SubCommandRecordTest, BranchFilterInputMoreErr, TestSize.Level1)
608 {
609 TestRecordCommand("-d 2 -j any,n ", false);
610 }
611
612 // call stack
613 HWTEST_F(SubCommandRecordTest, CallStackFp, TestSize.Level1)
614 {
615 TestRecordCommand("-d 2 --call-stack fp ");
616 TearDown();
617 SetUp();
618 TestRecordCommand("-d 2 -s fp ");
619 }
620
621 HWTEST_F(SubCommandRecordTest, CallStackFpInputMoreErr, TestSize.Level1)
622 {
623 TestRecordCommand("-d 2 --call-stack fp,abc ", false);
624 TearDown();
625 SetUp();
626 TestRecordCommand("-d 2 -s fp,abc ", false);
627 }
628
629 HWTEST_F(SubCommandRecordTest, CallStackInputErr, TestSize.Level1)
630 {
631 TestRecordCommand("-d 2 --call-stack what ", false);
632 TearDown();
633 SetUp();
634 TestRecordCommand("-d 2 -s what ", false);
635 }
636
637 HWTEST_F(SubCommandRecordTest, CallStackDwarfSizeMin, TestSize.Level1)
638 {
639 // it will cause some crash in -fprofile-arcs and -ftest-coverage
640 // we will fix it latter
641 TestRecordCommand("-d 2 --call-stack dwarf,8 ");
642 TearDown();
643 SetUp();
644 TestRecordCommand("-d 2 -s dwarf,8 ");
645 }
646
647 HWTEST_F(SubCommandRecordTest, CallStackDwarfSizeMinErr, TestSize.Level1)
648 {
649 TestRecordCommand("-d 2 --call-stack dwarf,7 ", false);
650 TearDown();
651 SetUp();
652 TestRecordCommand("-d 2 -s dwarf,7 ", false);
653 }
654
655 HWTEST_F(SubCommandRecordTest, CallStackDwarfSizeMax, TestSize.Level1)
656 {
657 TestRecordCommand("-d 2 --call-stack dwarf,65528 ");
658 TearDown();
659 SetUp();
660 TestRecordCommand("-d 2 -s dwarf,65528 ");
661 }
662
663 HWTEST_F(SubCommandRecordTest, CallStackDwarfSizeMaxErr, TestSize.Level1)
664 {
665 TestRecordCommand("-d 2 --call-stack dwarf,65529 ", false);
666 TearDown();
667 SetUp();
668 TestRecordCommand("-d 2 -s dwarf,65529 ", false);
669 }
670
671 HWTEST_F(SubCommandRecordTest, CallStackDwarfSizeErr, TestSize.Level1)
672 {
673 TestRecordCommand("-d 2 --call-stack dwarf,15 ", false);
674 TearDown();
675 SetUp();
676 TestRecordCommand("-d 2 -s dwarf,15 ", false);
677 }
678
679 HWTEST_F(SubCommandRecordTest, CallStackDwarfSizeInputErr, TestSize.Level1)
680 {
681 TestRecordCommand("-d 2 --call-stack dwarf,abc ", false);
682 TearDown();
683 SetUp();
684 TestRecordCommand("-d 2 -s dwarf,abc ", false);
685 }
686
687 HWTEST_F(SubCommandRecordTest, CallStackDwarfSizeInputMoreErr, TestSize.Level1)
688 {
689 TestRecordCommand("-d 2 --call-stack dwarf,16,32 ", false);
690 TearDown();
691 SetUp();
692 TestRecordCommand("-d 2 -s dwarf,16,32 ", false);
693 }
694
695 HWTEST_F(SubCommandRecordTest, CallStackUsageErr, TestSize.Level1)
696 {
697 TestRecordCommand("-d 2 -s abc --call-stack bcd", false);
698 }
699
700 // unwind
701 HWTEST_F(SubCommandRecordTest, DlayUnwind, TestSize.Level1)
702 {
703 TestRecordCommand("-d 2 -s dwarf,16 --delay-unwind ");
704 }
705
706 HWTEST_F(SubCommandRecordTest, DisableUnwind, TestSize.Level1)
707 {
708 TestRecordCommand("-d 2 -s dwarf,16 --disable-unwind ");
709 }
710
711 HWTEST_F(SubCommandRecordTest, DisableCallstackMerge, TestSize.Level1)
712 {
713 TestRecordCommand("-d 2 -s dwarf,16 --disable-callstack-expand ");
714 }
715
716 // symbol dir
717 HWTEST_F(SubCommandRecordTest, SymbolDir, TestSize.Level1)
718 {
719 TestRecordCommand("-d 2 --symbol-dir ./ ");
720 }
721
722 HWTEST_F(SubCommandRecordTest, SymbolDirErr, TestSize.Level1)
723 {
724 TestRecordCommand("-d 2 --symbol-dir where ", false);
725 }
726
727 // clock id
728 HWTEST_F(SubCommandRecordTest, ClockIdMonotonic, TestSize.Level1)
729 {
730 TestRecordCommand("-d 2 --clockid monotonic ");
731 }
732
733 HWTEST_F(SubCommandRecordTest, ClockIdMonotonicRaw, TestSize.Level1)
734 {
735 TestRecordCommand("-d 2 --clockid monotonic_raw ");
736 }
737
738 HWTEST_F(SubCommandRecordTest, ClockIdBoottime, TestSize.Level1)
739 {
740 TestRecordCommand("-c 0 -d 2 -e sw-task-clock --clockid boottime ");
741 }
742
743 HWTEST_F(SubCommandRecordTest, ClockIdRealtime, TestSize.Level1)
744 {
745 TestRecordCommand("-c 0 -d 2 -e sw-task-clock --clockid realtime ");
746 }
747
748 HWTEST_F(SubCommandRecordTest, ClockIdClockTai, TestSize.Level1)
749 {
750 TestRecordCommand("-c 0 -d 2 -e sw-task-clock --clockid clock_tai ");
751 }
752
753 HWTEST_F(SubCommandRecordTest, ClockIdInputErr, TestSize.Level1)
754 {
755 TestRecordCommand("-c 0 -d 2 --clockid what ", false);
756 }
757
758 // mmap pages
759 HWTEST_F(SubCommandRecordTest, MmapPagesPower2Err, TestSize.Level1)
760 {
761 TestRecordCommand("-d 2 -m 101 ", false);
762 }
763
764 HWTEST_F(SubCommandRecordTest, MmapPagesMin, TestSize.Level1)
765 {
766 TestRecordCommand("-d 2 -m 2 ");
767 }
768
769 HWTEST_F(SubCommandRecordTest, MmapPagesMinErr, TestSize.Level1)
770 {
771 TestRecordCommand("-d 2 -m 1 ", false);
772 }
773
774 HWTEST_F(SubCommandRecordTest, MmapPagesMax, TestSize.Level1)
775 {
776 TestRecordCommand("-d 2 -m 1024 ");
777 }
778
779 HWTEST_F(SubCommandRecordTest, MmapPagesMaxErr, TestSize.Level1)
780 {
781 TestRecordCommand("-d 2 -m 1025 ", false);
782 }
783
784 HWTEST_F(SubCommandRecordTest, MmapPagesInputErr, TestSize.Level1)
785 {
786 TestRecordCommand("-d 2 -m abc ", false);
787 }
788
789 // output file name
790 HWTEST_F(SubCommandRecordTest, OutputFileName, TestSize.Level1)
791 {
792 TestRecordCommand("-d 2 -o /data/local/tmp/output.perf.data ");
793 }
794
795 HWTEST_F(SubCommandRecordTest, OutputFileNameErr, TestSize.Level1)
796 {
797 TestRecordCommand("-d 2 -o nopath/output.perf.data ", false);
798 }
799
800 // data size limit
801 HWTEST_F(SubCommandRecordTest, DataLimit, TestSize.Level1)
802 {
803 TestRecordCommand("-d 2 --data-limit 1K ");
804 TearDown();
805 SetUp();
806 TestRecordCommand("-d 2 --data-limit 1M ");
807 TearDown();
808 SetUp();
809 TestRecordCommand("-d 2 --data-limit 1G ");
810 }
811
812 HWTEST_F(SubCommandRecordTest, DataLimit1, TestSize.Level1)
813 {
814 TestRecordCommand("-a --data-limit 1K ", true, false);
815 }
816
817 HWTEST_F(SubCommandRecordTest, DataLimitErr, TestSize.Level1)
818 {
819 TestRecordCommand("-d 2 --data-limit 10A ", false);
820 TearDown();
821 SetUp();
822 TestRecordCommand("-d 2 --data-limit 0G ", false);
823 }
824
825 HWTEST_F(SubCommandRecordTest, RecordCompress, TestSize.Level1)
826 {
827 TestRecordCommand("-d 2 -z ");
828 }
829
830 HWTEST_F(SubCommandRecordTest, Verbose, TestSize.Level1)
831 {
832 TestRecordCommand("-d 2 --verbose ");
833 }
834
835 HWTEST_F(SubCommandRecordTest, DumpOptions, TestSize.Level1)
836 {
837 StdoutRecord stdoutRecord;
838 stdoutRecord.Start();
839 SubCommandRecord cmd;
840 cmd.DumpOptions();
841 std::string stringOut = stdoutRecord.Stop();
842 EXPECT_TRUE(stringOut.find("cpuPercent: 25") != std::string::npos);
843 EXPECT_TRUE(stringOut.find("mmapPages_: 1024") != std::string::npos);
844 }
845
846 /**
847 * @tc.name: FileSizeOnFrequency100_DWARF_SYSTEM
848 * @tc.desc: Test size of file generated under system wide frequency 100 and dwarf unwind
849 * @tc.type: FUNC
850 */
851 HWTEST_F(SubCommandRecordTest, FileSizeOnFrequency100_DWARF_SYSTEM, TestSize.Level1)
852 {
853 TestRecordCommand("-d 10 -a -f 100 -s dwarf", true, false);
854 std::string fileName = TEST_FILE;
855 size_t fileSize = GetFileSize(fileName.c_str());
856 EXPECT_LE(fileSize, TEST_SIZE_F100_DWARF_SYSTEM);
857 }
858
859 /**
860 * @tc.name: FileSizeOnFrequency500_DWARF_SYSTEM
861 * @tc.desc: Test size of file generated under system wide frequency 500 and dwarf unwind
862 * @tc.type: FUNC
863 */
864 HWTEST_F(SubCommandRecordTest, FileSizeOnFrequency500_DWARF_SYSTEM, TestSize.Level1)
865 {
866 TestRecordCommand("-d 10 -a -f 500 -s dwarf", true, false);
867 std::string fileName = TEST_FILE;
868 size_t fileSize = GetFileSize(fileName.c_str());
869 EXPECT_LE(fileSize, TEST_SIZE_F500_DWARF_SYSTEM);
870 }
871
872 /**
873 * @tc.name: FileSizeOnFrequency1000_DWARF_SYSTEM
874 * @tc.desc: Test size of file generated under system wide frequency 1000 and dwarf unwind
875 * @tc.type: FUNC
876 */
877 HWTEST_F(SubCommandRecordTest, FileSizeOnFrequency1000_DWARF_SYSTEM, TestSize.Level1)
878 {
879 TestRecordCommand("-d 10 -a -f 1000 -s dwarf", true, false);
880 std::string fileName = TEST_FILE;
881 size_t fileSize = GetFileSize(fileName.c_str());
882 EXPECT_LE(fileSize, TEST_SIZE_F1000_DWARF_SYSTEM);
883 }
884
885 /**
886 * @tc.name: FileSizeOnFrequency2000_DWARF_SYSTEM
887 * @tc.desc: Test size of file generated under system wide frequency 2000 and dwarf unwind
888 * @tc.type: FUNC
889 */
890 HWTEST_F(SubCommandRecordTest, FileSizeOnFrequency2000_DWARF_SYSTEM, TestSize.Level1)
891 {
892 TestRecordCommand("-d 10 -a -f 2000 -s dwarf", true, false);
893 std::string fileName = TEST_FILE;
894 size_t fileSize = GetFileSize(fileName.c_str());
895 EXPECT_LE(fileSize, TEST_SIZE_F2000_DWARF_SYSTEM);
896 }
897
898 /**
899 * @tc.name: FileSizeOnFrequency4000_DWARF_SYSTEM
900 * @tc.desc: Test size of file generated under system wide frequency 4000 and dwarf unwind
901 * @tc.type: FUNC
902 */
903 HWTEST_F(SubCommandRecordTest, FileSizeOnFrequency4000_DWARF_SYSTEM, TestSize.Level1)
904 {
905 TestRecordCommand("-d 10 -a -f 4000 -s dwarf", true, false);
906 std::string fileName = TEST_FILE;
907 size_t fileSize = GetFileSize(fileName.c_str());
908 EXPECT_LE(fileSize, TEST_SIZE_F4000_DWARF_SYSTEM);
909 }
910
911 /**
912 * @tc.name: FileSizeOnFrequency8000_DWARF_SYSTEM
913 * @tc.desc: Test size of file generated under system wide frequency 8000 and dwarf unwind
914 * @tc.type: FUNC
915 */
916 HWTEST_F(SubCommandRecordTest, FileSizeOnFrequency8000_DWARF_SYSTEM, TestSize.Level1)
917 {
918 TestRecordCommand("-d 10 -a -f 8000 -s dwarf", true, false);
919 std::string fileName = TEST_FILE;
920 size_t fileSize = GetFileSize(fileName.c_str());
921 EXPECT_LE(fileSize, TEST_SIZE_F8000_DWARF_SYSTEM);
922 }
923
924 /**
925 * @tc.name: FileSizeOnFrequency100_FP_SYSTEM
926 * @tc.desc: Test size of file generated under system wide frequency 100 and fp unwind
927 * @tc.type: FUNC
928 */
929 HWTEST_F(SubCommandRecordTest, FileSizeOnFrequency100_FP_SYSTEM, TestSize.Level1)
930 {
931 TestRecordCommand("-d 10 -a -f 100 -s fp", true, false);
932 std::string fileName = TEST_FILE;
933 size_t fileSize = GetFileSize(fileName.c_str());
934 EXPECT_LE(fileSize, TEST_SIZE_F100_FP_SYSTEM);
935 }
936
937 /**
938 * @tc.name: FileSizeOnFrequency500_FP_SYSTEM
939 * @tc.desc: Test size of file generated under system wide frequency 500 and fp unwind
940 * @tc.type: FUNC
941 */
942 HWTEST_F(SubCommandRecordTest, FileSizeOnFrequency500_FP_SYSTEM, TestSize.Level1)
943 {
944 TestRecordCommand("-d 10 -a -f 500 -s fp", true, false);
945 std::string fileName = TEST_FILE;
946 size_t fileSize = GetFileSize(fileName.c_str());
947 EXPECT_LE(fileSize, TEST_SIZE_F500_FP_SYSTEM);
948 }
949
950 /**
951 * @tc.name: FileSizeOnFrequency1000_FP_SYSTEM
952 * @tc.desc: Test size of file generated under system wide frequency 1000 and fp unwind
953 * @tc.type: FUNC
954 */
955 HWTEST_F(SubCommandRecordTest, FileSizeOnFrequency1000_FP_SYSTEM, TestSize.Level1)
956 {
957 TestRecordCommand("-d 10 -a -f 1000 -s fp", true, false);
958 std::string fileName = TEST_FILE;
959 size_t fileSize = GetFileSize(fileName.c_str());
960 EXPECT_LE(fileSize, TEST_SIZE_F1000_FP_SYSTEM);
961 }
962
963 /**
964 * @tc.name: FileSizeOnFrequency2000_FP_SYSTEM
965 * @tc.desc: Test size of file generated under system wide frequency 2000 and fp unwind
966 * @tc.type: FUNC
967 */
968 HWTEST_F(SubCommandRecordTest, FileSizeOnFrequency2000_FP_SYSTEM, TestSize.Level1)
969 {
970 TestRecordCommand("-d 10 -a -f 2000 -s fp", true, false);
971 std::string fileName = TEST_FILE;
972 size_t fileSize = GetFileSize(fileName.c_str());
973 EXPECT_LE(fileSize, TEST_SIZE_F2000_FP_SYSTEM);
974 }
975
976 /**
977 * @tc.name: FileSizeOnFrequency4000_FP_SYSTEM
978 * @tc.desc: Test size of file generated under system wide frequency 4000 and fp unwind
979 * @tc.type: FUNC
980 */
981 HWTEST_F(SubCommandRecordTest, FileSizeOnFrequency4000_FP_SYSTEM, TestSize.Level1)
982 {
983 TestRecordCommand("-d 10 -a -f 4000 -s fp", true, false);
984 std::string fileName = TEST_FILE;
985 size_t fileSize = GetFileSize(fileName.c_str());
986 EXPECT_LE(fileSize, TEST_SIZE_F4000_FP_SYSTEM);
987 }
988
989 /**
990 * @tc.name: FileSizeOnFrequency8000_FP_SYSTEM
991 * @tc.desc: Test size of file generated under system wide frequency 8000 and fp unwind
992 * @tc.type: FUNC
993 */
994 HWTEST_F(SubCommandRecordTest, FileSizeOnFrequency8000_FP_SYSTEM, TestSize.Level1)
995 {
996 TestRecordCommand("-d 10 -a -f 8000 -s fp", true, false);
997 std::string fileName = TEST_FILE;
998 size_t fileSize = GetFileSize(fileName.c_str());
999 EXPECT_LE(fileSize, TEST_SIZE_F8000_FP_SYSTEM);
1000 }
1001
1002 /**
1003 * @tc.name: FileSizeOnFrequency100_DWARF_PROCESS
1004 * @tc.desc: Test size of file generated under one process frequency 100 and dwarf unwind
1005 * @tc.type: FUNC
1006 */
1007 HWTEST_F(SubCommandRecordTest, FileSizeOnFrequency100_DWARF_PROCESS, TestSize.Level1)
1008 {
1009 TestRecordCommand("-d 10 --app com.ohos.systemui -f 100 -s dwarf", true, false);
1010 std::string fileName = TEST_FILE;
1011 size_t fileSize = GetFileSize(fileName.c_str());
1012 EXPECT_LE(fileSize, TEST_SIZE_F100_DWARF_PROCESS);
1013 }
1014
1015 /**
1016 * @tc.name: FileSizeOnFrequency500_DWARF_PROCESS
1017 * @tc.desc: Test size of file generated under one process frequency 500 and dwarf unwind
1018 * @tc.type: FUNC
1019 */
1020 HWTEST_F(SubCommandRecordTest, FileSizeOnFrequency500_DWARF_PROCESS, TestSize.Level1)
1021 {
1022 TestRecordCommand("-d 10 --app com.ohos.systemui -f 500 -s dwarf", true, false);
1023 std::string fileName = TEST_FILE;
1024 size_t fileSize = GetFileSize(fileName.c_str());
1025 EXPECT_LE(fileSize, TEST_SIZE_F500_DWARF_PROCESS);
1026 }
1027
1028 /**
1029 * @tc.name: FileSizeOnFrequency1000_DWARF_PROCESS
1030 * @tc.desc: Test size of file generated under one process frequency 1000 and dwarf unwind
1031 * @tc.type: FUNC
1032 */
1033 HWTEST_F(SubCommandRecordTest, FileSizeOnFrequency1000_DWARF_PROCESS, TestSize.Level1)
1034 {
1035 TestRecordCommand("-d 10 --app com.ohos.systemui -f 1000 -s dwarf", true, false);
1036 std::string fileName = TEST_FILE;
1037 size_t fileSize = GetFileSize(fileName.c_str());
1038 EXPECT_LE(fileSize, TEST_SIZE_F1000_DWARF_PROCESS);
1039 }
1040
1041 /**
1042 * @tc.name: FileSizeOnFrequency2000_DWARF_PROCESS
1043 * @tc.desc: Test size of file generated under one process frequency 2000 and dwarf unwind
1044 * @tc.type: FUNC
1045 */
1046 HWTEST_F(SubCommandRecordTest, FileSizeOnFrequency2000_DWARF_PROCESS, TestSize.Level1)
1047 {
1048 TestRecordCommand("-d 10 --app com.ohos.systemui -f 2000 -s dwarf", true, false);
1049 std::string fileName = TEST_FILE;
1050 size_t fileSize = GetFileSize(fileName.c_str());
1051 EXPECT_LE(fileSize, TEST_SIZE_F2000_DWARF_PROCESS);
1052 }
1053
1054 /**
1055 * @tc.name: FileSizeOnFrequency4000_DWARF_PROCESS
1056 * @tc.desc: Test size of file generated under one process frequency 4000 and dwarf unwind
1057 * @tc.type: FUNC
1058 */
1059 HWTEST_F(SubCommandRecordTest, FileSizeOnFrequency4000_DWARF_PROCESS, TestSize.Level1)
1060 {
1061 TestRecordCommand("-d 10 --app com.ohos.systemui -f 4000 -s dwarf", true, false);
1062 std::string fileName = TEST_FILE;
1063 size_t fileSize = GetFileSize(fileName.c_str());
1064 EXPECT_LE(fileSize, TEST_SIZE_F4000_DWARF_PROCESS);
1065 }
1066
1067 /**
1068 * @tc.name: FileSizeOnFrequency8000_DWARF_PROCESS
1069 * @tc.desc: Test size of file generated under one process frequency 8000 and dwarf unwind
1070 * @tc.type: FUNC
1071 */
1072 HWTEST_F(SubCommandRecordTest, FileSizeOnFrequency8000_DWARF_PROCESS, TestSize.Level1)
1073 {
1074 TestRecordCommand("-d 10 --app com.ohos.systemui -f 8000 -s dwarf", true, false);
1075 std::string fileName = TEST_FILE;
1076 size_t fileSize = GetFileSize(fileName.c_str());
1077 EXPECT_LE(fileSize, TEST_SIZE_F8000_DWARF_PROCESS);
1078 }
1079
1080 /**
1081 * @tc.name: FileSizeOnFrequency100_FP_PROCESS
1082 * @tc.desc: Test size of file generated under one process frequency 100 and fp unwind
1083 * @tc.type: FUNC
1084 */
1085 HWTEST_F(SubCommandRecordTest, FileSizeOnFrequency100_FP_PROCESS, TestSize.Level1)
1086 {
1087 TestRecordCommand("-d 10 --app com.ohos.systemui -f 100 -s fp", true, false);
1088 std::string fileName = TEST_FILE;
1089 size_t fileSize = GetFileSize(fileName.c_str());
1090 EXPECT_LE(fileSize, TEST_SIZE_F100_FP_PROCESS);
1091 }
1092
1093 /**
1094 * @tc.name: FileSizeOnFrequency500_FP_PROCESS
1095 * @tc.desc: Test size of file generated under one process frequency 500 and fp unwind
1096 * @tc.type: FUNC
1097 */
1098 HWTEST_F(SubCommandRecordTest, FileSizeOnFrequency500_FP_PROCESS, TestSize.Level1)
1099 {
1100 TestRecordCommand("-d 10 --app com.ohos.systemui -f 500 -s fp", true, false);
1101 std::string fileName = TEST_FILE;
1102 size_t fileSize = GetFileSize(fileName.c_str());
1103 EXPECT_LE(fileSize, TEST_SIZE_F500_FP_PROCESS);
1104 }
1105
1106 /**
1107 * @tc.name: FileSizeOnFrequency1000_FP_PROCESS
1108 * @tc.desc: Test size of file generated under one process frequency 1000 and fp unwind
1109 * @tc.type: FUNC
1110 */
1111 HWTEST_F(SubCommandRecordTest, FileSizeOnFrequency1000_FP_PROCESS, TestSize.Level1)
1112 {
1113 TestRecordCommand("-d 10 --app com.ohos.systemui -f 1000 -s fp", true, false);
1114 std::string fileName = TEST_FILE;
1115 size_t fileSize = GetFileSize(fileName.c_str());
1116 EXPECT_LE(fileSize, TEST_SIZE_F1000_FP_PROCESS);
1117 }
1118
1119 /**
1120 * @tc.name: FileSizeOnFrequency2000_FP_PROCESS
1121 * @tc.desc: Test size of file generated under one process frequency 2000 and fp unwind
1122 * @tc.type: FUNC
1123 */
1124 HWTEST_F(SubCommandRecordTest, FileSizeOnFrequency2000_FP_PROCESS, TestSize.Level1)
1125 {
1126 TestRecordCommand("-d 10 --app com.ohos.systemui -f 2000 -s fp", true, false);
1127 std::string fileName = TEST_FILE;
1128 size_t fileSize = GetFileSize(fileName.c_str());
1129 EXPECT_LE(fileSize, TEST_SIZE_F2000_FP_PROCESS);
1130 }
1131
1132 /**
1133 * @tc.name: FileSizeOnFrequency4000_FP_PROCESS
1134 * @tc.desc: Test size of file generated under one process frequency 4000 and fp unwind
1135 * @tc.type: FUNC
1136 */
1137 HWTEST_F(SubCommandRecordTest, FileSizeOnFrequency4000_FP_PROCESS, TestSize.Level1)
1138 {
1139 TestRecordCommand("-d 10 --app com.ohos.systemui -f 4000 -s fp", true, false);
1140 std::string fileName = TEST_FILE;
1141 size_t fileSize = GetFileSize(fileName.c_str());
1142 EXPECT_LE(fileSize, TEST_SIZE_F4000_FP_PROCESS);
1143 }
1144
1145 /**
1146 * @tc.name: FileSizeOnFrequency8000_FP_PROCESS
1147 * @tc.desc: Test size of file generated under one process frequency 8000 and fp unwind
1148 * @tc.type: FUNC
1149 */
1150 HWTEST_F(SubCommandRecordTest, FileSizeOnFrequency8000_FP_PROCESS, TestSize.Level1)
1151 {
1152 TestRecordCommand("-d 10 --app com.ohos.systemui -f 8000 -s fp", true, false);
1153 std::string fileName = TEST_FILE;
1154 size_t fileSize = GetFileSize(fileName.c_str());
1155 EXPECT_LE(fileSize, TEST_SIZE_F8000_FP_PROCESS);
1156 }
1157
1158 /**
1159 * @tc.name: ExcludeThreadName
1160 * @tc.desc: Test --exclude-thread option sucess
1161 * @tc.type: FUNC
1162 */
1163 HWTEST_F(SubCommandRecordTest, ExcludeThreadName, TestSize.Level1)
1164 {
1165 TestRecordCommand("-d 2 --exclude-thread DfxWatchdog ", true);
1166 }
1167
1168 /**
1169 * @tc.name: ExcludeThreadNames
1170 * @tc.desc: Test --exclude-thread option multi threads
1171 * @tc.type: FUNC
1172 */
1173 HWTEST_F(SubCommandRecordTest, ExcludeThreadNames, TestSize.Level1)
1174 {
1175 TestRecordCommand("-d 2 --exclude-thread DfxWatchdog,GC_WorkerThread ", true);
1176 }
1177
1178 /**
1179 * @tc.name: ExcludeErrorThreadName
1180 * @tc.desc: Test --exclude-thread option error thread name
1181 * @tc.type: FUNC
1182 */
1183 HWTEST_F(SubCommandRecordTest, ExcludeErrorThreadName, TestSize.Level1)
1184 {
1185 TestRecordCommand("-d 2 --exclude-thread test ", true);
1186 }
1187
1188 /**
1189 * @tc.name: ExcludeErrorThreadNames
1190 * @tc.desc: Test --exclude-thread option multi error thread names
1191 * @tc.type: FUNC
1192 */
1193 HWTEST_F(SubCommandRecordTest, ExcludeErrorThreadNames, TestSize.Level1)
1194 {
1195 TestRecordCommand("-d 2 --exclude-thread test1,test2 ", true);
1196 }
1197
1198 /**
1199 * @tc.name: ExcludeMixedThreadName
1200 * @tc.desc: Test --exclude-thread option mixed correct name and error name
1201 * @tc.type: FUNC
1202 */
1203 HWTEST_F(SubCommandRecordTest, ExcludeMixedThreadName, TestSize.Level1)
1204 {
1205 TestRecordCommand("-d 2 --exclude-thread DfxWatchdog,test ", true);
1206 }
1207 } // namespace HiPerf
1208 } // namespace Developtools
1209 } // namespace OHOS
1210