6 new revisions:

Revision: f93698182376
Branch:   default
Author:   Mikko Korpela <[email protected]>
Date:     Mon Oct 21 09:48:39 2013 UTC
Log:      Process.Send Signal renamed to Process.Send Signal To Process
http://code.google.com/p/robotframework/source/detail?r=f93698182376

Revision: 93771b37885f
Branch:   default
Author:   Mikko Korpela <[email protected]>
Date:     Mon Oct 21 11:07:24 2013 UTC
Log:      Sending signal functionality with number and others
http://code.google.com/p/robotframework/source/detail?r=93771b37885f

Revision: ac90676cb847
Branch:   default
Author:   Mikko Korpela <[email protected]>
Date:     Mon Oct 21 11:17:41 2013 UTC
Log:      sending_signal: Tests for handle
http://code.google.com/p/robotframework/source/detail?r=ac90676cb847

Revision: 4b95665f6063
Branch:   default
Author:   Mikko Korpela <[email protected]>
Date:     Mon Oct 21 11:50:30 2013 UTC
Log:      Process.Send Signal To Process: SIG prefix now works for signals
http://code.google.com/p/robotframework/source/detail?r=4b95665f6063

Revision: 98b55bb33ca3
Branch:   default
Author:   Mikko Korpela <[email protected]>
Date:     Mon Oct 21 11:56:34 2013 UTC
Log:      Process: doc for send_signal_to_process
http://code.google.com/p/robotframework/source/detail?r=98b55bb33ca3

Revision: 87960bf0e3af
Branch:   default
Author:   Mikko Korpela <[email protected]>
Date:     Mon Oct 21 11:57:02 2013 UTC
Log:      merge
http://code.google.com/p/robotframework/source/detail?r=87960bf0e3af

==============================================================================
Revision: f93698182376
Branch:   default
Author:   Mikko Korpela <[email protected]>
Date:     Mon Oct 21 09:48:39 2013 UTC
Log:      Process.Send Signal renamed to Process.Send Signal To Process
http://code.google.com/p/robotframework/source/detail?r=f93698182376

Modified:
 /atest/testdata/standard_libraries/process/sending_signal.txt
 /src/robot/libraries/Process.py

=======================================
--- /atest/testdata/standard_libraries/process/sending_signal.txt Tue Oct 8 10:16:00 2013 UTC +++ /atest/testdata/standard_libraries/process/sending_signal.txt Mon Oct 21 09:48:39 2013 UTC
@@ -5,6 +5,6 @@
 *** Test Cases ***
 Sending INT signal
    [Timeout]        2 seconds
- Start Process python -c "import time; for i in range(25): time.sleep(0.1)" shell=True
-   Send Signal      SIGINT
-   ${out}=          Wait For Process
+ Start Process python -c "import time; for i in range(25): time.sleep(0.1)" shell=True
+   Send Signal To Process      SIGINT
+   ${out}=                     Wait For Process
=======================================
--- /src/robot/libraries/Process.py     Thu Oct 17 15:22:44 2013 UTC
+++ /src/robot/libraries/Process.py     Mon Oct 21 09:48:39 2013 UTC
@@ -459,9 +459,9 @@
                 self.terminate_process(handle, kill=kill)
         self.__init__()

-    def send_signal(self, signal, handle=None):
+    def send_signal_to_process(self, signal, handle=None):
         if os.sep == '\\':
- raise AssertionError('Process.Send Signal does not work in Windows') + raise AssertionError('Process.Send Signal To Process does not work on Windows')
         self._processes[handle].send_signal(self._get_signal(signal))

     def _get_signal(self, signal_string):

==============================================================================
Revision: 93771b37885f
Branch:   default
Author:   Mikko Korpela <[email protected]>
Date:     Mon Oct 21 11:07:24 2013 UTC
Log:      Sending signal functionality with number and others
http://code.google.com/p/robotframework/source/detail?r=93771b37885f

Modified:
 /atest/robot/standard_libraries/process/sending_signal.txt
 /atest/testdata/standard_libraries/process/sending_signal.txt
 /src/robot/libraries/Process.py

=======================================
--- /atest/robot/standard_libraries/process/sending_signal.txt Tue Oct 8 10:16:00 2013 UTC +++ /atest/robot/standard_libraries/process/sending_signal.txt Mon Oct 21 11:07:24 2013 UTC
@@ -7,6 +7,16 @@
 *** Test Cases ***
 Sending INT signal
     Check Test Case    ${TESTNAME}
+
+Sending INT signal as a text number
+    Check Test Case    ${TESTNAME}
+
+Sending INT signal as a number
+    Check Test Case    ${TESTNAME}
+
+Sending an unknown signal
+    Check Test Case    ${TESTNAME}
+

 *** Keywords ***
 Check Preconditions
