aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2010-06-10 03:12:11 +0000
committerRob Austein <sra@hactrn.net>2010-06-10 03:12:11 +0000
commitc39d671e23c42f4aa0656ee3d31ab80f84a23976 (patch)
tree8311b7d0829cb07be82ea14fbc9c58645f475b3e
parent1bc4888baf34c939e954f4ab98b781c3c9b30d67 (diff)
Add -keep_going flag to let us kill and restart individual daemons
without shutting down the whole test. svn path=/rpkid/tests/yamltest.py; revision=3280
-rw-r--r--rpkid/tests/yamltest.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/rpkid/tests/yamltest.py b/rpkid/tests/yamltest.py
index 169ce7be..aa68375a 100644
--- a/rpkid/tests/yamltest.py
+++ b/rpkid/tests/yamltest.py
@@ -522,14 +522,17 @@ time.tzset()
cfg_file = "yamltest.conf"
pidfile = None
+keep_going = False
-opts, argv = getopt.getopt(sys.argv[1:], "c:hp:?", ["config=", "help", "pidfile="])
+opts, argv = getopt.getopt(sys.argv[1:], "c:hkp:?", ["config=", "help", "keep_going", "pidfile="])
for o, a in opts:
if o in ("-h", "--help", "-?"):
print __doc__
sys.exit(0)
if o in ("-c", "--config"):
cfg_file = a
+ elif o in ("-k", "--keep_going"):
+ keep_going = True
elif o in ("-p", "--pidfile"):
pidfile = a
@@ -685,7 +688,9 @@ try:
# Wait until something terminates.
signal.signal(signal.SIGCHLD, lambda *dont_care: None)
- if all(p.poll() is None for p in progs):
+ while (any(p.poll() is None for p in progs)
+ if keep_going else
+ all(p.poll() is None for p in progs)):
signal.pause()
finally: