blob: cbff3729aae431c74009a6ce11ee55c22b800710 [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 Reissbcaa2ad2008-06-10 22:55:26 +000012def runTest(server_class):
13 print "Testing ", server_class
14 serverproc = subprocess.Popen([sys.executable, relfile("TestServer.py"), server_class])
15 try:
David Reiss0c90f6f2008-02-06 22:18:40 +000016
David Reissbcaa2ad2008-06-10 22:55:26 +000017 ret = subprocess.call([sys.executable, relfile("TestClient.py")])
18 if ret != 0:
19 raise Exception("subprocess failed")
20 finally:
21 # fixme: should check that server didn't die
22 os.kill(serverproc.pid, signal.SIGKILL)
23
24 # wait for shutdown
25 time.sleep(5)
26
27map(runTest, ["TForkingServer", "TThreadPoolServer",
28 "TThreadedServer", "TSimpleServer"])