Пример #1
0
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
Пример #2
0
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
Пример #3
0
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()
Пример #4
0
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
Пример #5
0
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
Пример #6
0
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()
Пример #7
0
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