- Added a generic test generator script.

This commit is contained in:
ccremers 2004-10-15 08:45:59 +00:00
parent 795f28006d
commit 0f68fcb8d6

60
spdl/gen-tests.py Executable file
View File

@ -0,0 +1,60 @@
#!/usr/bin/python
#
# Generate a test suite
#
# argv[1] tuple width
# stdin list of protocol file names
#
import sys
import os
import time
import datetime
import string
tempfile = 'generated-test-list.tmp'
# Derive tuple list
count = sys.argv[1]
lstatus=os.system('./tuples.py ' + count + ' >' + tempfile)
# Header
print "#!/usr/bin/sh"
print "#"
print "# Test list generated by gen-tests.py"
print "# at ", time.asctime()
print "#"
# Functions to assist
def getline (inputfile):
return string.strip(inputfile.readline())
def makefileline (tuple):
rt = "results/combined" + count + "-"
namelist = string.split (tuple)
tocome = len (namelist)
for name in namelist:
rt = rt + name
tocome = tocome - 1
if tocome > 0:
rt = rt + "-"
rt = rt + ".txt"
return rt
def processline (l):
print "./mp.sh ",
print l,
print " >", makefileline(l)
# Process lines
inp = open(tempfile, 'r')
line = getline(inp)
lines = 0
while line:
# process the line
processline(line)
lines = lines + 1
# get next
line = getline(inp)
inp.close()
print "#"
print "# ", lines, " lines processed."