summaryrefslogtreecommitdiff
path: root/simpleperf/cmd_record_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'simpleperf/cmd_record_test.cpp')
-rw-r--r--simpleperf/cmd_record_test.cpp23
1 files changed, 22 insertions, 1 deletions
diff --git a/simpleperf/cmd_record_test.cpp b/simpleperf/cmd_record_test.cpp
index 82f494f8..184f9359 100644
--- a/simpleperf/cmd_record_test.cpp
+++ b/simpleperf/cmd_record_test.cpp
@@ -747,7 +747,7 @@ TEST(record_cmd, cpu_percent_option) {
class RecordingAppHelper {
public:
bool InstallApk(const std::string& apk_path, const std::string& package_name) {
- if (Workload::RunCmd({"pm", "install", "-t", apk_path})) {
+ if (Workload::RunCmd({"pm", "install", "-t", "--abi", GetABI(), apk_path})) {
installed_packages_.emplace_back(package_name);
return true;
}
@@ -785,6 +785,20 @@ class RecordingAppHelper {
}
private:
+ const char* GetABI() {
+#if defined(__i386__)
+ return "x86";
+#elif defined(__x86_64__)
+ return "x86_64";
+#elif defined(__aarch64__)
+ return "arm64-v8a";
+#elif defined(__arm__)
+ return "armeabi-v7a";
+#else
+ #error "unrecognized ABI"
+#endif
+ }
+
std::vector<std::string> installed_packages_;
std::unique_ptr<Workload> app_start_proc_;
TemporaryFile perf_data_file_;
@@ -894,6 +908,13 @@ TEST(record_cmd, cs_etm_event) {
ASSERT_TRUE(RunRecordCmd({"-e", "cs-etm"}, tmpfile.path));
std::unique_ptr<RecordFileReader> reader = RecordFileReader::CreateInstance(tmpfile.path);
ASSERT_TRUE(reader);
+
+ // cs-etm uses sample period instead of sample freq.
+ ASSERT_EQ(reader->AttrSection().size(), 1u);
+ const perf_event_attr* attr = reader->AttrSection()[0].attr;
+ ASSERT_EQ(attr->freq, 0);
+ ASSERT_EQ(attr->sample_period, 1);
+
bool has_auxtrace_info = false;
bool has_auxtrace = false;
bool has_aux = false;