Lines Matching +full:resolve +full:- +full:from
3 # Author: Chris Ball <chris@printf.net>, ported from Marc "van Hauser" Heuse's "benchmark.sh".
5 from dataclasses import asdict, dataclass
6 from decimal import Decimal
7 from enum import Enum, auto
8 from pathlib import Path
9 from typing import Dict, List, Optional, Tuple
53 …Target(source=Path("../utils/persistent_mode/test-instr.c").resolve(), binary=Path("test-instr-per…
54 Target(source=Path("../test-instr.c").resolve(), binary=Path("test-instr"))
61 …"AFL_NO_UI": "1", "AFL_TRY_AFFINITY": "1", "PATH": f'{str(Path("../").resolve())}:{os.environ["PAT…
65 parser.add_argument("-b", "--basedir", help="directory to use for temp files", type=str, default="/…
66 parser.add_argument("-d", "--debug", help="show verbose debugging output", action="store_true")
67 parser.add_argument("-r", "--runs", help="how many runs to average results over", type=int, default…
68 parser.add_argument("-f", "--fuzzers", help="how many afl-fuzz workers to use", type=int, default=c…
69 parser.add_argument("-m", "--mode", help="pick modes", action="append", default=modes, choices=mode…
70 parser.add_argument("-c", "--comment", help="add a comment about your setup", type=str, default="")
71 parser.add_argument("--cpu", help="override the detected CPU model name", type=str, default="")
72 parser.add_argument("--mhz", help="override the detected CPU MHz", type=str, default="")
74 …"-t", "--target", help="pick targets", action="append", default=["test-instr-persist-shmem"], choi…
91 async def clean_up_tempfiles() -> None:
96 shutil.rmtree(f"{args.basedir}/out-{mode.name}-{str(target.binary)}")
98 async def check_afl_persistent() -> bool:
102 async def check_afl_system() -> bool:
109 async def prep_env() -> None:
114 async def compile_target(source: Path, binary: Path) -> None:
117 …[str(Path("../afl-clang-lto").resolve()), "-o", str(Path(binary.resolve())), str(Path(source).reso…
121 print(yellow(f" [*] afl-clang-lto was unable to compile; falling back to afl-cc."))
123 … [str(Path("../afl-cc").resolve()), "-o", str(Path(binary.resolve())), str(Path(source).resolve())]
126 … sys.exit(red(f" [*] Error: afl-cc is unable to compile: {stderr.decode()} {stdout.decode()}"))
128 async def run_command(cmd: List[str]) -> Tuple[Optional[int], bytes, bytes]:
137 async def check_deps() -> None:
139 …if not os.access(Path("../afl-fuzz").resolve(), os.X_OK) and os.access(Path("../afl-cc").resolve()…
140 os.path.exists(Path("../SanitizerCoveragePCGUARD.so").resolve())):
141 …sys.exit(red(" [*] Compile AFL++: we need afl-fuzz, afl-clang-fast and SanitizerCoveragePCGUARD.so…
143 (returncode, stdout, stderr) = await run_command([str(Path("../afl-cc").resolve()), "-v"])
145 sys.exit(red(f" [*] Error: afl-cc -v returned: {stderr.decode()} {stdout.decode()}"))
154 …# Pick some sample settings from afl-{persistent,system}-config to try to see whether they were ru…
158 …print(yellow(f" [*] afl-persistent-config did not run; run it to improve performance (and decrease…
160 …print(yellow(f" [*] afl-system-config did not run; run it to improve performance (and decrease sec…
164 async def colon_values(filename: str, searchKey: str) -> List[str]:
165 """Return a colon-separated value given a key in a file, e.g. 'cpu MHz : 4976.109')"""
171 async def describe_afl_config() -> str:
183 async def save_benchmark_results() -> None:
185 with open("benchmark-results.jsonl", "a") as jsonfile:
199 if not "test-instr-persist-shmem" in results.targets or \
200 not "multicore" in results.targets["test-instr-persist-shmem"] or \
201 not "singlecore" in results.targets["test-instr-persist-shmem"] or \
202 results.targets["test-instr-persist-shmem"]["singlecore"] is None or \
203 results.targets["test-instr-persist-shmem"]["multicore"] is None:
205 …single = str(round(results.targets["test-instr-persist-shmem"]["singlecore"].execs_per_sec)).ljust…
206 …multi = str(round(results.targets["test-instr-persist-shmem"]["multicore"].execs_per_sec)).ljust(9)
214 async def main() -> None:
240 …print(blue("(use --fuzzers to override)." if args.fuzzers == cpu_count else f"(the default is {cpu…
245 outdir = f"{args.basedir}/out-{mode.name}-{binary}"
248 name = ["-o", outdir, "-M" if fuzzer_idx == 0 else "-S", str(afl)]
249 …cmds.append(["afl-fuzz", "-i", f"{args.basedir}/in"] + name + ["-s", "123", "-V10", "-D", f"./{bin…
250 # Prepare the afl-fuzz tasks, and then block while waiting for them to finish.
267 # (Using float() because Decimal() is not JSON-serializable.)
273 if (((max(execs_per_sec) - min(execs_per_sec)) / avg_afl_execs_per_sec) * 100) > 15: