예제 #1
0
def run(args, javac_commands, jars):
    bixie_jar = os.path.join(args.lib_dir, "bixie.jar")

    base_command = [
        "java", "-jar", bixie_jar, "-html",
        os.path.join(args.output_directory, 'bixie_report')
    ]

    i = 1

    for jc in javac_commands:
        cmd = copy.copy(base_command)

        if common.classpath(jc):
            cmd.extend(["-cp", common.classpath(jc)])

        if common.class_directory(jc):
            cmd.extend(["-j", common.class_directory(jc)])

        if common.source_path(jc):
            cmd.extend(['-src', common.source_path(jc)])

        out_filename = 'bixie-report-{}.log'.format(i)
        cmd.extend(['-o', os.path.join(args.output_directory, out_filename)])

        common.run_cmd(cmd, args, 'bixie')
        i = i + 1
예제 #2
0
def run(args, javac_commands, jars):
  bixie_jar = os.path.join(args.lib_dir, "bixie.jar")

  base_command = ["java",
                  "-jar", bixie_jar,
                  "-html", os.path.join(args.output_directory, 'bixie_report')]

  i = 1

  for jc in javac_commands:
    cmd = copy.copy(base_command)

    if common.classpath(jc):
      cmd.extend(["-cp", common.classpath(jc)])

    if common.class_directory(jc):
      cmd.extend(["-j", common.class_directory(jc)])

    if common.source_path(jc):
      cmd.extend(['-src', common.source_path(jc)])

    out_filename = 'bixie-report-{}.log'.format(i)
    cmd.extend(['-o', os.path.join(args.output_directory, out_filename)])

    common.run_cmd(cmd, args, 'bixie')
    i = i + 1
예제 #3
0
def run(args, javac_commands, jars):
    if not args.time_limit:
        args.time_limit = 2

    if not args.test_limit:
        args.test_limit = 2

    if not args.out_dir:
        args.out_dir = "./dyntrace_output"

    current_dir = os.path.dirname(os.path.realpath(__file__))
    current_dir = os.path.join(current_dir, os.pardir)
    current_dir = os.path.join(current_dir, os.pardir)
    current_dir += "/"

    dyntrace_command = [
        "java", "-jar",
        os.path.join(current_dir, "build/libs/DynSlicer.jar")
    ]

    i = 1

    for jc in javac_commands:
        javac_switches = jc['javac_switches']
        cmd = dyntrace_command + [
            common.classpath(jc),
            common.class_directory(jc), args.out_dir, current_dir,
            args.time_limit, args.test_limit
        ]

        common.run_cmd(cmd)
        i = i + 1
예제 #4
0
def dyntrace(i, java_command, out_dir, lib_dir):
  classpath = common.classpath(java_command)
  classdir = os.path.abspath(common.class_directory(java_command))

  randoop_driver = "RegressionTestDriver"
  test_src_dir = os.path.join(out_dir, "test-src{}".format(i))
  test_class_directory = os.path.join(out_dir, "test-classes{}".format(i))

  base_classpath = classpath + ":" + classdir
  randoop_classpath = base_classpath + ":" + os.path.join(lib_dir, "randoop.jar")
  compile_classpath = base_classpath + ":" + os.path.join(lib_dir, "junit-4.12.jar")
  chicory_classpath = compile_classpath + ":" + os.path.abspath(test_class_directory) + ":" + os.path.join(lib_dir, "daikon.jar") + ":" + os.path.join(lib_dir, "hamcrest-core-1.3.jar")

  classes = get_classes(classdir)

  class_list_file = make_class_list(classes)
  time_limit = 10
  output_limit = 20

  generate_tests(randoop_classpath, class_list_file, test_src_dir, time_limit, output_limit)

  files_to_compile = get_files_to_compile(test_src_dir)

  compile_test_cases(compile_classpath, test_class_directory, files_to_compile)
  run_chicory(chicory_classpath, classes, randoop_driver, out_dir)
예제 #5
0
def dyntrace(args,
             i,
             java_command,
             out_dir,
             lib_dir,
             run_parts=['randoop', 'chicory']):
    def lib(jar):
        return os.path.join(lib_dir, jar)

    classpath = common.classpath(java_command)
    classdir = os.path.abspath(common.class_directory(java_command))

    randoop_driver = "RegressionTestDriver"
    test_src_dir = os.path.join(out_dir, "test-src{}".format(i))
    test_class_directory = os.path.join(out_dir, "test-classes{}".format(i))

    if not os.path.exists(test_class_directory):
        os.mkdir(test_class_directory)

    if classpath:
        base_classpath = classpath + ":" + classdir
    else:
        base_classpath = classdir

    with open(os.path.join(test_class_directory, 'classpath.txt'), 'w') as f:
        f.write(base_classpath)
    with open(os.path.join(test_class_directory, 'classdir.txt'), 'w') as f:
        f.write(classdir)

    randoop_classpath = lib('randoop.jar') + ":" + base_classpath
    compile_classpath = lib("junit-4.12.jar") + ":" + base_classpath
    chicory_classpath = ':'.join([
        os.path.abspath(test_class_directory),
        os.path.join(os.environ.get('DAIKONDIR'), 'daikon.jar'),
        lib("hamcrest-core-1.3.jar"), compile_classpath
    ])

    if 'randoop' in run_parts:
        classes = sorted(common.get_classes(java_command))
        class_list_file = make_class_list(test_class_directory, classes)
        junit_after_path = get_special_file("junit-after", out_dir, i)

        generate_tests(args, randoop_classpath, class_list_file, test_src_dir,
                       junit_after_path)
        files_to_compile = get_files_to_compile(test_src_dir)
        compile_test_cases(args, compile_classpath, test_class_directory,
                           files_to_compile)

    if 'chicory' in run_parts:
        selects = get_select_list(classdir)
        omit_file_path = get_special_file("omit-list", out_dir, i)
        omits = get_omit_list(omit_file_path)

        run_dyncomp(args, chicory_classpath, randoop_driver,
                    test_class_directory, selects, omits)
        run_chicory(args, chicory_classpath, randoop_driver,
                    test_class_directory, selects, omits)
        run_daikon(args, chicory_classpath, test_class_directory, False)
        if 'invcounts' in run_parts:
            run_daikon(args, chicory_classpath, test_class_directory, True)
