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