brintos

brintos / llvm-project-archived public Read only

0
0
Text · 724 B · e5f52d3 Raw
35 lines · python
1import json2import multiprocessing3import os4import re5import subprocess6import sys7 8 9def run_analyzer(data):10    os.chdir(data["directory"])11    command = (12        data["command"]13        + f" --analyze --analyzer-output html -o analyzer-results -Xclang -analyzer-config -Xclang max-nodes=75000"14    )15    print(command)16    subprocess.run(command, shell=True, check=True)17 18 19def pool_error(e):20    print("Error analyzing file:", e)21 22 23def main():24    db_path = sys.argv[1]25    database = json.load(open(db_path))26 27    with multiprocessing.Pool() as pool:28        pool.map_async(run_analyzer, [k for k in database], error_callback=pool_error)29        pool.close()30        pool.join()31 32 33if __name__ == "__main__":34    main()35