=======================================
--- /atest/testdata/standard_libraries/process/sending_signal.txt Mon Oct 21 09:48:39 2013 UTC +++ /atest/testdata/standard_libraries/process/sending_signal.txt Mon Oct 21 11:07:24 2013 UTC
@@ -4,7 +4,23 @@

 *** Test Cases ***
 Sending INT signal
-   [Timeout]        2 seconds
+   Killer signal   INT
+
+Sending INT signal as a text number
+   Killer signal   2
+
+Sending INT signal as a number
+   Killer signal   ${2}
+
+Sending an unknown signal
+   [Documentation]  FAIL STARTS: Unknown signal 'unknown'
+   Start Process               python -c "1+1"      shell=True
+   Send Signal To Process      unknown
+
+*** Keywords ***
+Killer signal
+   [Arguments]   ${signal}
+   [Timeout]     2 seconds
Start Process python -c "import time; for i in range(25): time.sleep(0.1)" shell=True
-   Send Signal To Process      SIGINT
+   Send Signal To Process      ${signal}
    ${out}=                     Wait For Process
=======================================
--- /src/robot/libraries/Process.py     Mon Oct 21 09:48:39 2013 UTC
+++ /src/robot/libraries/Process.py     Mon Oct 21 11:07:24 2013 UTC
@@ -465,8 +465,16 @@
         self._processes[handle].send_signal(self._get_signal(signal))

     def _get_signal(self, signal_string):
-        import signal
-        return getattr(signal, signal_string)
+        if isinstance(signal_string, int):
+            return signal_string
+        try:
+            return int(signal_string)
+        except ValueError:
+            import signal
+            try:
+                return getattr(signal, 'SIG'+str(signal_string))
+            except AttributeError:
+                raise AssertionError("Unknown signal '%s'" % signal_string)

     def get_process_id(self, handle=None):
         """Returns the process ID (pid) of the process.

==============================================================================
Revision: ac90676cb847
Branch:   default
Author:   Mikko Korpela <[email protected]>
Date:     Mon Oct 21 11:17:41 2013 UTC
Log:      sending_signal: Tests for handle
http://code.google.com/p/robotframework/source/detail?r=ac90676cb847

Modified:
 /atest/robot/standard_libraries/process/sending_signal.txt
 /atest/testdata/standard_libraries/process/sending_signal.txt

=======================================
--- /atest/robot/standard_libraries/process/sending_signal.txt Mon Oct 21 11:07:24 2013 UTC +++ /atest/robot/standard_libraries/process/sending_signal.txt Mon Oct 21 11:17:41 2013 UTC
@@ -17,6 +17,11 @@
 Sending an unknown signal
     Check Test Case    ${TESTNAME}

+Sending signal to a process with a handle
+    Check Test Case    ${TESTNAME}
+
+Sending signal to a process with a wrong handle
+    Check Test Case    ${TESTNAME}

 *** Keywords ***
 Check Preconditions
=======================================
--- /atest/testdata/standard_libraries/process/sending_signal.txt Mon Oct 21 11:07:24 2013 UTC +++ /atest/testdata/standard_libraries/process/sending_signal.txt Mon Oct 21 11:17:41 2013 UTC
@@ -17,6 +17,18 @@
    Start Process               python -c "1+1"      shell=True
    Send Signal To Process      unknown

+Sending signal to a process with a handle
+   [Timeout]     2 seconds
+ ${handle}= Start Process python -c "import time; for i in range(25): time.sleep(0.1)" shell=True
+   Start Process               python -c "1+1"      shell=True
+   Send Signal To Process      2     handle=${handle}
+   ${out}=                     Wait For Process   handle=${handle}
+
+Sending signal to a process with a wrong handle
+   [Documentation]  FAIL STARTS: Non-existing index or alias 'unknown'
+   Start Process               python -c "1+1"      shell=True
+   Send Signal To Process      2     handle=unknown
+
 *** Keywords ***
 Killer signal
    [Arguments]   ${signal}

==============================================================================
Revision: 4b95665f6063
Branch:   default
Author:   Mikko Korpela <[email protected]>
Date:     Mon Oct 21 11:50:30 2013 UTC
Log:      Process.Send Signal To Process: SIG prefix now works for signals
http://code.google.com/p/robotframework/source/detail?r=4b95665f6063

Modified:
 /atest/robot/standard_libraries/process/sending_signal.txt
 /atest/testdata/standard_libraries/process/sending_signal.txt
 /src/robot/libraries/Process.py

=======================================
--- /atest/robot/standard_libraries/process/sending_signal.txt Mon Oct 21 11:17:41 2013 UTC +++ /atest/robot/standard_libraries/process/sending_signal.txt Mon Oct 21 11:50:30 2013 UTC
@@ -7,6 +7,9 @@
 *** Test Cases ***
 Sending INT signal
     Check Test Case    ${TESTNAME}
+
+Sending SIGINT signal
+    Check Test Case    ${TESTNAME}

 Sending INT signal as a text number
     Check Test Case    ${TESTNAME}
=======================================
--- /atest/testdata/standard_libraries/process/sending_signal.txt Mon Oct 21 11:17:41 2013 UTC +++ /atest/testdata/standard_libraries/process/sending_signal.txt Mon Oct 21 11:50:30 2013 UTC
@@ -6,6 +6,9 @@
 Sending INT signal
    Killer signal   INT

+Sending SIGINT signal
+   Killer signal   SIGINT
+
 Sending INT signal as a text number
    Killer signal   2

=======================================
--- /src/robot/libraries/Process.py     Mon Oct 21 11:07:24 2013 UTC
+++ /src/robot/libraries/Process.py     Mon Oct 21 11:50:30 2013 UTC
@@ -472,10 +472,17 @@
         except ValueError:
             import signal
             try:
-                return getattr(signal, 'SIG'+str(signal_string))
+                signal_name = self._get_signal_name_from(signal_string)
+                return getattr(signal, signal_name)
             except AttributeError:
                 raise AssertionError("Unknown signal '%s'" % signal_string)

+    def _get_signal_name_from(self, signal_string):
+        s = str(signal_string)
+        if s.startswith('SIG'):
+            return s
+        return 'SIG'+s
+
     def get_process_id(self, handle=None):
         """Returns the process ID (pid) of the process.


