webkitpy: Add pid logging for simulator processes
authorjbedard@apple.com <jbedard@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 5 Apr 2017 20:17:37 +0000 (20:17 +0000)
committerjbedard@apple.com <jbedard@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 5 Apr 2017 20:17:37 +0000 (20:17 +0000)
https://bugs.webkit.org/show_bug.cgi?id=170505

Reviewed by Alexey Proskuryakov.

* Scripts/webkitpy/port/simulator_process.py:
(SimulatorProcess._start.handler): Add pid to exception.
(SimulatorProcess._start): Ditto.
* Scripts/webkitpy/xcode/simulated_device.py:
(SimulatedDevice.launch_app): Log pid when the process fails to launch and when
a pid is successfully returned.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@214965 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/Scripts/webkitpy/port/simulator_process.py
Tools/Scripts/webkitpy/xcode/simulated_device.py

index b5728f8..5c6091c 100644 (file)
@@ -1,3 +1,17 @@
+2017-04-05  Jonathan Bedard  <jbedard@apple.com>
+
+        webkitpy: Add pid logging for simulator processes
+        https://bugs.webkit.org/show_bug.cgi?id=170505
+
+        Reviewed by Alexey Proskuryakov.
+
+        * Scripts/webkitpy/port/simulator_process.py:
+        (SimulatorProcess._start.handler): Add pid to exception.
+        (SimulatorProcess._start): Ditto.
+        * Scripts/webkitpy/xcode/simulated_device.py:
+        (SimulatedDevice.launch_app): Log pid when the process fails to launch and when
+        a pid is successfully returned.
+
 2017-04-05  Ryan Haddad  <ryanhaddad@apple.com>
 
         Unreviewed, rolling out r214932.
index 7fb02ac..a3ddeb6 100644 (file)
@@ -94,7 +94,7 @@ class SimulatorProcess(ServerProcess):
 
         def handler(signum, frame):
             assert signum == signal.SIGALRM
-            raise Exception('Timed out waiting for process to connect at port {}'.format(self._target_host.listening_port()))
+            raise Exception('Timed out waiting for pid {} to connect at port {}'.format(self._pid, self._target_host.listening_port()))
         signal.signal(signal.SIGALRM, handler)
         signal.alarm(6)  # In seconds
 
@@ -111,7 +111,7 @@ class SimulatorProcess(ServerProcess):
             self._proc = SimulatorProcess.Popen(self._pid, stdin, stdout, stderr, self._target_host)
             if self._proc.poll() is not None:
                 self._reset()
-                raise Exception('App {} crashed before stdin could be attached'.format(os.path.basename(self._cmd[0])))
+                raise Exception('App {} with pid {} crashed before stdin could be attached'.format(os.path.basename(self._cmd[0]), self._pid))
             self._kill()
             self._reset()
             raise
index 325bc73..34d79bf 100644 (file)
@@ -187,11 +187,16 @@ class SimulatedDevice(object):
             # FIXME: We shouldn't need to check the PID <rdar://problem/31154075>.
             if match and self.executive.check_running_pid(int(match.group('pid'))):
                 break
+            if match:
+                _log.debug('simctl launch reported pid {}, but this process is not running'.format(match.group('pid')))
+            else:
+                _log.debug('simctl launch did not report a pid')
 
         signal.alarm(0)  # Cancel alarm
 
         if match.group('bundle') != bundle_id:
             raise RuntimeError('Failed to find process id for {}: {}'.format(bundle_id, output))
+        _log.debug('Returning pid {} of launched process'.format(match.group('pid')))
         return int(match.group('pid'))
 
     def __eq__(self, other):