diff options
author | Chris Ball <chris@printf.net> | 2023-11-12 08:17:18 -0800 |
---|---|---|
committer | Chris Ball <chris@printf.net> | 2023-11-12 08:17:18 -0800 |
commit | df9f2c4205e98634e23b34eface59f32ba8b7cad (patch) | |
tree | ceab5f0a1e02fd4c1d5393a2760970970e872916 /benchmark/benchmark.py | |
parent | 8b79d9b4d5efdf4d0e30a323dd3a169f9a7801c5 (diff) | |
download | afl++-df9f2c4205e98634e23b34eface59f32ba8b7cad.tar.gz |
benchmark: lower minimum Python version to 3.8
Diffstat (limited to 'benchmark/benchmark.py')
-rw-r--r-- | benchmark/benchmark.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/benchmark/benchmark.py b/benchmark/benchmark.py index 2601ef0d..5b363e16 100644 --- a/benchmark/benchmark.py +++ b/benchmark/benchmark.py @@ -1,12 +1,12 @@ #!/usr/bin/env python3 -# Part of the aflplusplus project, requires Python 3.9+. +# Part of the aflplusplus project, requires Python 3.8+. # Author: Chris Ball <chris@printf.net>, ported from Marc "van Hauser" Heuse's "benchmark.sh". import argparse, asyncio, datetime, json, multiprocessing, os, platform, re, shutil, sys from dataclasses import asdict, dataclass from decimal import Decimal from enum import Enum, auto from pathlib import Path -from typing import Optional, Union +from typing import Dict, List, Optional, Tuple blue = lambda text: f"\033[1;94m{text}\033[0m"; gray = lambda text: f"\033[1;90m{text}\033[0m" green = lambda text: f"\033[0;32m{text}\033[0m"; red = lambda text: f"\033[0;31m{text}\033[0m" @@ -50,7 +50,7 @@ class Hardware: class Results: config: Optional[Config] hardware: Optional[Hardware] - targets: dict[str, dict[str, Optional[Run]]] + targets: Dict[str, Dict[str, Optional[Run]]] all_modes = [Mode.singlecore, Mode.multicore] all_targets = [ @@ -132,7 +132,7 @@ async def compile_target(source: Path, binary: Path) -> None: if returncode != 0: sys.exit(red(f" [*] Error: afl-cc is unable to compile: {stderr.decode()} {stdout.decode()}")) -async def run_command(cmd: list[str]) -> tuple[Union[int, None], bytes, bytes]: +async def run_command(cmd: List[str]) -> Tuple[Optional[int], bytes, bytes]: debug(f"Launching command: {cmd} with env {env_vars}") p = await asyncio.create_subprocess_exec( *cmd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE, env=env_vars @@ -168,7 +168,7 @@ async def check_deps() -> None: results.config = Config(afl_persistent_config=afl_pc, afl_system_config=afl_sc, afl_version="", comment=args.comment, compiler=compiler, target_arch=target_arch) -async def colon_values(filename: str, searchKey: str) -> list[str]: +async def colon_values(filename: str, searchKey: str) -> List[str]: """Return a colon-separated value given a key in a file, e.g. 'cpu MHz : 4976.109')""" with open(filename, "r") as fh: kv_pairs = (line.split(": ", 1) for line in fh if ": " in line) |