==============================================================================
Revision: 98b55bb33ca3
Branch:   default
Author:   Mikko Korpela <[email protected]>
Date:     Mon Oct 21 11:56:34 2013 UTC
Log:      Process: doc for send_signal_to_process
http://code.google.com/p/robotframework/source/detail?r=98b55bb33ca3

Modified:
 /src/robot/libraries/Process.py

=======================================
--- /src/robot/libraries/Process.py     Mon Oct 21 11:50:30 2013 UTC
+++ /src/robot/libraries/Process.py     Mon Oct 21 11:56:34 2013 UTC
@@ -460,6 +460,17 @@
         self.__init__()

     def send_signal_to_process(self, signal, handle=None):
+ """ Sends a signal to a process. Signal can be a number or a name of the signal. + See 'man signal' for the complete list of signals available on your platform.
+        Signal name can be give with or without the SIG prefix
+        (for example SIGINT and INT will both send interrupt signal).
+
+        NOTE! This Keyword does not work on Windows.
+
+        `signal` is the number or name of the signal to be send.
+
+        If `handle` is not given, uses the current `active process`.
+        """
         if os.sep == '\\':
raise AssertionError('Process.Send Signal To Process does not work on Windows')
         self._processes[handle].send_signal(self._get_signal(signal))

==============================================================================
Revision: 87960bf0e3af
Branch:   default
Author:   Mikko Korpela <[email protected]>
Date:     Mon Oct 21 11:57:02 2013 UTC
Log:      merge
http://code.google.com/p/robotframework/source/detail?r=87960bf0e3af

Modified:
 /src/robot/libraries/Process.py

=======================================
--- /src/robot/libraries/Process.py     Mon Oct 21 11:56:34 2013 UTC
+++ /src/robot/libraries/Process.py     Mon Oct 21 11:57:02 2013 UTC
@@ -375,6 +375,14 @@

Returns a `result object` containing information about the execution.

+        Examples:
+        | `Start Process`               | non-finishing-process |
+ | `Wait For Process` | timeout=30s | on_timeout='none' |
+        | `Process Should Be Running`   |
+ | ${result} = | `Wait For Process` | timeout=1m30s | on_timeout='kill' |
+        | `Process Should Be Stopped`   |
+ | `Should Be Equal As Integers` | ${result.rc} | -9 |
+
         `timeout` and `on_timeout` are new in Robot Framework 2.8.2.
         """
         process = self._processes[handle]
@@ -383,7 +391,7 @@
         if timeout:
             timeout = timestr_to_secs(timeout)
             if not self._process_is_stopped(process, timeout):
-                logger.warn('Process did not complete in %s.'
+                logger.info('Process did not complete in %s.'
                             % secs_to_timestr(timeout))
return self._manage_process_timeout(handle, on_timeout.lower())
         result.rc = process.wait() or 0
@@ -397,9 +405,7 @@
             return self.terminate_process(handle, kill=True)
         else:
             logger.info('Leaving process intact.')
-            result = self._results[self._processes[handle]]
-            result.rc = None
-            return result
+            return None

     def terminate_process(self, handle=None, kill=False):
         """Terminates the process.

--

--- 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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to