Beispiel #1
0
    args = parser.parse_args()

    working_directory = tempfile.mkdtemp()

    project = Project(args.url)
    project.clone(working_directory)
    project.checkout_commit(args.commit)

    project.install(stdout="install.log", timeout=args.timeout)

    if len(project.pom.poms) == 0:
        os._exit(os.EX_OK)

    to_instrument = set()

    cl = project.classpath()
    for p in cl:
        for dep in p.split(":"):
            for lib in json_libs:
                if lib.replace(".", "/").replace(":", "/") in dep:
                    to_instrument.add(dep)
                    break
    if len(to_instrument) == 0:
        os._exit(os.EX_OK)

    yajta_jar = os.path.join(os.path.dirname(os.path.realpath(__file__)),
                             "yajta.jar")

    for lib in to_instrument:
        lib_file = os.path.basename(lib)
        cache_path = os.path.join(args.results, "instrumented_libs", lib_file)
Beispiel #2
0
    print("[%s] [STARTED]  Test %s" %
          (datetime.now().strftime("%d/%m/%Y %H:%M:%S"), project.name),
          flush=True)
    status = project.test(stdout=log_path, clean=False, timeout=args.timeout)
    print("[%s] [FINISHED] Test %s (status: %s)" %
          (datetime.now().strftime("%d/%m/%Y %H:%M:%S"), project.name, status),
          flush=True)
    log = LogAnalyser(log_path)

    o = {
        "url": project.url,
        "commit": args.commit,
        "lib": args.lib,
        "name": "original",
        "test": project.get_test_results(),
        "classpath": project.classpath(),
        "errors": log.parse()
    }
    print(o["errors"])

    result_folder = os.path.join(args.results, "experimentv2", project.repo,
                                 args.lib)
    if not os.path.exists(result_folder):
        os.makedirs(result_folder)
    path_result = os.path.join(result_folder, "original.json")

    with open(path_result, 'w') as fd:
        json.dump(o, fd, indent=1)

    results["executions"].append(o)
    os.rename(log_path, os.path.join(project_path, "origin.log"))
Beispiel #3
0
        "test_results": [],
        "start":
        time.time(),
        "env":
        getEnv()
    }
    if args.coverage:
        project.inject_jacoco_plugin()
    log_path = os.path.join(os.path.dirname(os.path.realpath(__file__)),
                            "output.log")
    project.compile(clean=False, stdout=log_path, timeout="10m")
    output['compile-log'] = ""
    if os.path.exists(log_path):
        with open(log_path, 'r') as fd:
            output['compile-log'] = fd.read()
    output['test-logs'] = []
    for i in range(0, args.iteration):
        #project.test(clean=False)
        project.test(clean=False, stdout=log_path, timeout=args.timeout)
        if os.path.exists(log_path):
            with open(log_path, 'r') as fd:
                output['test-logs'].append(fd.read())
        if args.output is not None:
            project.copy_test_results(args.output)
        if args.coverage:
            project.copy_jacoco(args.output)
        output['test_results'].append(project.get_test_results())
    output['end'] = time.time()
    output['classpath'] = project.classpath()
    print(json.dumps(output))