File: build_fuzzers.py

package info (click to toggle)
markdown-it-py 3.0.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,780 kB
  • sloc: python: 5,214; xml: 39; sh: 29; makefile: 24
file content (42 lines) | stat: -rw-r--r-- 1,161 bytes parent folder | download
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
"""Build fuzzers idempotently in a given folder."""
import argparse
from pathlib import Path
import subprocess


def main():
    """Build fuzzers idempotently in a given folder."""
    parser = argparse.ArgumentParser()
    parser.add_argument("folder")
    args = parser.parse_args()
    folder = Path(args.folder)
    if not folder.exists():
        print(f"Cloning google/oss-fuzz into: {folder}")
        folder.mkdir(parents=True)
        subprocess.check_call(
            [
                "git",
                "clone",
                "--single-branch",
                "https://github.com/google/oss-fuzz",
                str(folder),
            ]
        )
    else:
        print(f"Using google/oss-fuzz in: {folder}")
    if not (folder / "build").exists():
        print(f"Building fuzzers in: {folder / 'build'}")
        subprocess.check_call(
            [
                "python",
                str(folder / "infra" / "helper.py"),
                "build_fuzzers",
                "markdown-it-py",
            ]
        )
    else:
        print(f"Using existing fuzzers in: {folder / 'build'}")


if __name__ == "__main__":
    main()