X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=support%2Fregression%2Fgenerate-cases.py;h=e2c08cc7b98f031a270e4df8af77c94397f263c7;hb=ca46a6e3d9ac29d4d4943d2873e725b9703f5aed;hp=9ad7a5bb54048968e91e370b4bb3a57406ea2e12;hpb=527df2cf2950118c1406a65102bf15d909747e08;p=fw%2Fsdcc diff --git a/support/regression/generate-cases.py b/support/regression/generate-cases.py index 9ad7a5bb..e2c08cc7 100644 --- a/support/regression/generate-cases.py +++ b/support/regression/generate-cases.py @@ -20,7 +20,7 @@ testfuntablefooter = """} # Code to generate the suite function testfunsuite = """ -const char * +code const char * __getSuiteName(void) { return "{testcase}"; @@ -107,8 +107,7 @@ class InstanceGenerator: n = 0; for fun in self.functions: - # Turn the function definition into a pointer - fun = re.sub(r'\(\w+\)', '', fun) + # Turn the function definition into a function call fout.write(" __prints(\"Running " + fun + "\\n\");\n"); fout.write(' ' + fun + "();\n") n += 1; @@ -118,6 +117,7 @@ class InstanceGenerator: fout.write(testfunsuite); fout.close() + return n def readfile(self): """Read in all of the input file.""" @@ -156,14 +156,16 @@ class InstanceGenerator: None else: # Pull out any test function names - if re.search(r'^test\w+\(\w+\)', line) != None: - self.functions.append(line) + m = re.match(r'^(?:\W*void\W+)?\W*(test\w*)\W*\(\W*void\W*\)', line) + if m != None: + self.functions.append(m.group(1)) def generate(self): """Main function. Generates all of the instances.""" self.readfile() self.parse() - self.writetemplate() + if self.writetemplate() == 0: + sys.stderr.write("Empty function list in " + self.inname + "!\n") # Create the output directory if it doesn't exist createdir(outdir)