Revision: 3243
Author: jussi.ao.malinen
Date: Mon May 10 01:27:04 2010
Log: removed possible deadlock problem in signaling tests, by removing call to subprocess wait() and stderr.read and stdout.read. Also added logging to log the command used to start signaling tests on jython.
http://code.google.com/p/robotframework/source/detail?r=3243

Modified:
 /trunk/atest/robot/running/ProcessManager.py
 /trunk/atest/robot/running/stopping_with_signal.txt

=======================================
--- /trunk/atest/robot/running/ProcessManager.py        Thu May  6 03:02:56 2010
+++ /trunk/atest/robot/running/ProcessManager.py        Mon May 10 01:27:04 2010
@@ -9,6 +9,7 @@

     def __init__(self):
         self._process = None
+        self._output_read = False
         self._stdout = ''
         self._stderr = ''

@@ -16,6 +17,7 @@
         args = args[0].split() + list(args[1:])
         self._process = subprocess.Popen(args, stderr=subprocess.PIPE,
                                          stdout=subprocess.PIPE)
+        self._output_read = False
         self._stdout = ''
         self._stderr = ''

@@ -36,15 +38,17 @@
                       signal.signal(signal.SIGINT, orig_handler))

     def get_stdout(self):
-        self._stdout += self._process.stdout.read()
+        self.wait_until_finished()
         return self._stdout

     def get_stderr(self):
-        self._stderr += self._process.stderr.read()
+        self.wait_until_finished()
         return self._stderr

     def wait_until_finished(self):
-        self._process.wait()
+        if not self._output_read:
+            self._stdout,self._stderr = self._process.communicate()
+            self._output_read = True

     def busy_sleep(self, seconds):
         max_time = time.time() + int(seconds)
=======================================
--- /trunk/atest/robot/running/stopping_with_signal.txt Fri May 7 04:39:12 2010 +++ /trunk/atest/robot/running/stopping_with_signal.txt Mon May 10 01:27:04 2010
@@ -85,6 +85,8 @@
     Set Runners
${path to datasource} = Set Variables And Get Datasources ${datasource}
     ${path to runner} =  Join Path  ${ROBOTPATH}  runner.py
+ ${command to run jython} = catenate ${jybot} ${path to runner} --variable TESTSIGNALFILE:${test signal file} --output ${OUTFILE} --report None --log None --variable TEARDOWNSLEEP:${teardown sleep} ${path to datasource}
+    log  ${command to run jython}
ProcessManager.start process ${jybot} ${path to runner} --variable TESTSIGNALFILE:${test signal file} --output ${OUTFILE} --report None --log None --variable TEARDOWNSLEEP:${teardown sleep} ${path to datasource}

 Check Test Cases Have Failed Correctly

Reply via email to