• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
32 using namespace std::literals::chrono_literals;
33 using namespace testing::ext;
34 using namespace std;
35 using namespace OHOS::HiviewDFX;
36 namespace OHOS {
37 namespace Developtools {
38 namespace HiPerf {
39 class SubCommandRecordTest : public testing::Test {
40 public:
41     static void SetUpTestCase(void);
42     static void TearDownTestCase(void);
43     void SetUp();
44     void TearDown();
45 
46     void TestEvents(std::string &opt, std::string &uk);
47 
48     static void TestRecordCommand(const std::string &option, bool expect = true,
49                                   bool fixPid = true);
50 };
51 
SetUpTestCase()52 void SubCommandRecordTest::SetUpTestCase() {}
53 
TearDownTestCase()54 void SubCommandRecordTest::TearDownTestCase() {}
55 
SetUp()56 void SubCommandRecordTest::SetUp()
57 {
58     SubCommand::ClearSubCommands(); // clear the subCommands left from other UT
59     ASSERT_EQ(SubCommand::GetSubCommands().size(), 0u);
60     SubCommandRecord::RegisterSubCommandRecord();
61     ASSERT_EQ(SubCommand::GetSubCommands().size(), 1u);
62 }
63 
TearDown()64 void SubCommandRecordTest::TearDown()
65 {
66     ASSERT_EQ(SubCommand::GetSubCommands().size(), 1u);
67     SubCommand::ClearSubCommands();
68     ASSERT_EQ(SubCommand::GetSubCommands().size(), 0u);
69     MemoryHold::Get().Clean();
70 }
71 
TestRecordCommand(const std::string & option,bool expect,bool fixPid)72 void SubCommandRecordTest::TestRecordCommand(const std::string &option, bool expect, bool fixPid)
73 {
74     StdoutRecord stdoutRecord;
75 
76     std::string cmdString = "record ";
77     if (fixPid) {
78         cmdString += "--app com.ohos.launcher ";
79     }
80     cmdString += " " + option;
81     printf("command : %s\n", cmdString.c_str());
82 
83     // it need load some symbols and much more log
84     stdoutRecord.Start();
85     const auto startTime = chrono::steady_clock::now();
86     bool ret = Command::DispatchCommand(cmdString);
87     const auto costMs = std::chrono::duration_cast<std::chrono::milliseconds>(
88         chrono::steady_clock::now() - startTime);
89     std::string stringOut = stdoutRecord.Stop();
90 
91     printf("run %" PRId64 " ms return %s(expect %s)\n", costMs.count(), ret ? "true" : "false",
92            expect ? "true" : "false");
93     EXPECT_EQ(expect, ret);
94 }
95 
96 // app package name
97 HWTEST_F(SubCommandRecordTest, PackageName, TestSize.Level1)
98 {
99     TestRecordCommand("-d 2  --app com.ohos.launcher ", true, false);
100 }
101 
102 HWTEST_F(SubCommandRecordTest, PackageNameErr, TestSize.Level1)
103 {
104     TestRecordCommand("-d 2  --app package_name ", false, false);
105 }
106 
107 // stop seconds
108 HWTEST_F(SubCommandRecordTest, StopSecondsMin, TestSize.Level1)
109 {
110     TestRecordCommand("-d 0.1 ");
111 }
112 
113 HWTEST_F(SubCommandRecordTest, StopSecondsMinErr, TestSize.Level1)
114 {
115     TestRecordCommand("-d 0.099 ", false);
116 }
117 
118 HWTEST_F(SubCommandRecordTest, StopSecondsMax, TestSize.Level1)
119 {
120     std::string opt = "-d 10000.0 ";
121     opt += " ls "; // because UT don't need wait so long
122     TestRecordCommand(opt, true, false);
123 }
124 
125 HWTEST_F(SubCommandRecordTest, StopSecondsMaxErr, TestSize.Level1)
126 {
127     std::string opt = "-d 10000.1 ";
128     opt += " ";
129     TestRecordCommand(opt, false);
130 }
131 
132 // system wide
133 HWTEST_F(SubCommandRecordTest, SystemWide, TestSize.Level1)
134 {
135     TestRecordCommand("-d 2 -a ", true, false);
136 }
137 
138 // exclude hiperf
139 HWTEST_F(SubCommandRecordTest, ExcludePerf, TestSize.Level1)
140 {
141     TestRecordCommand("-d 2 -a --exclude-hiperf ", true, false);
142 }
143 
144 // select cpu
145 HWTEST_F(SubCommandRecordTest, SelectCpu, TestSize.Level1)
146 {
147     TestRecordCommand("-d 2 -c 0 ");
148 }
149 
150 HWTEST_F(SubCommandRecordTest, SelectCpuMulti, TestSize.Level1)
151 {
152     int maxCpuid = sysconf(_SC_NPROCESSORS_CONF);
153     std::string opt = "-d 2 -e sw-task-clock -c ";
154     for (int i = 0; i < maxCpuid; i++) {
155         opt += std::to_string(i);
156         opt += ",";
157     }
158     opt.pop_back();
159     opt += " ";
160     TestRecordCommand(opt);
161 }
162 
163 HWTEST_F(SubCommandRecordTest, SelectCpuMinErr, TestSize.Level1)
164 {
165     TestRecordCommand("-d 2 -c -1 ", false);
166 }
167 
168 HWTEST_F(SubCommandRecordTest, SelectCpuMaxErr, TestSize.Level1)
169 {
170     int maxCpuid = sysconf(_SC_NPROCESSORS_CONF);
171     std::string opt = "-d 2 -c ";
172     opt += std::to_string(maxCpuid);
173     opt += " ";
174     TestRecordCommand(opt, false);
175 }
176 
177 HWTEST_F(SubCommandRecordTest, SelectCpuInputErr, TestSize.Level1)
178 {
179     TestRecordCommand("-d 2 -c abc ", false);
180 }
181 
182 // cpu percent
183 HWTEST_F(SubCommandRecordTest, CpuLimitMin, TestSize.Level1)
184 {
185     TestRecordCommand("-d 2 --cpu-limit 1 ");
186 }
187 
188 HWTEST_F(SubCommandRecordTest, CpuLimitErr, TestSize.Level1)
189 {
190     TestRecordCommand("-d 2 --cpu-limit 0 ", false);
191 }
192 
193 HWTEST_F(SubCommandRecordTest, CpuLimitMax, TestSize.Level1)
194 {
195     TestRecordCommand("-d 2 --cpu-limit 100 ");
196 }
197 
198 HWTEST_F(SubCommandRecordTest, CpuLimitMaxErr, TestSize.Level1)
199 {
200     TestRecordCommand("-d 2 --cpu-limit 101 ", false);
201 }
202 
203 HWTEST_F(SubCommandRecordTest, CpuLimitInputErr, TestSize.Level1)
204 {
205     TestRecordCommand("-d 2 --cpu-limit abc ", false);
206 }
207 
208 // frequency
209 HWTEST_F(SubCommandRecordTest, FrequncyMin, TestSize.Level1)
210 {
211     TestRecordCommand("-d 2 -f 1 ");
212 }
213 
214 HWTEST_F(SubCommandRecordTest, FrequncyMinErr, TestSize.Level1)
215 {
216     TestRecordCommand("-d 2 -f 0 ", false);
217 }
218 
219 HWTEST_F(SubCommandRecordTest, FrequncyMax, TestSize.Level1)
220 {
221     TestRecordCommand("-d 2 -f 100000 ");
222 }
223 
224 HWTEST_F(SubCommandRecordTest, FrequncyMaxErr, TestSize.Level1)
225 {
226     TestRecordCommand("-d 2 -f 100001 ", false);
227 }
228 
229 HWTEST_F(SubCommandRecordTest, FrequncyInputErr, TestSize.Level1)
230 {
231     TestRecordCommand("-d 2 -f abc ", false);
232 }
233 
234 // period
235 HWTEST_F(SubCommandRecordTest, PeriodMin, TestSize.Level1)
236 {
237     TestRecordCommand("-d 2 --period 1 ");
238 }
239 
240 HWTEST_F(SubCommandRecordTest, PeriodMinErr, TestSize.Level1)
241 {
242     TestRecordCommand("-d 2 --period 0 ", false);
243 }
244 
245 HWTEST_F(SubCommandRecordTest, PeriodMax, TestSize.Level1)
246 {
247     std::string opt = "-d 2 --period ";
248     opt += std::to_string(INT_MAX);
249     opt += " ";
250     TestRecordCommand(opt);
251 }
252 
253 HWTEST_F(SubCommandRecordTest, PeriodMaxErr, TestSize.Level1)
254 {
255     std::string opt = "-d 2 --period ";
256     opt += std::to_string(1l + INT_MAX);
257     opt += " ";
258     TestRecordCommand(opt, false);
259 }
260 
261 HWTEST_F(SubCommandRecordTest, PeriodInputErr, TestSize.Level1)
262 {
263     TestRecordCommand("-d 2 --period abc ", false);
264 }
265 
266 HWTEST_F(SubCommandRecordTest, PeriodAndFrequncyConflict, TestSize.Level1)
267 {
268     TestRecordCommand("-d 2 -f 2000 --period 10 ", false);
269 }
270 
TestEvents(std::string & opt,std::string & uk)271 void SubCommandRecordTest::TestEvents(std::string &opt, std::string &uk)
272 {
273     PerfEvents perfEvents;
274     for (auto type : TYPE_CONFIGS) {
275         auto configs = perfEvents.GetSupportEvents(type.first);
276         if (configs.empty()) {
277             continue;
278         }
279 
280         const int MAX_TESTEVENT = 5;
281         int testEventCount = MAX_TESTEVENT;
282         std::string cmdline = opt;
283         for (auto config : configs) {
284             if (testEventCount <= 0) {
285                 break;
286             }
287             cmdline += config.second;
288             cmdline += uk;
289             cmdline += ",";
290             testEventCount--;
291         }
292         cmdline.pop_back(); // remove the last ','
293         TestRecordCommand(cmdline);
294         TearDown();
295         SetUp();
296     }
297 }
298 
299 // select events
300 HWTEST_F(SubCommandRecordTest, SelectEvents, TestSize.Level1)
301 {
302     std::string opt = "-d 2 -c 0 -e ";
303     std::string uk = "";
304     TestEvents(opt, uk);
305 }
306 
307 HWTEST_F(SubCommandRecordTest, SelectEventsUser, TestSize.Level1)
308 {
309     std::string opt = "-d 2 -c 0 -e ";
310     std::string uk = ":u";
311     TestEvents(opt, uk);
312 }
313 
314 HWTEST_F(SubCommandRecordTest, SelectEventsKernel, TestSize.Level1)
315 {
316     std::string opt = "-d 2 -c 0 -e ";
317     std::string uk = ":k";
318     TestEvents(opt, uk);
319 }
320 
321 HWTEST_F(SubCommandRecordTest, SelectEventsErr, TestSize.Level1)
322 {
323     TestRecordCommand("-d 2 -c 0 -e what ", false);
324 }
325 
326 // select group events
327 HWTEST_F(SubCommandRecordTest, GroupEvents, TestSize.Level1)
328 {
329     std::string opt = "-d 2 -c 0 -g ";
330     std::string uk = "";
331     TestEvents(opt, uk);
332 }
333 
334 HWTEST_F(SubCommandRecordTest, GroupEventsUser, TestSize.Level1)
335 {
336     std::string opt = "-d 2 -c 0 -g ";
337     std::string uk = ":u";
338     TestEvents(opt, uk);
339 }
340 
341 HWTEST_F(SubCommandRecordTest, GroupEventsKernal, TestSize.Level1)
342 {
343     std::string opt = "-d 2 -c 0 -g ";
344     std::string uk = ":k";
345     TestEvents(opt, uk);
346 }
347 
348 HWTEST_F(SubCommandRecordTest, GroupEventsErr, TestSize.Level1)
349 {
350     TestRecordCommand("-d 2 -c 0 -g what ", false);
351 }
352 
353 HWTEST_F(SubCommandRecordTest, NoInherit, TestSize.Level1)
354 {
355     TestRecordCommand("-d 2 --no-inherit ");
356 }
357 
358 // select pid
359 HWTEST_F(SubCommandRecordTest, SelectPid, TestSize.Level1)
360 {
361     TestRecordCommand("-d 2 -p 1 ", true, false);
362 }
363 
364 HWTEST_F(SubCommandRecordTest, SelectPidMulti, TestSize.Level1)
365 {
366     TestRecordCommand("-d 2 -p 1,2,3 ", true, false);
367 }
368 
369 HWTEST_F(SubCommandRecordTest, SelectPidMinErr, TestSize.Level1)
370 {
371     TestRecordCommand("-d 2 -p 0 ", false, false);
372 }
373 
374 HWTEST_F(SubCommandRecordTest, SelectPidErr, TestSize.Level1)
375 {
376     TestRecordCommand("-d 2 -p 99999999 ", false, false);
377 }
378 
379 HWTEST_F(SubCommandRecordTest, SelectPidInputErr, TestSize.Level1)
380 {
381     TestRecordCommand("-d 2 -p abc ", false, false);
382 }
383 
384 // select tid
385 HWTEST_F(SubCommandRecordTest, SelectTid, TestSize.Level1)
386 {
387     TestRecordCommand("-d 2 -t 1 ", true, false);
388 }
389 
390 HWTEST_F(SubCommandRecordTest, SelectTidMulti, TestSize.Level1)
391 {
392     TestRecordCommand("-d 2 -t 1,2,3 ", true, false);
393 }
394 
395 HWTEST_F(SubCommandRecordTest, SelectTidMinErr, TestSize.Level1)
396 {
397     TestRecordCommand("-d 2 -t 0 ", false, false);
398 }
399 
400 HWTEST_F(SubCommandRecordTest, SelectTidErr, TestSize.Level1)
401 {
402     TestRecordCommand("-d 2 -t 99999999 ", false, false);
403 }
404 
405 HWTEST_F(SubCommandRecordTest, SelectTidInputErr, TestSize.Level1)
406 {
407     TestRecordCommand("-d 2 -t abc ", false, false);
408 }
409 
410 // cpu off
411 HWTEST_F(SubCommandRecordTest, CpuOff, TestSize.Level1)
412 {
413     TestRecordCommand("-d 2 --offcpu ");
414 }
415 
416 HWTEST_F(SubCommandRecordTest, BranchFilterAny, TestSize.Level1)
417 {
418 #if is_ohos
419     TestRecordCommand("-d 2 -j any ", false); // broad doesn't support
420 #else
421     TestRecordCommand("-d 2 -j any ");
422 #endif
423 }
424 
425 HWTEST_F(SubCommandRecordTest, BranchFilterAnyCall, TestSize.Level1)
426 {
427 #if is_ohos
428     TestRecordCommand("-d 2 -j any_call ", false); // broad doesn't support
429 #else
430     TestRecordCommand("-d 2 -j any_call ");
431 #endif
432 }
433 
434 HWTEST_F(SubCommandRecordTest, BranchFilterIndCall, TestSize.Level1)
435 {
436 #if is_ohos
437     TestRecordCommand("-d 2 -j ind_call ", false); // broad doesn't support
438 #else
439     TestRecordCommand("-d 2 -j ind_call ");
440 #endif
441 }
442 
443 HWTEST_F(SubCommandRecordTest, BranchFilterAnyRet, TestSize.Level1)
444 {
445 #if is_ohos
446     TestRecordCommand("-d 2 -j any_ret ", false); // broad doesn't support
447 #else
448     TestRecordCommand("-d 2 -j any_ret ");
449 #endif
450 }
451 
452 HWTEST_F(SubCommandRecordTest, BranchFilterOnlyCall, TestSize.Level1)
453 {
454     TestRecordCommand("-d 2 -j call ", false);
455 }
456 
457 HWTEST_F(SubCommandRecordTest, BranchFilterAll, TestSize.Level1)
458 {
459 #if is_ohos
460     TestRecordCommand("-d 2 -j any,any_call,any_ret,ind_call,u,k ", false); // broad doesn't support
461 #else
462     TestRecordCommand("-d 2 -j any,any_call,any_ret,ind_call,u,k ");
463 #endif
464 }
465 
466 HWTEST_F(SubCommandRecordTest, BranchFilterInputErr, TestSize.Level1)
467 {
468     TestRecordCommand("-d 2 -j what ", false);
469 }
470 
471 HWTEST_F(SubCommandRecordTest, BranchFilterInputMoreErr, TestSize.Level1)
472 {
473     TestRecordCommand("-d 2 -j any,n ", false);
474 }
475 
476 // call stack
477 HWTEST_F(SubCommandRecordTest, CallStackFp, TestSize.Level1)
478 {
479     TestRecordCommand("-d 2 --call-stack fp ");
480     TearDown();
481     SetUp();
482     TestRecordCommand("-d 2 -s fp ");
483 }
484 
485 HWTEST_F(SubCommandRecordTest, CallStackFpInputMoreErr, TestSize.Level1)
486 {
487     TestRecordCommand("-d 2 --call-stack fp,abc ", false);
488     TearDown();
489     SetUp();
490     TestRecordCommand("-d 2 -s fp,abc ", false);
491 }
492 
493 HWTEST_F(SubCommandRecordTest, CallStackInputErr, TestSize.Level1)
494 {
495     TestRecordCommand("-d 2 --call-stack what ", false);
496     TearDown();
497     SetUp();
498     TestRecordCommand("-d 2 -s what ", false);
499 }
500 
501 HWTEST_F(SubCommandRecordTest, CallStackDwarfSizeMin, TestSize.Level1)
502 {
503     // it will cause some crash in -fprofile-arcs and -ftest-coverage
504     // we will fix it latter
505     TestRecordCommand("-d 2 --call-stack dwarf,8 ");
506     TearDown();
507     SetUp();
508     TestRecordCommand("-d 2 -s dwarf,8 ");
509 }
510 
511 HWTEST_F(SubCommandRecordTest, CallStackDwarfSizeMinErr, TestSize.Level1)
512 {
513     TestRecordCommand("-d 2 --call-stack dwarf,7 ", false);
514     TearDown();
515     SetUp();
516     TestRecordCommand("-d 2 -s dwarf,7 ", false);
517 }
518 
519 HWTEST_F(SubCommandRecordTest, CallStackDwarfSizeMax, TestSize.Level1)
520 {
521     TestRecordCommand("-d 2 --call-stack dwarf,65528 ");
522     TearDown();
523     SetUp();
524     TestRecordCommand("-d 2 -s dwarf,65528 ");
525 }
526 
527 HWTEST_F(SubCommandRecordTest, CallStackDwarfSizeMaxErr, TestSize.Level1)
528 {
529     TestRecordCommand("-d 2 --call-stack dwarf,65529 ", false);
530     TearDown();
531     SetUp();
532     TestRecordCommand("-d 2 -s dwarf,65529 ", false);
533 }
534 
535 HWTEST_F(SubCommandRecordTest, CallStackDwarfSizeErr, TestSize.Level1)
536 {
537     TestRecordCommand("-d 2 --call-stack dwarf,15 ", false);
538     TearDown();
539     SetUp();
540     TestRecordCommand("-d 2 -s dwarf,15 ", false);
541 }
542 
543 HWTEST_F(SubCommandRecordTest, CallStackDwarfSizeInputErr, TestSize.Level1)
544 {
545     TestRecordCommand("-d 2 --call-stack dwarf,abc ", false);
546     TearDown();
547     SetUp();
548     TestRecordCommand("-d 2 -s dwarf,abc ", false);
549 }
550 
551 HWTEST_F(SubCommandRecordTest, CallStackDwarfSizeInputMoreErr, TestSize.Level1)
552 {
553     TestRecordCommand("-d 2 --call-stack dwarf,16,32 ", false);
554     TearDown();
555     SetUp();
556     TestRecordCommand("-d 2 -s dwarf,16,32 ", false);
557 }
558 
559 // unwind
560 HWTEST_F(SubCommandRecordTest, DlayUnwind, TestSize.Level1)
561 {
562     TestRecordCommand("-d 2 -s dwarf,16 --delay-unwind ");
563 }
564 
565 HWTEST_F(SubCommandRecordTest, DisableUnwind, TestSize.Level1)
566 {
567     TestRecordCommand("-d 2 -s dwarf,16 --disable-unwind ");
568 }
569 
570 HWTEST_F(SubCommandRecordTest, DisableCallstackMerge, TestSize.Level1)
571 {
572     TestRecordCommand("-d 2 -s dwarf,16 --disable-callstack-expand ");
573 }
574 
575 // symbol dir
576 HWTEST_F(SubCommandRecordTest, SymbolDir, TestSize.Level1)
577 {
578     TestRecordCommand("-d 2 --symbol-dir ./ ");
579 }
580 
581 HWTEST_F(SubCommandRecordTest, SymbolDirErr, TestSize.Level1)
582 {
583     TestRecordCommand("-d 2 --symbol-dir where ", false);
584 }
585 
586 // clock id
587 HWTEST_F(SubCommandRecordTest, ClockIdMonotonic, TestSize.Level1)
588 {
589     TestRecordCommand("-d 2 --clockid monotonic ");
590 }
591 
592 HWTEST_F(SubCommandRecordTest, ClockIdMonotonicRaw, TestSize.Level1)
593 {
594     TestRecordCommand("-d 2 --clockid monotonic_raw ");
595 }
596 
597 HWTEST_F(SubCommandRecordTest, ClockIdBoottime, TestSize.Level1)
598 {
599     TestRecordCommand("-c 0 -d 2 -e sw-task-clock --clockid boottime ");
600 }
601 
602 HWTEST_F(SubCommandRecordTest, ClockIdRealtime, TestSize.Level1)
603 {
604     TestRecordCommand("-c 0 -d 2 -e sw-task-clock --clockid realtime ");
605 }
606 
607 HWTEST_F(SubCommandRecordTest, ClockIdClockTai, TestSize.Level1)
608 {
609     TestRecordCommand("-c 0 -d 2 -e sw-task-clock --clockid clock_tai ");
610 }
611 
612 HWTEST_F(SubCommandRecordTest, ClockIdInputErr, TestSize.Level1)
613 {
614     TestRecordCommand("-c 0 -d 2 --clockid what ", false);
615 }
616 
617 // mmap pages
618 HWTEST_F(SubCommandRecordTest, MmapPagesPower2Err, TestSize.Level1)
619 {
620     TestRecordCommand("-d 2 -m 101 ", false);
621 }
622 
623 HWTEST_F(SubCommandRecordTest, MmapPagesMin, TestSize.Level1)
624 {
625     TestRecordCommand("-d 2 -m 2 ");
626 }
627 
628 HWTEST_F(SubCommandRecordTest, MmapPagesMinErr, TestSize.Level1)
629 {
630     TestRecordCommand("-d 2 -m 1 ", false);
631 }
632 
633 HWTEST_F(SubCommandRecordTest, MmapPagesMax, TestSize.Level1)
634 {
635     TestRecordCommand("-d 2 -m 1024 ");
636 }
637 
638 HWTEST_F(SubCommandRecordTest, MmapPagesMaxErr, TestSize.Level1)
639 {
640     TestRecordCommand("-d 2 -m 1025 ", false);
641 }
642 
643 HWTEST_F(SubCommandRecordTest, MmapPagesInputErr, TestSize.Level1)
644 {
645     TestRecordCommand("-d 2 -m abc ", false);
646 }
647 
648 // output file name
649 HWTEST_F(SubCommandRecordTest, OutputFileName, TestSize.Level1)
650 {
651     TestRecordCommand("-d 2 -o /data/local/tmp/output.perf.data ");
652 }
653 
654 HWTEST_F(SubCommandRecordTest, OutputFileNameErr, TestSize.Level1)
655 {
656     TestRecordCommand("-d 2 -o nopath/output.perf.data ", false);
657 }
658 
659 // data size limit
660 HWTEST_F(SubCommandRecordTest, DataLimit, TestSize.Level1)
661 {
662     TestRecordCommand("-d 2 --data-limit 1K ");
663     TearDown();
664     SetUp();
665     TestRecordCommand("-d 2 --data-limit 1M ");
666     TearDown();
667     SetUp();
668     TestRecordCommand("-d 2 --data-limit 1G ");
669 }
670 
671 HWTEST_F(SubCommandRecordTest, DataLimitErr, TestSize.Level1)
672 {
673     TestRecordCommand("-d 2 --data-limit 10A ", false);
674     TearDown();
675     SetUp();
676     TestRecordCommand("-d 2 --data-limit 0G ", false);
677 }
678 
679 HWTEST_F(SubCommandRecordTest, RecordCompress, TestSize.Level1)
680 {
681     TestRecordCommand("-d 2 -z ");
682 }
683 
684 HWTEST_F(SubCommandRecordTest, Verbose, TestSize.Level1)
685 {
686     TestRecordCommand("-d 2 --verbose ");
687 }
688 
689 HWTEST_F(SubCommandRecordTest, DumpOptions, TestSize.Level1)
690 {
691     StdoutRecord stdoutRecord;
692     stdoutRecord.Start();
693     SubCommandRecord cmd;
694     cmd.DumpOptions();
695     stdoutRecord.Stop();
696 }
697 } // namespace HiPerf
698 } // namespace Developtools
699 } // namespace OHOS
700