summaryrefslogtreecommitdiff
path: root/simpleperf/cmd_record_test.cpp
diff options
context:
space:
mode:
authorYabin Cui <yabinc@google.com>2020-02-18 14:32:33 -0800
committerYabin Cui <yabinc@google.com>2020-02-18 14:37:20 -0800
commit94c148de3309a5510dc3d2cf820d2cb51eb07357 (patch)
treec4fb0dceb50515dfd445529176bc337d3eab3cc6 /simpleperf/cmd_record_test.cpp
parent83ba19ecb19c6e0d642dcc9e47776f181bdb6c17 (diff)
downloadextras-94c148de3309a5510dc3d2cf820d2cb51eb07357.tar.gz
simpleperf: force testing run-as and app_runner separately.
In CtsSimpleperfTestCases, two methods are used to record an app: through run-as and through simpleperf_app_runner. Tests don't fail unless both methods fail. This can't detect the situation when only one method fails. So change to test run-as and simpleperf_app_runner separately. Bug: none Test: run simpleperf_unit_test. Change-Id: I023aa7793f748e695f809c153ed23f006e13ea12
Diffstat (limited to 'simpleperf/cmd_record_test.cpp')
-rw-r--r--simpleperf/cmd_record_test.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/simpleperf/cmd_record_test.cpp b/simpleperf/cmd_record_test.cpp
index 82f48ed0..ec8c44c9 100644
--- a/simpleperf/cmd_record_test.cpp
+++ b/simpleperf/cmd_record_test.cpp
@@ -820,11 +820,15 @@ static void TestRecordingApps(const std::string& app_name) {
TEST(record_cmd, app_option_for_debuggable_app) {
TEST_REQUIRE_APPS();
+ SetRunInAppToolForTesting(true, false);
+ TestRecordingApps("com.android.simpleperf.debuggable");
+ SetRunInAppToolForTesting(false, true);
TestRecordingApps("com.android.simpleperf.debuggable");
}
TEST(record_cmd, app_option_for_profileable_app) {
TEST_REQUIRE_APPS();
+ SetRunInAppToolForTesting(false, true);
TestRecordingApps("com.android.simpleperf.profileable");
}
@@ -845,6 +849,7 @@ TEST(record_cmd, record_java_app) {
"androidx.test.runner.AndroidJUnitRunner"));
// 3. Record perf.data.
+ SetRunInAppToolForTesting(true, true);
ASSERT_TRUE(helper.RecordData(
"-e cpu-clock --app com.example.android.displayingbitmaps -g --duration 10"));
@@ -877,6 +882,7 @@ TEST(record_cmd, record_native_app) {
"android.intent.action.MAIN -c android.intent.category.LAUNCHER"));
// 3. Record perf.data.
+ SetRunInAppToolForTesting(true, true);
ASSERT_TRUE(helper.RecordData("-e cpu-clock --app com.google.sample.tunnel -g --duration 10"));
// 4. Check perf.data.