5from __future__
import annotations
7from esiaccel.cosim.pytest
import cosim_test
9from .conftest
import HW_DIR, check_lines, require_tool, run_cmd
12@cosim_test(HW_DIR / "esitester.py", args=("{tmp_dir}", "cosim"))
16 require_tool(
"esitester")
17 require_tool(
"esiquery")
20 conn = f
"{host}:{port}"
21 stdout = run_cmd([
"esitester",
"-v",
"cosim", conn,
"callback",
"-i",
"5"])
23 "[CONNECT] connecting to backend",
27 assert f
"callback: {i}" in stdout, \
28 f
"Expected 'callback: {i}' in stdout"
31 conn = f
"{host}:{port}"
32 stdout = run_cmd([
"esitester",
"cosim", conn,
"streaming_add"])
34 "Streaming add test results:",
35 "input[0]=222709 + 5 = 222714 (expected 222714)",
36 "input[1]=894611 + 5 = 894616 (expected 894616)",
37 "input[2]=772894 + 5 = 772899 (expected 772899)",
38 "input[3]=429150 + 5 = 429155 (expected 429155)",
39 "input[4]=629806 + 5 = 629811 (expected 629811)",
40 "Streaming add test passed",
44 conn = f
"{host}:{port}"
45 stdout = run_cmd([
"esitester",
"cosim", conn,
"streaming_add",
"-t"])
47 "Streaming add test results:",
48 "Streaming add test passed",
52 conn = f
"{host}:{port}"
53 stdout = run_cmd([
"esitester",
"cosim", conn,
"translate_coords"])
55 "Coord translate test results:",
56 "coord[0]=(222709,894611) + (10,20) = (222719,894631)",
57 "coord[1]=(772894,429150) + (10,20) = (772904,429170)",
58 "coord[2]=(629806,138727) + (10,20) = (629816,138747)",
59 "coord[3]=(218516,390276) + (10,20) = (218526,390296)",
60 "coord[4]=(750021,423525) + (10,20) = (750031,423545)",
61 "Coord translate test passed",
65 conn = f
"{host}:{port}"
67 [
"esitester",
"cosim", conn,
"serial_coords",
"-n",
"40",
"-b",
"33"])
69 "Serial coord translate test results:",
71 "Serial coord translate test passed",
75 conn = f
"{host}:{port}"
76 stdout = run_cmd([
"esiquery",
"cosim", conn,
"telemetry"])
79 "fromhostdma[32].fromHostCycles: 0",
80 "readmem[32].addrCmdCycles: 0",
81 "readmem[32].addrCmdIssued: 0",
82 "readmem[32].addrCmdResponses: 0",
83 "readmem[32].lastReadLSB: 0",
84 "tohostdma[32].toHostCycles: 0",
85 "tohostdma[32].totalWrites: 0",
86 "writemem[32].addrCmdCycles: 0",
87 "writemem[32].addrCmdIssued: 0",
88 "writemem[32].addrCmdResponses: 0",
92@cosim_test(HW_DIR / "esitester.py", args=("{tmp_dir}", "cosim_dma"))
96 require_tool(
"esitester")
97 require_tool(
"esiquery")
100 conn = f
"{host}:{port}"
101 run_cmd([
"esitester",
"cosim", conn,
"hostmem"])
104 conn = f
"{host}:{port}"
105 run_cmd([
"esitester",
"cosim", conn,
"dma",
"-w",
"-r"])
108 conn = f
"{host}:{port}"
109 stdout = run_cmd([
"esiquery",
"cosim", conn,
"telemetry"])
110 check_lines(stdout, [
112 "fromhostdma[32].fromHostCycles: 0",
113 "tohostdma[32].toHostCycles: 0",
None test_hostmem(self, str host, int port)
None test_telemetry(self, str host, int port)
None test_dma(self, str host, int port)
None test_callback(self, str host, int port)
None test_streaming_add_quiet(self, str host, int port)
None test_telemetry(self, str host, int port)
None test_translate_coords(self, str host, int port)
None test_streaming_add(self, str host, int port)
None test_serial_coords(self, str host, int port)