aboutsummaryrefslogtreecommitdiff
path: root/plot_versions.py
diff options
context:
space:
mode:
authorquapka2024-08-15 16:09:24 +0200
committerquapka2024-08-15 16:09:24 +0200
commit335782e090deb10f4227aaad256420af1d93c189 (patch)
treee28b975b67e70a4fc9700a7b95c7a54515a7e3e8 /plot_versions.py
parenteed91ffe37cd7b533b77832570f3249b1012677a (diff)
downloadECTester-335782e090deb10f4227aaad256420af1d93c189.tar.gz
ECTester-335782e090deb10f4227aaad256420af1d93c189.tar.zst
ECTester-335782e090deb10f4227aaad256420af1d93c189.zip
Diffstat (limited to 'plot_versions.py')
-rw-r--r--plot_versions.py95
1 files changed, 95 insertions, 0 deletions
diff --git a/plot_versions.py b/plot_versions.py
new file mode 100644
index 0000000..5d82ced
--- /dev/null
+++ b/plot_versions.py
@@ -0,0 +1,95 @@
+#!/usr/bin/env python3
+
+import argparse
+import json
+
+from collections import defaultdict
+from pathlib import Path
+
+import pandas as pd
+
+def get_all_versions(library):
+ with open(f"./nix/{library}_pkg_versions.json", "r") as handle:
+ versions = json.load(handle)
+ return versions
+
+def build_results_to_latex(library):
+ versions = get_all_versions(library)
+ lib_results = get_results(library, "lib")
+ shim_results = get_results(library, "shim")
+
+ pruned_versions = []
+ pruned_libs = []
+ pruned_shims = []
+ prev = [None, None]
+ for ver in versions.keys():
+ row = [lib_results[ver]["success"], shim_results[ver]["success"]]
+ if row == prev:
+ continue
+ pruned_versions.append(ver)
+ pruned_libs.append(r"{\color{blue}\cmark}" if lib_results[ver]["success"] else r"{\color{red}\xmark}")
+ pruned_shims.append(r"{\color{blue}\cmark}" if shim_results[ver]["success"] else r"{\color{red}\xmark}")
+ prev = row
+
+
+ # lib_rows = [r"{\color{blue}\cmark}" if lib_results[ver]["success"] else r"{\color{red}\xmark}" for ver in versions.keys()]
+
+ # shim_rows = [r"{\color{blue}\cmark}" if shim_results[ver]["success"] else r"{\color{red}\xmark}" for ver in versions.keys()]
+ # shim_rows = [shim_results[ver] for ver in versions.keys()]
+
+ df = pd.DataFrame(dict(Versions=pruned_versions, Library=pruned_libs, Shim=pruned_shims))
+ # FIXME there should be a translation from `openssl` -> `OpenSSL` etc.
+ tabledir = Path(f"./build_all/tables")
+ tabledir.mkdir(parents=True, exist_ok=True)
+ with open(tabledir / f"{library}.tex", "w") as handle:
+ handle.write(df.to_latex(index=False, caption=library, label=f"{library}-lib-and-shim-builds"))
+
+def get_results(library, variant):
+ with open(f"./build_all/{variant}/{library}.json", "r") as handle:
+ return json.load(handle)
+
+def main():
+ parser = argparse.ArgumentParser()
+ parser.add_argument("-l", "--library")
+ # parser.add_argument("-v", "--variant", default="shim", type=valid_build_type)
+ args = parser.parse_args()
+ library = args.library
+ # variant = args.variant
+
+ libraries = [
+ "botan",
+ "cryptopp",
+ "openssl",
+ "boringssl",
+ "gcrypt",
+ "mbedtls",
+ "ippcp",
+ "nettle",
+ "libressl",
+ ]
+
+ match library:
+ case None:
+ # print("Building all libraries")
+ # # Build all libraries by default
+ for lib in libraries:
+ build_results_to_latex(lib)
+ # print(f"Library: {lib}")
+ # for version in get_all_versions(lib):
+ # result = attempt_build(lib, version, variant)
+ # save_build_result(lib, variant, version, result)
+ # print(f"{version}: {result['success']}")
+ case lib if lib in libraries:
+ build_results_to_latex(lib)
+ # print(f"Library: {library}")
+ # for version in get_all_versions(library):
+ # result = attempt_build(lib, version, variant)
+ # save_build_result(lib, variant, version, result)
+ # print(f"{version}: {result['success']}")
+ case _:
+ pass
+ print(f"Unrecognized library '{library}'. Try one of: {', '.join(libraries)}.")
+
+
+if __name__ == '__main__':
+ main()