aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpcarrier <pcarrier@ef72aa8b-4018-0410-8976-d6e080ef94d8>2010-11-28 02:24:46 +0000
committerpcarrier <pcarrier@ef72aa8b-4018-0410-8976-d6e080ef94d8>2010-11-28 02:24:46 +0000
commitcb9abbe495d96d22f48b3285468ad0239d9a9eeb (patch)
treeed470350a2c2a99079ed88082efbb14e6a37c8c5
parent91bb678ec3e0d9f36b8ebefe89888325505ef82d (diff)
downloadsos-cb9abbe495d96d22f48b3285468ad0239d9a9eeb.tar.gz
[tests] worker: tests reflecting the SIGINT design change
git-svn-id: svn+ssh://svn.fedorahosted.org/svn/sos/trunk@1053 ef72aa8b-4018-0410-8976-d6e080ef94d8
-rw-r--r--tests/worker.py25
-rw-r--r--worker/specs2
2 files changed, 19 insertions, 8 deletions
diff --git a/tests/worker.py b/tests/worker.py
index 25ff5aab..cf121f38 100644
--- a/tests/worker.py
+++ b/tests/worker.py
@@ -14,6 +14,9 @@ class WorkerTests(unittest.TestCase):
def prompt(self, n):
return ('#%i#\r\n' % n)
+ def interrupted(self, n):
+ return ('#%i# INTERRUPTED\r\n' % n)
+
def setUp(self):
self.worker = pexpect.spawn('python ../worker/worker.py')
# worker should always be very fast to span
@@ -48,24 +51,32 @@ class WorkerTests(unittest.TestCase):
self.sendlines(['exit'])
self.__finishes_ok__()
- def test_ctrlc_on_cmd_prompt_quits(self):
+ def test_ctrlc_when_running(self):
+ self.sendlines(['exec', 'sleep 1; exec echo lol'])
self.sig(SIGINT)
- self.expect(pexpect.EOF)
- self.__finishes_ok__()
+ self.expect(self.interrupted(0)+self.prompt(1))
+ self.test_exit()
+
+ def test_ctrlc_on_cmd_prompt(self):
+ self.sig(SIGINT)
+ self.expect(self.interrupted(0)+self.prompt(1))
+ self.test_exit()
- def test_ctrlc_when_entering_command_quits(self):
+ def test_ctrlc_when_entering_command(self):
# "Mon clavier se blo" -- French reference
self.send('glo')
self.sig(SIGINT)
- self.expect(pexpect.EOF)
+ self.expect(self.interrupted(0)+self.prompt(1))
+ self.test_exit()
def test_ctrlc_on_readparms_drops(self):
self.sendlines(['exec'])
self.sig(SIGINT)
- self.expect(self.prompt(0))
+ self.expect(self.interrupted(0)+self.prompt(1))
self.sendlines(['glob'])
self.sig(SIGINT)
- self.expect(self.prompt(0))
+ self.expect(self.interrupted(1)+self.prompt(2))
+ self.test_exit()
def test_basic_noop(self):
self.sendlines(['noop'])
diff --git a/worker/specs b/worker/specs
index 76baa272..0d1b7dd1 100644
--- a/worker/specs
+++ b/worker/specs
@@ -38,7 +38,7 @@ number.
/- by Python to display exceptions;
/- to print "ALIVE" when SIGUSR1 is received or after a "ping" request;
/- to print "UNKNOWN COMMAND" when a command is unknown;
-/- to print "INTERRUPTED" when a command is interrupted with SIGINT.
+/- to print "INTERRUPTED #X#" when a command is interrupted with SIGINT.
[statement(easy to prove wrong, hard to prove right)]
Requests