f.write("<tbody>") for p in list: stringtime1 = '--' if p[1] >= TIMEOUT else repr(round(p[1], 3)) stringtime2 = '--' if p[2] >= TIMEOUT else repr(round(p[2], 3)) f.write("<tr>") onesmaller = p[1] < p[2] f.write("<td>" + p[0] + "</td><td>" + bold(stringtime1, onesmaller) + "</td><td>" + bold(stringtime2, not onesmaller) + "</td>") f.write("</tr>") f.write("</tbody>") f.write("</table>") f.write("</body>\n</html>") if len(sys.argv) < 3: print("Usage:") print("\t /comparetimes.py LIST_FILE BINARY1 BINARY2") print("\t /comparetimes.py DIRECTORY BINARY1 BINARY2") exit(0) PATH_TO_SHARPSAT_BINARY1 = os.path.expandvars(os.path.expanduser(sys.argv[2])) PATH_TO_SHARPSAT_BINARY2 = os.path.expandvars(os.path.expanduser(sys.argv[3])) cnflist = read_filelist(os.path.expandvars(os.path.expanduser(sys.argv[1]))) compare_data = run_all_on_list(TIMEOUT, cnflist, [PATH_TO_SHARPSAT_BINARY1, PATH_TO_SHARPSAT_BINARY2]) store_results("compare_results.html", PATH_TO_SHARPSAT_BINARY1, PATH_TO_SHARPSAT_BINARY2, compare_data)
#print(f + ": " + repr(os.path.isfile(dpath + f))) if os.path.isfile(dpath + "/" + f) and f.split(".")[len(f.split(".")) - 1] == "cnf": list.append(dpath + "/" + f) else: print("A file with a list of cnf files found.") list = read_filelist(cnffile_source) print("DONE") return list def extract_from_args(): binaries = [] for i in range(2, len(sys.argv)): binaries.append(os.path.expandvars(os.path.expanduser(sys.argv[i]))) return os.path.expandvars(os.path.expanduser(sys.argv[1])), binaries if len(sys.argv) < 3: print("Usage: ") print(" taketime.py CNF_SOURCE BINARY1 [BINARY2 [BINARY3 ... ]]") cnffile_source, binaries = extract_from_args() cnflist = get_filelist(cnffile_source) for f in binaries: print(f) compare_data = run_all_on_list(TIMEOUT, cnflist, binaries) store_results("results.html", binaries[0], compare_data) store_results_as_html("test.html", binaries, compare_data)
for p in list: stringtime1 = '--' if p[1] >= TIMEOUT else repr(round(p[1], 3)) stringtime2 = '--' if p[2] >= TIMEOUT else repr(round(p[2], 3)) f.write("<tr>") onesmaller = p[1] < p[2] f.write("<td>" + p[0] + "</td><td>" + bold(stringtime1, onesmaller) + "</td><td>" + bold(stringtime2, not onesmaller) + "</td>") f.write("</tr>") f.write("</tbody>") f.write("</table>") f.write("</body>\n</html>") if len(sys.argv) < 3: print("Usage:") print("\t /comparetimes.py LIST_FILE BINARY1 BINARY2") print("\t /comparetimes.py DIRECTORY BINARY1 BINARY2") exit(0) PATH_TO_SHARPSAT_BINARY1 = os.path.expandvars(os.path.expanduser(sys.argv[2])) PATH_TO_SHARPSAT_BINARY2 = os.path.expandvars(os.path.expanduser(sys.argv[3])) cnflist = read_filelist(os.path.expandvars(os.path.expanduser(sys.argv[1]))) compare_data = run_all_on_list( TIMEOUT, cnflist, [PATH_TO_SHARPSAT_BINARY1, PATH_TO_SHARPSAT_BINARY2]) store_results("compare_results.html", PATH_TO_SHARPSAT_BINARY1, PATH_TO_SHARPSAT_BINARY2, compare_data)
f) and f.split(".")[len(f.split(".")) - 1] == "cnf": list.append(dpath + "/" + f) else: print("A file with a list of cnf files found.") list = read_filelist(cnffile_source) print("DONE") return list def extract_from_args(): binaries = [] for i in range(2, len(sys.argv)): binaries.append(os.path.expandvars(os.path.expanduser(sys.argv[i]))) return os.path.expandvars(os.path.expanduser(sys.argv[1])), binaries if len(sys.argv) < 3: print("Usage: ") print(" taketime.py CNF_SOURCE BINARY1 [BINARY2 [BINARY3 ... ]]") cnffile_source, binaries = extract_from_args() cnflist = get_filelist(cnffile_source) for f in binaries: print(f) compare_data = run_all_on_list(TIMEOUT, cnflist, binaries) store_results("results.html", binaries[0], compare_data) store_results_as_html("test.html", binaries, compare_data)