def RegisterExpansionSet(lang, dtc, type): expSet = resfile.MakeStdExpansionSet('pog', lang, type) expSet = resfile.AppendToExpandsionSet(expSet, 'pog', []) expSet = resfile.AppendToExpandsionSet(expSet, 'pos', ['def']) # if dtc == 'dtcon': # expSet = resfile.AppendToExpandsionSet(expSet, 'dtcon',['dtcoff']) # else: # expSet = resfile.AppendToExpandsionSet(expSet, 'dtcoff',['dtcon']) resfile.RegisterExpansionSet(expSet)
def execute(lang, type): global packageMap packageMap = {} expSet = resfile.MakeStdExpansionSet('java', lang, 'impl') expSet = resfile.AppendToExpandsionSet(expSet, '', ['dtcoff', 'dtcon']) resfile.RegisterExpansionSet(expSet) util.SetProfileBaseName("gmon-cpp-" + lang + "-" + type + "-" + cmdline.StartDate()) if (type == 'spec'): executeSpec(lang) else: executeImpl(lang)
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 execute(lang, type): global ext, binext #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 " + str(total) + "..." + str(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 execute(lang, type): global srcext, objext, binext expSet = resfile.MakeStdExpansionSet('cpp', lang, 'impl') expSet = resfile.AppendToExpandsionSet(expSet,'',['dtcoff','dtcon']) resfile.RegisterExpansionSet(expSet) util.SetProfileBaseName("gmon-cpp-"+lang+"-"+type+"-"+cmdline.StartDate()) if util.UsesVisualStudio(): srcext = "cpp" objext = "obj" binext = ".exe" else: srcext = 'cc' if (type == 'spec'): executeSpec(lang) else: executeImpl(lang)
def execute(lang, type): global vdmde, speccompare, backend, javac, java, vppde global parserOnly, runJavacBeforeParser, staticSemanticsOnly expSet = resfile.MakeStdExpansionSet('java2vdm', lang, 'impl') expSet = resfile.AppendToExpandsionSet(expSet, '', ['dtcoff', 'dtcon']) resfile.RegisterExpansionSet(expSet) javac = cmdline.LookUpWildCard('java', lang, 'spec', 'compiler') java = cmdline.LookUpWildCard('java', lang, 'spec', 'interpreter') vppde = cmdline.LookUpWildCard('java', 'pp', 'impl', 'code-generator') vdmde = cmdline.LookUpWildCard('java', 'sl', 'impl', 'code-generator') speccompare = vdmde backend = cmdline.LookUp('java2vdm-backend') staticSemanticsOnly = cmdline.LookUp('java2vdm-static-semantics-only') runJavacBeforeParser = cmdline.LookUp('java2vdm-javac-before-parser') parserOnly = cmdline.LookUp('java2vdm-java-parser-only') if (type == 'spec'): executeSpec(lang) else: executeImpl(lang)
def execute(lang, testType): expSet = resfile.MakeStdExpansionSet('api', lang, testType) resfile.RegisterExpansionSet(expSet) util.SetProfileBaseName("gmon-api-" + lang + "-" + testType + "-" + cmdline.StartDate()) if lang == 'sl': vdmServer = os.path.expanduser(cmdline.LookUp('api-sl-server')) else: vdmServer = os.path.expanduser(cmdline.LookUp('api-pp-server')) start_toolbox = cmdline.LookUp('api-run-start-toolbox') server_args = cmdline.LookUp('server-init-args').split(" ") # corba-init-args is used to pass arguments to the orb client_args = cmdline.LookUp('corba-init-args').split() orb = CORBA.ORB_init(client_args, CORBA.ORB_ID) if start_toolbox == 'yes': pid = os.fork() if pid == 0: report.Progress( 3, "Trying to start " + lang + "-toolbox: " + vdmServer) cmd = vdmServer + " " + "".join( server_args) + " > tb_output.tmp 2>&1" os.system(cmd) report.Error("Startup of Toolbox failed!") return false _exit(-1) waittime = 5 print("Waiting " + str(waittime) + " seconds for " + lang + "-server to start up...") time.sleep(waittime) if "VDM_OBJECT_LOCATION" in environ: location = environ["VDM_OBJECT_LOCATION"] else: if "HOME" in environ: location = environ["HOME"] else: location = "~" if lang == 'sl': location = location + '/vdmref.ior' else: location = location + '/vppref.ior' try: stringified_ior = open(os.path.expanduser(location)).read() except IOError: report.Error("Could not find IOR file " + location + "! Please start " + lang + "-Toolbox!") if start_toolbox == 'yes': os.kill(pid, 9) os.system("tset") return false try: vdmApp = orb.string_to_object(stringified_ior) except CORBA.COMM_FAILURE: _, ex, _ = sys.exc_info() print("CORBA.COMM_FAILUR") print(ex) vdmApp = None except CORBA.MARSHAL: _, ex, _ = sys.exc_info() print("CORBA.MARSHAL") print(ex) # vdmApp = None if vdmApp is None: report.Error("Nil object reference!") if start_toolbox == 'yes': os.kill(pid, 9) return false # check if vdmApp has correct type try: if not vdmApp._is_a('IDL:ToolboxAPI/VDMApplication:1.0'): report.Error("This is not a 'VDMApplication'-server!") if start_toolbox == 'yes': os.kill(pid, 9) return false except CORBA.COMM_FAILURE: report.Error("No connection to 'VDMApplication'-object!") if start_toolbox == 'yes': os.kill(pid, 9) return false # narrow vdmApp and get typecode vdmApp = vdmApp._narrow(ToolboxAPI.VDMApplication) tc = CORBA.TypeCode('IDL:ToolboxAPI/VDMApplication:1.0') # check if server is the one we want (SL or PP) try: toolType = vdmApp._get_Tool() if (lang == 'sl' and toolType == ToolboxAPI.PP_TOOLBOX) or \ (lang == 'pp' and toolType == ToolboxAPI.SL_TOOLBOX): report.Error(vdmServer + " is not a " + lang + "-server") if start_toolbox == 'yes': os.kill(pid, 9) return false else: print(vdmServer + " is a " + lang + "-server") clientID = vdmApp.Register() # run the testcases if not RunTestCases(lang, vdmApp, clientID): vdmApp.Unregister(clientID) if start_toolbox == 'yes': os.kill(pid, 9) return false except CORBA.COMM_FAILURE: report.Error("CORBA Communication error") vdmApp.Unregister(clientID) if start_toolbox == 'yes': os.kill(pid, 9) return false # clean up time.sleep(1) vdmApp.Unregister(clientID) if start_toolbox == 'yes': os.kill(pid, 9) os.system("tset") return true
def execute(lang, testType): expSet = resfile.MakeStdExpansionSet('api', lang, testType) resfile.RegisterExpansionSet(expSet) util.SetProfileBaseName("gmon-api-" + lang + "-" + testType + "-" + cmdline.StartDate()) if lang == 'sl': vdmServer = cmdline.LookUp('api-sl-server') else: vdmServer = cmdline.LookUp('api-pp-server') start_toolbox = cmdline.LookUp('api-run-start-toolbox') server_args = string.split(cmdline.LookUp('server-init-args'), " ") # corba-init-args is used to pass arguments to the orb client_args = string.split(cmdline.LookUp('corba-init-args')) orb = CORBA.ORB_init(client_args, CORBA.ORB_ID) if start_toolbox == 'yes': pid = os.fork() if pid == 0: report.Progress( 3, "Trying to start " + lang + "-toolbox: " + vdmServer) os.system(vdmServer + " " + string.join(server_args) + " > tb_output.tmp 2>&1") #os.execv (vdmServer, args) report.Error("Startup of Toolbox failed!") return false _exit(-1) # print "Waiting 5 seconds for "+lang+"-server to start up..." # time.sleep (5) print "Waiting 2 seconds for " + lang + "-server to start up..." time.sleep(2) if environ.has_key("VDM_OBJECT_LOCATION"): location = environ["VDM_OBJECT_LOCATION"] else: if environ.has_key("HOME"): location = environ["HOME"] else: location = "~" if lang == 'sl': location = location + '/vdmref.ior' else: location = location + '/vppref.ior' try: stringified_ior = open(location).read() except IOError: report.Error("Could not find IOR file " + location + "! Please start " + lang + "-Toolbox!") if start_toolbox == 'yes': os.kill(pid, 9) return false try: vdmApp = orb.string_to_object(stringified_ior) except CORBA.COMM_FAILURE, ex: print "CORBA.COMM_FAILUR" print ex vdmApp = None
def RegisterExpansionSet(lang, dtc, type): expSet = resfile.MakeStdExpansionSet('pog', lang, type) expSet = resfile.AppendToExpandsionSet(expSet, 'pog',[]) expSet = resfile.AppendToExpandsionSet(expSet, 'pos',['def']) resfile.RegisterExpansionSet(expSet)