def executeImpl(lang): global srcext, binext # counter to indicate progress total = 1 # jobSize is used to give a low level of outputting jobSize = cmdline.LookUp('spec-job-size') # Initialize the extraction of test cases. gentestcases.StartSearch('cpp', lang, 'impl') name = gentestcases.NextTestCase() while (name != None): report.setTestCaseName(name) if (total % jobSize) == 1: report.Progress(2, "Handling test cases " + `total` + "..." + `total + jobSize-1`) report.Progress(3, "Running " + name) (ok, modules) = RunImplTestCase(name, lang) if util.CleanFile(ok): bn = util.ExtractName(name) util.DeleteFiles([bn+".vdm",bn+".res", "icode." + srcext, "icode" + binext,"CGBase." + srcext, "CGBase.h", "CGBase.obj", "icode.obj", "compare.arg", "compare.vdm"]) if modules: for mod0 in modules: mod = string.replace(mod0, "_", "_u") util.DeleteFiles([mod+"." + srcext, mod+".h", mod+"_anonym." + srcext, mod+"_anonym.h",mod+"_userdef.h", mod + ".obj"]) name = gentestcases.NextTestCase() total = total +1
def executeImpl(lang, posdef): # counter to indicate progress total = 1 # jobSize is used to give a low level of outputting jobSize = cmdline.LookUp('spec-job-size') # Initialize the extraction of test cases. gentestcases.StartSearch('tc', lang, 'impl') name = gentestcases.NextTestCase() while (name != None): report.setTestCaseName(name) if (total % jobSize) == 1: report.Progress( 2, "Handling test cases " + ` total ` + "..." + ` total + jobSize - 1 `) report.Progress(3, "Running " + name) ok = RunImplTestCase(name, lang, posdef) if util.CleanFile(ok): bn = util.ExtractName(name) util.DeleteFiles([bn + ".vdm"]) name = gentestcases.NextTestCase() total = total + 1 util.MoveProfile()
def RunTestCases(lang, vdmApp, clientID): toolMediator = ToolMediator(vdmApp, clientID) total = 1 # jobSize is used to give a low level of outputting jobSize = cmdline.LookUp('spec-job-size') # Initialize the extraction of test cases. gentestcases.StartSearch('api', lang, 'impl') name = gentestcases.NextTestCase() while (name != None): report.setTestCaseName(name) if (total % jobSize) == 1: report.Progress( 2, "Handling test cases " + str(total) + "..." + str(total + jobSize - 1)) report.Progress(3, "Running " + name) ok = RunApiTestCase(name, lang, toolMediator) if util.CleanFile(ok): bn = util.ExtractName(name) util.DeleteFiles([bn + ".vdm"]) name = gentestcases.NextTestCase() total = total + 1 return true
def executeImpl(lang): # counter to indicate progress total = 1 # jobSize is used to give a low level of outputting jobSize = cmdline.LookUp('spec-job-size') # Initialize the extraction of test cases. gentestcases.StartSearch('java', lang, 'impl') name = gentestcases.NextTestCase() while (name != None): report.setTestCaseName(name) if (total % jobSize) == 1: report.Progress( 2, "Handling test cases " + str(total) + "..." + str(total + jobSize - 1)) report.Progress(3, "Running " + name) (ok, modules) = RunImplTestCase(name, lang) if util.CleanFile(ok): bn = util.ExtractName(name) util.DeleteFiles([ bn + ".vdm", bn + ".res", "TMAIN.java", "compare.arg", "compare.vdm" ]) if modules: for mod in modules: util.DeleteFiles([ mod + ".java", "external_" + mod + ".java", mod + ".class" ]) name = gentestcases.NextTestCase() total = total + 1
def execute(lang, type): global ext, binext # ok = convert.SetupSpecification(lang, 'j2vtf') # if not ok: # report.Error("ABORTING specification test for " + `lang`) # return #counter to indicate progress total = 1 #setting the coverage file coverageFile = "rtinfo.ast" #Set expected results expSet = resfile.MakeStdExpansionSet('j2vtf', lang, type) resfile.RegisterExpansionSet(expSet) #jobSize is used to give a low level of outputting jobSize = cmdline.LookUp('spec-job-size') #initialize the extraction of test cases gentestcases.StartSearch('j2vtf', lang, type) name = gentestcases.NextTestCase() while (name != None): #setting report report.setTestCaseName(name) if (total % jobSize) == 1: report.Progress( 2, "Handling test cases " + ` total ` + "..." + ` total + jobSize - 1 `) report.Progress(3, "Running " + name) ok = convert.ConvertLanguage(lang, name) if ok: ok = PrepareSpecCase(name, lang) if ok: ok = RunTestCase(name, lang, type, coverageFile) #cleaning up if ok: if util.CleanFile(ok): baseName = util.ExtractName(name) util.DeleteFiles([ baseName + ".vdm", baseName + ".ast", baseName + ".arg", baseName + ".debug", baseName + ".res", baseName + ".arg.res", baseName + ".arg.pt", "debug.arg" ]) #else: # break #generates next test case name = gentestcases.NextTestCase() total = total + 1
def executeImpl(lang, dtc): # counter to indicate progress total = 1 # jobSize is used to give a low level of outputting jobSize = cmdline.LookUp('spec-job-size') # Initialize the extraction of test cases. gentestcases.StartSearch('ip', lang, 'impl') name = gentestcases.NextTestCase() while (name != None): report.setTestCaseName(name) if (total % jobSize) == 1: report.Progress(2, "Handling test cases " + str(total) + "..." + str(total + jobSize-1)) report.Progress(3, "Running " + name) ok = PrepareImplCase(name, lang) if ok: ok = RunImplTestCase(name, lang,dtc) if util.CleanFile(ok): util.RemoveTestFiles(name,[".vdm",".res",".arg"]) name = gentestcases.NextTestCase() total = total +1 util.MoveProfile()
def execute(lang, type): global ext, binext #counter to indicate progress total = 1 #os type if util.IsWindowsOS() and os.environ.get('OSTYPE') == 'win32': ext = "cpp" binext = ".exe" else: ext = "cc" #main() file compiler = cmdline.LookUpWildCard('metaiv', lang, type, 'compiler') flags = cmdline.LookUpWildCard('metaiv', lang, type, 'cflags') MakeDriverAndObjectFiles("driver." + ext, compiler, flags) #Set expected results expSet = resfile.MakeStdExpansionSet('metaiv', lang, 'impl') resfile.RegisterExpansionSet(expSet) #jobSize is used to give a low level of outputting jobSize = cmdline.LookUp('spec-job-size') #initialize the extraction of test cases gentestcases.StartSearch('metaiv', lang, type) name = gentestcases.NextTestCase() while (name != None): #setting report report.setTestCaseName(name) if (total % jobSize) == 1: report.Progress(2, "Handling test cases " + str(total) + "..." + str(total + jobSize - 1)) report.Progress(3, "Running " + name) ok = RunTestCase(name, lang, type) #cleaning up if ok: if util.CleanFile(ok): baseName = util.ExtractName(name) util.DeleteFiles([baseName + ".res"])#, "driver" + binext]) else: break #generates next test case name = gentestcases.NextTestCase() total = total + 1
def executeSpec(lang): ok = convert.SetupSpecification(lang, 'cpp') if not ok: report.Error("ABORTING specification test for " + `lang`) return # counter to indicate progress total = 1 # number of spec. files to run in one vdmde execution jobSize = cmdline.LookUp('spec-job-size') # Initialize the extraction of test cases. gentestcases.StartSearch('cpp', lang, 'spec') # indicates if any spec test case produced an error. anyError = false # Initialize coverage file #coverageFile = "coverage-cpp-"+lang+"-"+cmdline.StartDate() coverageFile = "rtinfo.ast" while ( true ): testCases = gentestcases.NextTestCases(jobSize) if testCases == []: break startIndex = total endIndex = total+len(testCases) -1 report.Progress(2, "Handling test cases " + `startIndex` + "..." + `endIndex`) # Prepare the next test run - the parameter `spec-job-size' tells how # many testcases should be executed in each run. names = [] util.DeleteFiles([".vdmtest"]) for name in testCases: # prepare test cases. ok = PrepareSpecCase(name, lang) anyError = not ok or anyError if ok: names.append(name) # Get ready for next iteration. total = total +1 # Run the test cases if names != []: report.Progress(3, "Running test cases " + `startIndex` + "..." + `endIndex`) report.setTestCaseName("testcase " + `startIndex` + "..." + `endIndex`) okNames = RunSpecTestCases(names, lang, coverageFile) util.MoveProfile() # Clean Up. for testName in names: ok = (okNames.count(testName) > 0) if util.CleanFile(ok): baseName = util.ExtractName(testName) util.DeleteFiles([baseName+".vdm", baseName+".ast", baseName+".arg", baseName+".arg.res", baseName+".debug", baseName+".arg.pt","debug.arg",baseName+".res"]) anyError = anyError or not ok # Clean up .vdmde and .vdmtest if util.CleanFile(not anyError): util.DeleteFiles([".vdmde",".vdmtest"])
def executeSpec(lang): modules = None ok = convert.SetupSpecification(lang, 'java') if not ok: report.Error("ABORTING specification test for '" + lang + "'") return # counter to indicate progress total = 1 # number of spec. files to run in one vdmde execution jobSize = cmdline.LookUp('spec-job-size') # Initialize the extraction of test cases. gentestcases.StartSearch('java', lang, 'spec') # indicates if any spec test case produced an error. anyError = false # Initialize coverage file coverageFile = "coverage-java-" + lang + "-" + cmdline.StartDate() while (true): testCases = gentestcases.NextTestCases(jobSize) if testCases == []: break startIndex = total endIndex = total + len(testCases) - 1 report.Progress( 2, "Handling test cases " + str(startIndex) + "..." + str(endIndex)) # Prepare the next test run - the parameter 'spec-job-size' tells how # many testcases should be executed in each run. names = [] util.DeleteFiles([".vdmtest"]) for name in testCases: # prepare test cases. ok = PrepareSpecCase(name, lang) anyError = not ok or anyError if ok: names.append(name) # Get ready for next iteration. total = total + 1 # Run the test cases if names != []: report.Progress( 3, "Running test cases " + str(startIndex) + "..." + str(endIndex)) report.setTestCaseName("testcase " + str(startIndex) + "..." + str(endIndex)) (okNames, modules) = RunSpecTestCases(names, lang, coverageFile) util.MoveProfile() baseName = util.ExtractName(name) if util.GenTestDir(): util.MakeDir(baseName) files = [ baseName + ".vdm", baseName + ".ast", baseName + ".arg", baseName + ".arg.res", baseName + ".debug", baseName + ".opt", baseName + ".arg.pt", "debug.arg", baseName + ".res" ] for mod in modules: files = files + [ mod + ".java", "external_" + mod + ".java", mod + ".java.bak" ] util.DeleteFiles( [mod + ".class", mod + "$" + mod + "Sentinel.class"]) for file in files: util.CopyFileIfExists(file, baseName + "/" + file) # Clean Up. for testName in names: ok = (okNames.count(testName) > 0) if util.CleanFile(ok): util.DeleteFiles([ baseName + ".vdm", baseName + ".ast", baseName + ".arg", baseName + ".arg.res", baseName + ".debug", baseName + ".opt", baseName + ".arg.pt", "debug.arg", baseName + ".res" ]) anyError = anyError or not ok if util.CleanFile(not anyError): util.DeleteFiles(["TMAIN.java", "TMAIN.class"]) if modules != None: for mod in modules: util.DeleteFiles([ mod + ".java", "external_" + mod + ".java", mod + ".class", mod + "$" + mod + "Sentinel.class", mod + ".java.bak" ]) # Clean up .vdmde and .vdmtest if util.CleanFile(not anyError): util.DeleteFiles([".vdmde", ".vdmtest"])