from Project import Project import json p = Project("https://github.com/castor-software/depswap/") p.path = "/Users/tdurieux/git/jdbl" print(json.dumps(p.get_test_results(), indent=1))
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)
"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))