CIRCT 23.0.0git
Loading...
Searching...
No Matches
test_serialization_probes.py
Go to the documentation of this file.
1# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
2# See https://llvm.org/LICENSE.txt for license information.
3# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4"""Pytest harness for the SerializationProbes integration test.
5
6This builds the C++ driver under ``sw/serialization_probes.cpp`` against
7generated ESI facade headers and runs it against a cosim-driven instance of
8``hw/serialization_probes.py``. Each probe asserts an exact, position-revealing
9result so any drift in the host serializer or deserializer (vs hardware)
10fails loudly.
11"""
12
13from __future__ import annotations
14
15from pathlib import Path
16
17from esiaccel.cosim.pytest import cosim_test
18
19from .conftest import HW_DIR, build_cpp_test, run_probe
20
21PROBES = [
22 "byte_rotate1",
23 "byte_pattern_const",
24 "byte_pattern_echo_eq",
25 "sign_probe",
26 "sign_probe13",
27 "pack_probe",
28 "bit_pack_probe",
29 "array_probe",
30]
31
32
33@cosim_test(HW_DIR / "serialization_probes.py")
35 """End-to-end serialization-correctness probes."""
36
37 def test_serialization_probes_cpp(self, host: str, port: int,
38 sources_dir: Path) -> None:
39 binary = build_cpp_test(sources_dir, "serialization_probes_test",
40 "serialization_probes")
41 for probe in PROBES:
42 run_probe(binary, host, port, probe)
None test_serialization_probes_cpp(self, str host, int port, Path sources_dir)