aboutsummaryrefslogtreecommitdiff
path: root/test_building_all_shims.py
blob: 259a6a1165a5420408a65dc9b42a87725df8974b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/usr/bin/env python

import argparse
import json
import time

import subprocess as sp

def get_all_versions(library):
    with open(f"./nix/{library}_pkg_versions.json", "r") as handle:
        versions = json.load(handle)

    return versions

def can_build(library, version):
    cmd = ["nix", "build", f".#shim.{library}.{version}"]
    start = time.time()
    try:
        sp.check_output(cmd, stderr=sp.STDOUT)
    except sp.CalledProcessError as e:
        print(e.output.decode())
        return False, time.time() - start
    return True, time.time() - start

def main():
    parser = argparse.ArgumentParser()
    parser.add_argument("-l", "--library")
    args = parser.parse_args()
    library = args.library

    libraries = [
         "botan", 
         "cryptopp", 
         "openssl", 
         "boringssl", 
         "gcrypt", 
         "mbedtls", 
         "ippcp", 
         "nettle", 
         "libressl", 
    ]

    match library:
        case None:
            for lib in libraries:
                print(f"Library: {lib}")
                for version in get_all_versions(lib):
                    print(f"{version}: {can_build(lib, version)}")
        case _:
            print(f"Library: {library}")
            for version in get_all_versions(library):
                print(f"{version}: {can_build(library, version)}")


if __name__ == '__main__':
    main()