예제 #6
0
def run(args, javac_commands, jars):
  if not args.time_limit:
    args.time_limit = 2  

  if not args.test_limit:
    args.test_limit = 2  

  if not args.out_dir:
    args.out_dir = "./dyntrace_output"

  current_dir = os.path.dirname(os.path.realpath(__file__))
  current_dir = os.path.join(current_dir, os.pardir)
  current_dir = os.path.join(current_dir, os.pardir)
  current_dir += "/"


  dyntrace_command = ["java", "-jar", os.path.join(current_dir, "build/libs/DynSlicer.jar")]

  i = 1

  for jc in javac_commands:
    javac_switches = jc['javac_switches']
    cmd = dyntrace_command + [common.classpath(jc), common.class_directory(jc), args.out_dir, current_dir, args.time_limit, args.test_limit]

    common.run_cmd(cmd)
    i = i + 1
예제 #7
0
def run(args, javac_commands, jars):
    if not args.bixie_jar:
        print "Could not run bixie tool: missing arg --bixie-jar"
        return

    bixie_command = [
        "java", "-jar", args.bixie_jar, "-html",
        os.path.join(args.output_directory, 'bixie_report')
    ]

    i = 1

    for jc in javac_commands:
        javac_switches = jc['javac_switches']

        cmd = bixie_command + [
            "-cp",
            common.classpath(jc), "-j",
            common.class_directory(jc)
        ]
        if common.source_path(jc):
            cmd.extend(['-src', common.source_path(jc)])

        out_filename = 'bixie-report-{}.log'.format(i)
        cmd.extend(['-o', os.path.join(args.output_directory, out_filename)])

        common.run_cmd(cmd)
        i = i + 1
예제 #8
0
def dyntrace(args, i, java_command, out_dir, lib_dir, run_parts=['randoop','chicory']):
  def lib(jar):
    return os.path.join(lib_dir, jar)

  classpath = common.classpath(java_command)
  classdir = os.path.abspath(common.class_directory(java_command))

  randoop_driver = "RegressionTestDriver"
  test_src_dir = os.path.join(out_dir, "test-src{}".format(i))
  test_class_directory = os.path.join(out_dir, "test-classes{}".format(i))

  if not os.path.exists(test_class_directory):
    os.mkdir(test_class_directory)

  if classpath:
    base_classpath = classpath + ":" + classdir
  else:
    base_classpath = classdir

  with open(os.path.join(test_class_directory, 'classpath.txt'), 'w') as f:
    f.write(base_classpath)
  with open(os.path.join(test_class_directory, 'classdir.txt'), 'w') as f:
    f.write(classdir)

  randoop_classpath = lib('randoop.jar') + ":" + base_classpath
  # randoop needs to be on compile classpath due to replacement of System.exit with SystemExitCalledError
  compile_classpath = lib("junit-4.12.jar") + ":" + randoop_classpath
  chicory_classpath = ':'.join([os.path.abspath(test_class_directory),
                                os.path.join(os.environ.get('DAIKONDIR'), 'daikon.jar'),
                                lib("hamcrest-core-1.3.jar"),
                                compile_classpath])
  replace_call_classpath = lib('replacecall.jar')

  if 'randoop' in run_parts:
    classes = sorted(common.get_classes(java_command))
    class_list_file = make_class_list(test_class_directory, classes)
    junit_after_path = get_special_file("junit-after", out_dir, i)

    generate_tests(args, randoop_classpath, class_list_file, test_src_dir, junit_after_path, replace_call_classpath)
    files_to_compile = get_files_to_compile(test_src_dir)
    if not files_to_compile:
      return
    compile_test_cases(args, compile_classpath, test_class_directory, files_to_compile)

  if 'chicory' in run_parts:
    selects = get_select_list(classdir)
    omit_file_path = get_special_file("omit-list", out_dir, i)
    omits = get_omit_list(omit_file_path)

    run_dyncomp(args, chicory_classpath, randoop_driver, test_class_directory, selects, omits)
    run_chicory(args, chicory_classpath, randoop_driver, test_class_directory, selects, omits)
    run_daikon(args, chicory_classpath, test_class_directory, False)
    if 'invcounts' in run_parts:
      run_daikon(args, chicory_classpath, test_class_directory, True)

    if args.daikon_xml:
      daikon_print_xml(args, chicory_classpath, test_class_directory)
예제 #9
0
def run(args, javac_commands, jars):
  if not args.bixie_jar:
    print "Could not run bixie tool: missing arg --bixie-jar"
    return

  bixie_command = ["java", "-jar", args.bixie_jar,
                    "-html", os.path.join(args.output_directory, 'bixie_report')]

  i = 1

  for jc in javac_commands:
    javac_switches = jc['javac_switches']

    cmd = bixie_command + ["-cp", common.classpath(jc),
                            "-j", common.class_directory(jc)]
    if common.source_path(jc):
      cmd.extend(['-src', common.source_path(jc)])

    out_filename = 'bixie-report-{}.log'.format(i)
    cmd.extend(['-o', os.path.join(args.output_directory, out_filename)])

    common.run_cmd(cmd)
    i = i + 1