summaryrefslogtreecommitdiff
path: root/simpleperf/cmd_record_test.cpp
diff options
context:
space:
mode:
authorYabin Cui <yabinc@google.com>2022-03-14 13:52:42 -0700
committerYabin Cui <yabinc@google.com>2022-03-14 13:56:16 -0700
commit7fd28fb73e02688ebcbf4fdcb679bb3cda2483c9 (patch)
tree8d70c2db10483fa7cec23ec80f5030cf1775f650 /simpleperf/cmd_record_test.cpp
parentac43bc018e65bbd736b952eea82b7cf8b3842d42 (diff)
downloadextras-7fd28fb73e02688ebcbf4fdcb679bb3cda2483c9.tar.gz
simpleperf: fix test running on emulator.
When running on emulator, cpu-cycles event may not be available, so should use GetDefaultEvent() instead. Bug: 223403304 Test: run simpleperf_unit_test Change-Id: I473985612a4c6a12374ccb7e24c86fefcc037075
Diffstat (limited to 'simpleperf/cmd_record_test.cpp')
-rw-r--r--simpleperf/cmd_record_test.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/simpleperf/cmd_record_test.cpp b/simpleperf/cmd_record_test.cpp
index ef2c1b68..01861c60 100644
--- a/simpleperf/cmd_record_test.cpp
+++ b/simpleperf/cmd_record_test.cpp
@@ -565,10 +565,12 @@ TEST(record_cmd, exit_with_parent_option) {
TEST(record_cmd, use_cmd_exit_code_option) {
TemporaryFile tmpfile;
int exit_code;
- RecordCmd()->Run({"--use-cmd-exit-code", "-o", tmpfile.path, "ls", "."}, &exit_code);
- ASSERT_EQ(exit_code, 0);
- RecordCmd()->Run({"--use-cmd-exit-code", "-o", tmpfile.path, "ls", "/not_exist_path"},
+ RecordCmd()->Run({"-e", GetDefaultEvent(), "--use-cmd-exit-code", "-o", tmpfile.path, "ls", "."},
&exit_code);
+ ASSERT_EQ(exit_code, 0);
+ RecordCmd()->Run(
+ {"-e", GetDefaultEvent(), "--use-cmd-exit-code", "-o", tmpfile.path, "ls", "/not_exist_path"},
+ &exit_code);
ASSERT_NE(exit_code, 0);
}