Revision: e5a373b12276
Branch: default
Author: Janne Piironen <janne.piiro...@gmail.com>
Date: Wed Oct 16 12:25:25 2013 UTC
Log: Longer kill and terminate timeouts put to instance variables
Update issue 1541
Changed timeout time to 30s for terminate and 10s for kill. Having timeouts
as
instance variables allows circumventing the timeouts in our own tests
so that running these tests won't slow down the suite excessively.
http://code.google.com/p/robotframework/source/detail?r=e5a373b12276
Modified:
/atest/robot/standard_libraries/process/terminate_and_pid.txt
/atest/testdata/standard_libraries/process/terminate_and_pid.txt
/src/robot/libraries/Process.py
=======================================
--- /atest/robot/standard_libraries/process/terminate_and_pid.txt Thu Oct
10 13:21:57 2013 UTC
+++ /atest/robot/standard_libraries/process/terminate_and_pid.txt Wed Oct
16 12:25:25 2013 UTC
@@ -18,9 +18,9 @@
Kill Process When Terminate Fails
${tc} = Check Test Case ${TESTNAME}
- Check Log Message ${tc.kws[3].msgs[0]} Gracefully terminating
process.
+ Check Log Message ${tc.kws[6].msgs[0]} Gracefully terminating
process.
Pass Execution If ${WINDOWS} Pass on Windows since there's no
kill command.
- Check Log Message ${tc.kws[3].msgs[1]} Forcefully killing
process.
+ Check Log Message ${tc.kws[6].msgs[1]} Forcefully killing
process.
Should Be True ${tc.elapsedtime} > 5000
Pid
=======================================
--- /atest/testdata/standard_libraries/process/terminate_and_pid.txt Thu
Oct 10 13:35:59 2013 UTC
+++ /atest/testdata/standard_libraries/process/terminate_and_pid.txt Wed
Oct 16 12:25:25 2013 UTC
@@ -30,10 +30,13 @@
Process Should Be Stopped ${handle}
Kill Process When Terminate Fails
+ ${lib} = Get Library Instance Process
+ ${lib._terminate_timeout} = Set Variable ${5}
+ ${lib._kill_timeout} = Set Variable ${1}
${process} = Start Process python ${NONTERM}
Process Should Be Running ${process}
Sleep 0.1
- Terminate Process ${process}
+ ${result} = Terminate Process ${process}
Wait For Process ${process}
Process Should Be Stopped ${process}
=======================================
--- /src/robot/libraries/Process.py Thu Oct 10 13:21:57 2013 UTC
+++ /src/robot/libraries/Process.py Wed Oct 16 12:25:25 2013 UTC
@@ -264,6 +264,8 @@
def __init__(self):
self._processes = ConnectionCache('No active process.')
self._results = {}
+ self._terminate_timeout = 30
+ self._kill_timeout = 10
def run_process(self, command, *arguments, **configuration):
"""Runs a process and waits for it to complete.
@@ -391,18 +393,20 @@
try:
terminator(process)
except OSError:
- if not self._process_is_stopped(process):
+ if not self._process_is_stopped(process, self._kill_timeout):
raise
logger.debug('Ignored OSError because process was stopped.')
def _kill_process(self, process):
logger.info('Forcefully killing process.')
process.kill()
+ if not self._process_is_stopped(process, self._kill_timeout):
+ raise
def _terminate_process(self, process):
logger.info('Gracefully terminating process.')
process.terminate()
- if not self._process_is_stopped(process):
+ if not self._process_is_stopped(process, self._terminate_timeout):
self._kill_process(process)
def terminate_all_processes(self, kill=False):
@@ -469,7 +473,7 @@
timeout_reached = not
self._process_is_stopped(self._processes[handle], timeout)
return self._handle_process_shutdown(handle, timeout_reached,
handle_timeout)
- def _process_is_stopped(self, process, timeout=5):
+ def _process_is_stopped(self, process, timeout):
max_time = time.time() + timeout
while time.time() <= max_time:
if process.poll() is not None:
--
---
You received this message because you are subscribed to the Google Groups "robotframework-commit" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to robotframework-commit+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.