From 0f68fcb8d6d69c6d11e02a000bb82aa0492c5c89 Mon Sep 17 00:00:00 2001 From: ccremers Date: Fri, 15 Oct 2004 08:45:59 +0000 Subject: [PATCH] - Added a generic test generator script. --- spdl/gen-tests.py | 60 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100755 spdl/gen-tests.py diff --git a/spdl/gen-tests.py b/spdl/gen-tests.py new file mode 100755 index 0000000..395580e --- /dev/null +++ b/spdl/gen-tests.py @@ -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."