perf was being executed via a shell, this means that the pid in
self._process.pid will be the pid of the shell and the actual pid
of perf will be a child of that process.

This would be fine in practice except that the signal being used
to stop perf is SIGINT, and this is being sent to the shell. The
shell won't necessarily deliver this to its child process (no
controlling tty) so what happens is that the shell ignores the
signal and we get stuck in self._process.wait()

There's no reason to keep the intermediate shell around, so prefix
the command with "exec" so that the shell replaces itself with perf
and the pid we know is perf, and SIGINT is sent to perf.

Change-Id: I37ca0ac22a2bb64897ddda88592c08dbff85a02e
Signed-off-by: Scott James Remnant <key...@chromium.org>
---
 client/profilers/perf/perf.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/client/profilers/perf/perf.py b/client/profilers/perf/perf.py
index e6f9bb7..663fe0a 100644
--- a/client/profilers/perf/perf.py
+++ b/client/profilers/perf/perf.py
@@ -34,7 +34,7 @@ class perf(profiler.profiler):
 
     def start(self, test):
         self.logfile = os.path.join(test.profdir, "perf")
-        cmd = ("%s record -a -o %s" %
+        cmd = ("exec %s record -a -o %s" %
                (self.perf_bin, self.logfile))
         for event in self.events:
             cmd += " -e %s" % event
-- 
1.7.3.1

_______________________________________________
Autotest mailing list
Autotest@test.kernel.org
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to