INNER CODE UNIT · Python

test_invalid_options

openHiTLS/openHiTLS · testcode/benchmark/async_perf/test_async_perf.py:100

    def test_invalid_options(self):
        for option, value in (("-c", "4294967297"), ("--repeat", "-1"), ("--preset", "unknown")):
            proc = subprocess.run([str(BINARY), "--list", option, value], text=True, capture_output=True, timeout=10)
            self.assertEqual(proc.returncode, 2, proc.stdout)

    def test_auto_affinity_option(self):
        proc = subprocess.run([str(BINARY), "--list", "--pin-cpu", "auto"],
                              text=True, capture_output=True, timeout=10)
        self.assertEqual(proc.returncode, 0, proc.stdout)

    @unittest.skipUnless(hasattr(os, "sched_getaffinity"), "Linux affinity required")
    def test_auto_affinity_insufficient_cores(self):
        cpu = min(os.sched_getaffinity(0))
        with tempfile.TemporaryDirectory(prefix="async-affinity-test-") as directory:
            proc = subprocess.run(
                [str(BINARY), "-a", "hs-sync-tls13-psk", "--device-mode", "worker",
                 "-w", "4", "--pin-cpu", "auto", "--repeat", "1", "--out", directory],
                preexec_fn=lambda: os.sched_setaffinity(0, {cpu}),

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…