1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
|
#/usr/bin/env python
import sys, time, string, os, unittest, getopt, StressSuite
StressSuite.RUNS = 10000
try:
opts,args = getopt.getopt(sys.argv[1:],"hn:")
for o,a in opts:
if o == "-n":
StressSuite.RUNS = int(a)
elif o == "-h":
print \
"""Usage: stresstest.sh [-nopp] [-gdb] [-n numruns] [T1 T2 TX-TY ... TN]"""
sys.exit(2)
except getopt.error, e:
print sys.argv[0]+": "+str(e)
sys.exit(2)
tl=[]
if args:
for f in args:
if f.find("-") != -1:
limits = f.split("-")
try:
for r in range(int(limits[0][1:]),int(limits[1][1:])+1):
tl.append(limits[0][0]+str(r))
except ValueError:
print sys.argv[0]+": Error: "+args[0]+ \
" is a stupid test range"
sys.exit(2)
else:
tl.append(f)
StressSuite.TESTS = tl
else:
StressSuite.TESTS = 0
StressSuite.DEBUG = 0
def uniq(seq):
dict = {}
for e in seq: dict[e] = 1
return dict.keys()
# On-demand loading of suites so a partially broken O-P can still be
# used for stressing certain parts.
suites = []
sh = {
"B": [ "BasicTest", "BasicTest" ],
"X": [ "ClientServer", "AccessorTest" ],
"V": [ "ClientServer", "ParameterReturnValueTest" ],
"J": [ "ClientServer", "ObjectReferenceTest" ],
"R": [ "ClientServer", "ReturnValueTest" ],
"T": [ "ClientServer", "ParameterTest" ],
"P": [ "ORBPOATest", "ORBPOATest" ],
"O": [ "BasicORB", "BasicORB" ],
}
if StressSuite.TESTS:
# Get first char of each test
for t in uniq(map(lambda x: x[0], StressSuite.TESTS)):
m = __import__( sh[t][0] )
c = getattr(m, sh[t][1] )
suites.append(
unittest.makeSuite( c, suiteClass = StressSuite.StressSuite )
)
else:
for s in sh.values():
m = __import__( s[0] )
c = getattr(m, s[1] )
suites.append(
unittest.makeSuite( c, suiteClass = StressSuite.StressSuite ) )
suite = unittest.TestSuite ( suites )
runner = unittest.TextTestRunner( verbosity = 0)
runner.run(suite)
|