INNER CODE UNIT · Python
BenchmarkTest
openHiTLS/openHiTLS · testcode/benchmark/async_perf/test_async_perf.py:20
class BenchmarkTest(unittest.TestCase):
def run_benchmark(self, *args):
tmp = tempfile.TemporaryDirectory(prefix="async-perf-test-")
self.addCleanup(tmp.cleanup)
proc = subprocess.run(
[str(BINARY), "--out", tmp.name, "--cert-dir",
str(ROOT / "testcode/testdata/tls/certificate/der"), *args],
text=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, timeout=60,
)
files = list(Path(tmp.name).glob("*/results.csv"))
rows = []
if files:
with files[0].open() as stream:
rows = list(csv.DictReader(stream))
return proc, rows, files[0].parent if files else None
def test_sync_profiles(self):
for mode in ("inline", "worker"):