diff options
author | android-build-prod (mdb) <android-build-team-robot@google.com> | 2018-05-18 16:04:19 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2018-05-18 16:04:19 +0000 |
commit | 485a254e360f7a6a7004bcfc3e1b64e2b00384ec (patch) | |
tree | 4463561c6fa441a5922c9cb5c671bffc9d864adf | |
parent | 71925aeb3de420cc26003edcecf67cd565121843 (diff) | |
parent | 4cde1f9bab5841cf040269be7bd6566f72fcbbec (diff) | |
download | extras-485a254e360f7a6a7004bcfc3e1b64e2b00384ec.tar.gz |
Merge "Snap for 4788939 from 5552beb813d2a5ae60c4eef9a4a5646b7ab430d7 to oreo-mr1-vts-release" into oreo-mr1-vts-releaseandroid-vts-8.1_r9android-vts-8.1_r8android-vts-8.1_r7android-vts-8.1_r6android-vts-8.1_r5android-vts-8.1_r14android-vts-8.1_r13android-vts-8.1_r12android-vts-8.1_r11android-vts-8.1_r10oreo-mr1-vts-release
-rw-r--r-- | simpleperf/cmd_record_test.cpp | 17 | ||||
-rw-r--r-- | simpleperf/cmd_stat_test.cpp | 5 |
2 files changed, 18 insertions, 4 deletions
diff --git a/simpleperf/cmd_record_test.cpp b/simpleperf/cmd_record_test.cpp index c3f9cb40..e942332f 100644 --- a/simpleperf/cmd_record_test.cpp +++ b/simpleperf/cmd_record_test.cpp @@ -391,12 +391,21 @@ TEST(record_cmd, support_modifier_for_clock_events) { TEST(record_cmd, handle_SIGHUP) { TemporaryFile tmpfile; - std::thread thread([]() { - sleep(1); + int pipefd[2]; + ASSERT_EQ(0, pipe(pipefd)); + int read_fd = pipefd[0]; + int write_fd = pipefd[1]; + char data[8] = {}; + std::thread thread([&]() { + android::base::ReadFully(read_fd, data, 7); kill(getpid(), SIGHUP); }); - thread.detach(); - ASSERT_TRUE(RecordCmd()->Run({"-o", tmpfile.path, "sleep", "1000000"})); + ASSERT_TRUE(RecordCmd()->Run({"-o", tmpfile.path, "--start_profiling_fd", + std::to_string(write_fd), "sleep", "1000000"})); + thread.join(); + close(write_fd); + close(read_fd); + ASSERT_STREQ(data, "STARTED"); } TEST(record_cmd, stop_when_no_more_targets) { diff --git a/simpleperf/cmd_stat_test.cpp b/simpleperf/cmd_stat_test.cpp index 3cdb4ebd..3876b420 100644 --- a/simpleperf/cmd_stat_test.cpp +++ b/simpleperf/cmd_stat_test.cpp @@ -157,6 +157,11 @@ TEST(stat_cmd, no_modifier_for_clock_events) { } TEST(stat_cmd, handle_SIGHUP) { + if (!GetDefaultAppPackageName().empty()) { + // See http://b/79495636. + GTEST_LOG_(INFO) << "Omit this test in app's context."; + return; + } std::thread thread([]() { sleep(1); kill(getpid(), SIGHUP); |