summaryrefslogtreecommitdiff
path: root/tests/test-daemon.py
diff options
context:
space:
mode:
authorEthan Jackson <ethan@nicira.com>2010-09-22 21:59:02 -0700
committerEthan Jackson <ethan@nicira.com>2010-09-23 02:00:03 -0700
commit6793129d369dee182d9260620d1db9188f09d986 (patch)
tree5254a8304f51a2e0815f9a4b5d0d669d1bcb7590 /tests/test-daemon.py
parent9c64f2384d850658985d7e18003443c196e89ae1 (diff)
downloadopenvswitch-6793129d369dee182d9260620d1db9188f09d986.tar.gz
tests: Test that children restart with special exit code
Added a test which checks that the python daemon code properly restarts child processes which exit with RESTART_EXIT_CODE.
Diffstat (limited to 'tests/test-daemon.py')
-rw-r--r--tests/test-daemon.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/tests/test-daemon.py b/tests/test-daemon.py
index 98a516580..386445d44 100644
--- a/tests/test-daemon.py
+++ b/tests/test-daemon.py
@@ -13,13 +13,20 @@
# limitations under the License.
import getopt
+import signal
import sys
import time
import ovs.daemon
import ovs.util
+def handler(signum, frame):
+ raise Exception("Signal handler called with %d" % signum)
+
def main(argv):
+
+ signal.signal(signal.SIGHUP, handler)
+
try:
options, args = getopt.gnu_getopt(
argv[1:], 'b', ["bail", "help"] + ovs.daemon.LONG_OPTIONS)
@@ -63,4 +70,10 @@ Other options:
sys.exit(0)
if __name__ == '__main__':
- main(sys.argv)
+ try:
+ main(sys.argv)
+ except SystemExit:
+ # Let system.exit() calls complete normally
+ raise
+ except:
+ sys.exit(ovs.daemon.RESTART_EXIT_CODE)