61 lines
1.1 KiB
Python
Executable File
61 lines
1.1 KiB
Python
Executable File
#!/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."
|