summaryrefslogtreecommitdiff
path: root/simpleperf
diff options
context:
space:
mode:
authorYabin Cui <yabinc@google.com>2015-09-24 12:37:27 -0700
committerYabin Cui <yabinc@google.com>2015-09-24 13:35:53 -0700
commitc8fcde2b9afa478740b012dee1d656c9bc8259e0 (patch)
tree9a350ed7b1578d73ee3acaa8f4dc38935af57eed /simpleperf
parent133143c56f336eef6545ef99f4c874dba6637ea6 (diff)
downloadextras-c8fcde2b9afa478740b012dee1d656c9bc8259e0.tar.gz
Simpleperf: fix flaky workload unit tests.
Move SIGABRT to SIGKILL to make sure the child process is terminated by a signal. SIGABRT can't guarantee this because the child process can install signal handler for SIGABRT. Add a final _exit(1) after ChildProcessFn in case execvp() fails. Change-Id: I353720b10c6ea42826efcafce5ff2699fd246e22
Diffstat (limited to 'simpleperf')
-rw-r--r--simpleperf/workload.cpp1
-rw-r--r--simpleperf/workload_test.cpp2
2 files changed, 2 insertions, 1 deletions
diff --git a/simpleperf/workload.cpp b/simpleperf/workload.cpp
index 42a5fddd..56870a7e 100644
--- a/simpleperf/workload.cpp
+++ b/simpleperf/workload.cpp
@@ -78,6 +78,7 @@ bool Workload::CreateNewProcess() {
close(start_signal_pipe[1]);
close(exec_child_pipe[0]);
ChildProcessFn(args_, start_signal_pipe[0], exec_child_pipe[1]);
+ _exit(0);
}
// In parent process.
close(start_signal_pipe[0]);
diff --git a/simpleperf/workload_test.cpp b/simpleperf/workload_test.cpp
index f250328b..f4c16019 100644
--- a/simpleperf/workload_test.cpp
+++ b/simpleperf/workload_test.cpp
@@ -50,7 +50,7 @@ static void run_signaled_workload() {
auto workload = Workload::CreateWorkload({"sleep", "10"});
ASSERT_TRUE(workload != nullptr);
ASSERT_TRUE(workload->Start());
- ASSERT_EQ(0, kill(workload->GetPid(), SIGABRT));
+ ASSERT_EQ(0, kill(workload->GetPid(), SIGKILL));
while (!signaled) {
}
}