blob: 48eadb66c471699e71974662900c15af870e64c1 [file] [log] [blame]
Mark Slee5299a952007-10-05 00:13:24 +00001#!/usr/bin/env python
2
David Reissbcaa2ad2008-06-10 22:55:26 +00003import time
Mark Slee5299a952007-10-05 00:13:24 +00004import subprocess
5import sys
6import os
7import signal
8
David Reiss2a4bfd62008-04-07 23:45:00 +00009def relfile(fname):
10 return os.path.join(os.path.dirname(__file__), fname)
11
David Reiss74421272008-11-07 23:09:31 +000012FRAMED = ["TNonblockingServer"]
13
David Reissbcaa2ad2008-06-10 22:55:26 +000014def runTest(server_class):
15 print "Testing ", server_class
16 serverproc = subprocess.Popen([sys.executable, relfile("TestServer.py"), server_class])
17 try:
David Reiss74421272008-11-07 23:09:31 +000018 argv = [sys.executable, relfile("TestClient.py")]
19 if server_class in FRAMED:
20 argv.append('--framed')
21 ret = subprocess.call(argv)
David Reissbcaa2ad2008-06-10 22:55:26 +000022 if ret != 0:
23 raise Exception("subprocess failed")
24 finally:
25 # fixme: should check that server didn't die
26 os.kill(serverproc.pid, signal.SIGKILL)
27
28 # wait for shutdown
29 time.sleep(5)
30
31map(runTest, ["TForkingServer", "TThreadPoolServer",
David Reiss74421272008-11-07 23:09:31 +000032 "TThreadedServer", "TSimpleServer", "TNonblockingServer"])