diff options
author | Yabin Cui <yabinc@google.com> | 2016-06-27 23:53:39 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2016-06-27 23:53:39 +0000 |
commit | 9458a99b0c69dd65facc6ef975218848e8b1f0b6 (patch) | |
tree | e4120549e7c43f0471d92671f31687893d2f42eb | |
parent | 0c2c44bfac3cef379470c78038eab73ce8fa6b58 (diff) | |
parent | a486a4b8aeeffb7bd0574134ca16c9ca1c061847 (diff) | |
download | extras-9458a99b0c69dd65facc6ef975218848e8b1f0b6.tar.gz |
Simpleperf: fix flaky tests.
am: a486a4b8ae
Change-Id: I194792e233c6ccdd695e04ed2a58f7f1034f0494
-rw-r--r-- | simpleperf/cmd_record_test.cpp | 5 | ||||
-rw-r--r-- | simpleperf/cmd_stat_test.cpp | 7 |
2 files changed, 6 insertions, 6 deletions
diff --git a/simpleperf/cmd_record_test.cpp b/simpleperf/cmd_record_test.cpp index a89febfe..1a468e29 100644 --- a/simpleperf/cmd_record_test.cpp +++ b/simpleperf/cmd_record_test.cpp @@ -171,8 +171,7 @@ TEST(record_cmd, existing_processes) { CreateProcesses(2, &workloads); std::string pid_list = android::base::StringPrintf("%d,%d", workloads[0]->GetPid(), workloads[1]->GetPid()); - TemporaryFile tmpfile; - ASSERT_TRUE(RecordCmd()->Run({"-p", pid_list, "-o", tmpfile.path})); + ASSERT_TRUE(RunRecordCmd({"-p", pid_list})); } TEST(record_cmd, existing_threads) { @@ -182,7 +181,7 @@ TEST(record_cmd, existing_threads) { std::string tid_list = android::base::StringPrintf("%d,%d", workloads[0]->GetPid(), workloads[1]->GetPid()); TemporaryFile tmpfile; - ASSERT_TRUE(RecordCmd()->Run({"-t", tid_list, "-o", tmpfile.path})); + ASSERT_TRUE(RunRecordCmd({"-t", tid_list})); } TEST(record_cmd, no_monitored_threads) { diff --git a/simpleperf/cmd_stat_test.cpp b/simpleperf/cmd_stat_test.cpp index 27f1f091..45ed3dc5 100644 --- a/simpleperf/cmd_stat_test.cpp +++ b/simpleperf/cmd_stat_test.cpp @@ -57,7 +57,8 @@ TEST(stat_cmd, event_modifier) { void CreateProcesses(size_t count, std::vector<std::unique_ptr<Workload>>* workloads) { workloads->clear(); for (size_t i = 0; i < count; ++i) { - auto workload = Workload::CreateWorkload({"sleep", "1"}); + // Create a workload runs longer than profiling time. + auto workload = Workload::CreateWorkload({"sleep", "1000"}); ASSERT_TRUE(workload != nullptr); ASSERT_TRUE(workload->Start()); workloads->push_back(std::move(workload)); @@ -69,7 +70,7 @@ TEST(stat_cmd, existing_processes) { CreateProcesses(2, &workloads); std::string pid_list = android::base::StringPrintf("%d,%d", workloads[0]->GetPid(), workloads[1]->GetPid()); - ASSERT_TRUE(StatCmd()->Run({"-p", pid_list})); + ASSERT_TRUE(StatCmd()->Run({"-p", pid_list, "sleep", "1"})); } TEST(stat_cmd, existing_threads) { @@ -78,7 +79,7 @@ TEST(stat_cmd, existing_threads) { // Process id can be used as thread id in linux. std::string tid_list = android::base::StringPrintf("%d,%d", workloads[0]->GetPid(), workloads[1]->GetPid()); - ASSERT_TRUE(StatCmd()->Run({"-t", tid_list})); + ASSERT_TRUE(StatCmd()->Run({"-t", tid_list, "sleep", "1"})); } TEST(stat_cmd, no_monitored_threads) { |