Skip to content

Commit 1db3b68

Browse files
committed
Added refactored tests for single host, st20p category. Based on new OOP approach.
Signed-off-by: Wilczynski, Andrzej <[email protected]>
1 parent 37d7576 commit 1db3b68

File tree

9 files changed

+727
-10
lines changed

9 files changed

+727
-10
lines changed

tests/validation/mtl_engine/application_base.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,7 @@
88

99
from .config.app_mappings import DEFAULT_PAYLOAD_TYPE_CONFIG, DEFAULT_PORT_CONFIG
1010
from .config.universal_params import UNIVERSAL_PARAMS
11-
12-
# Import execution utilities with fallback
13-
try:
14-
from .execute import run
15-
from .RxTxApp import prepare_tcpdump
16-
except ImportError:
17-
# Fallback for direct execution
18-
from execute import run
19-
from RxTxApp import prepare_tcpdump
11+
from .execute import run
2012

2113
logger = logging.getLogger(__name__)
2214

@@ -216,7 +208,9 @@ def execute_test(
216208
and "prepare_tcpdump" in globals()
217209
):
218210
try:
219-
prepare_tcpdump(capture_cfg, host)
211+
# prepare_tcpdump not yet implemented; left to change in the future
212+
# prepare_tcpdump(capture_cfg, host)
213+
pass
220214
except Exception as e:
221215
logger.warning(f"capture setup failed: {e}")
222216
proc = self.start_process(cmd, build, test_time, host)
Lines changed: 234 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,234 @@
1+
# SPDX-License-Identifier: BSD-3-Clause
2+
# Copyright(c) 2024-2025 Intel Corporation
3+
4+
import pytest
5+
from mtl_engine.media_files import yuv_files_422p10le, yuv_files_422rfc10
6+
from mtl_engine.rxtxapp import RxTxApp
7+
8+
9+
@pytest.mark.smoke
10+
@pytest.mark.nightly
11+
@pytest.mark.parametrize(
12+
"media_file",
13+
list(yuv_files_422p10le.values()),
14+
indirect=["media_file"],
15+
ids=list(yuv_files_422p10le.keys()),
16+
)
17+
def test_422p10le_refactored(
18+
hosts,
19+
build,
20+
media,
21+
nic_port_list,
22+
test_time,
23+
test_config,
24+
prepare_ramdisk,
25+
media_file,
26+
):
27+
"""Send files in YUV422PLANAR10LE format converting to transport format YUV_422_10bit"""
28+
media_file_info, media_file_path = media_file
29+
host = list(hosts.values())[0]
30+
31+
capture_cfg = dict(test_config.get("capture_cfg", {}))
32+
capture_cfg["test_name"] = f"test_format_refactored_{media_file_info['filename']}"
33+
34+
app = RxTxApp(f"{build}/tests/tools/RxTxApp/build")
35+
36+
app.create_command(
37+
session_type="st20p",
38+
nic_port_list=host.vfs,
39+
test_mode="multicast",
40+
width=media_file_info["width"],
41+
height=media_file_info["height"],
42+
framerate=f"p{media_file_info['fps']}",
43+
pixel_format=media_file_info["file_format"],
44+
transport_format=media_file_info["format"],
45+
input_file=media_file_path,
46+
test_time=test_time,
47+
)
48+
49+
app.execute_test(
50+
build=build,
51+
test_time=test_time,
52+
host=host,
53+
capture_cfg=capture_cfg,
54+
)
55+
56+
57+
# List of supported formats based on st_frame_fmt_from_transport()
58+
pixel_formats = dict(
59+
YUV_422_10bit=("ST20_FMT_YUV_422_10BIT", "YUV422RFC4175PG2BE10"),
60+
YUV_422_8bit=("ST20_FMT_YUV_422_8BIT", "UYVY"),
61+
YUV_422_12bit=("ST20_FMT_YUV_422_12BIT", "YUV422RFC4175PG2BE12"),
62+
YUV_444_10bit=("ST20_FMT_YUV_444_10BIT", "YUV444RFC4175PG4BE10"),
63+
YUV_444_12bit=("ST20_FMT_YUV_444_12BIT", "YUV444RFC4175PG2BE12"),
64+
YUV_420_8bit=("ST20_FMT_YUV_420_8BIT", "YUV420CUSTOM8"),
65+
RGB_8bit=("ST20_FMT_RGB_8BIT", "RGB8"),
66+
RGB_10bit=("ST20_FMT_RGB_10BIT", "RGBRFC4175PG4BE10"),
67+
RGB_12bit=("ST20_FMT_RGB_12BIT", "RGBRFC4175PG2BE12"),
68+
YUV_422_PLANAR10LE=("ST20_FMT_YUV_422_PLANAR10LE", "YUV422PLANAR10LE"),
69+
V210=("ST20_FMT_V210", "V210"),
70+
)
71+
72+
73+
# List of supported one-way convertions based on st_frame_get_converter()
74+
convert1_formats = dict(
75+
UYVY="UYVY",
76+
YUV422PLANAR8="YUV422PLANAR8",
77+
YUV420PLANAR8="YUV420PLANAR8",
78+
)
79+
80+
81+
@pytest.mark.nightly
82+
@pytest.mark.parametrize(
83+
"media_file",
84+
[yuv_files_422rfc10["Penguin_1080p"]],
85+
indirect=["media_file"],
86+
ids=["Penguin_1080p"],
87+
)
88+
@pytest.mark.parametrize("format", convert1_formats.keys())
89+
def test_convert_on_rx_refactored(
90+
hosts, build, media, nic_port_list, test_time, format, media_file
91+
):
92+
"""Send file in YUV_422_10bit pixel formats with supported conversion on RX side"""
93+
media_file_info, media_file_path = media_file
94+
host = list(hosts.values())[0]
95+
96+
app = RxTxApp(f"{build}/tests/tools/RxTxApp/build")
97+
98+
app.create_command(
99+
session_type="st20p",
100+
nic_port_list=host.vfs,
101+
test_mode="multicast",
102+
packing="GPM",
103+
width=media_file_info["width"],
104+
height=media_file_info["height"],
105+
framerate="p30",
106+
pixel_format="YUV422RFC4175PG2BE10",
107+
transport_format="YUV_422_10bit",
108+
input_file=media_file_path,
109+
test_time=test_time,
110+
)
111+
112+
app.execute_test(
113+
build=build,
114+
test_time=test_time,
115+
host=host,
116+
)
117+
118+
119+
# List of supported two-way convertions based on st_frame_get_converter()
120+
convert2_formats = dict(
121+
V210=("ST20_FMT_YUV_422_10BIT", "YUV_422_10bit", "YUV422RFC4175PG2BE10"),
122+
Y210=("ST20_FMT_YUV_422_10BIT", "YUV_422_10bit", "YUV422RFC4175PG2BE10"),
123+
YUV422PLANAR12LE=(
124+
"ST20_FMT_YUV_422_12BIT",
125+
"YUV_422_12bit",
126+
"YUV422RFC4175PG2BE12",
127+
),
128+
YUV444PLANAR10LE=(
129+
"ST20_FMT_YUV_444_10BIT",
130+
"YUV_444_10bit",
131+
"YUV444RFC4175PG4BE10",
132+
),
133+
YUV444PLANAR12LE=(
134+
"ST20_FMT_YUV_444_12BIT",
135+
"YUV_444_12bit",
136+
"YUV444RFC4175PG2BE12",
137+
),
138+
GBRPLANAR10LE=("ST20_FMT_RGB_10BIT", "RGB_10bit", "RGBRFC4175PG4BE10"),
139+
GBRPLANAR12LE=("ST20_FMT_RGB_12BIT", "RGB_12bit", "RGBRFC4175PG2BE12"),
140+
)
141+
142+
143+
@pytest.mark.parametrize(
144+
"media_file",
145+
[yuv_files_422rfc10["test_8K"]],
146+
indirect=["media_file"],
147+
ids=["test_8K"],
148+
)
149+
@pytest.mark.parametrize("format", convert2_formats.keys())
150+
def test_tx_rx_conversion_refactored(
151+
hosts,
152+
build,
153+
media,
154+
nic_port_list,
155+
test_time,
156+
format,
157+
media_file,
158+
):
159+
"""Send file in different pixel formats with supported two-way conversion on TX and RX"""
160+
media_file_info, media_file_path = media_file
161+
text_format, transport_format, _ = convert2_formats[format]
162+
host = list(hosts.values())[0]
163+
164+
app = RxTxApp(f"{build}/tests/tools/RxTxApp/build")
165+
166+
app.create_command(
167+
session_type="st20p",
168+
nic_port_list=host.vfs,
169+
test_mode="multicast",
170+
packing="GPM",
171+
width=media_file_info["width"],
172+
height=media_file_info["height"],
173+
framerate="p30",
174+
pixel_format=format,
175+
transport_format=transport_format,
176+
input_file=media_file_path,
177+
test_time=test_time,
178+
)
179+
180+
app.execute_test(
181+
build=build,
182+
test_time=test_time,
183+
host=host,
184+
)
185+
186+
187+
@pytest.mark.parametrize(
188+
"media_file",
189+
[yuv_files_422rfc10["test_8K"]],
190+
indirect=["media_file"],
191+
ids=["test_8K"],
192+
)
193+
@pytest.mark.parametrize("format", pixel_formats.keys())
194+
def test_formats_refactored(
195+
hosts,
196+
build,
197+
media,
198+
nic_port_list,
199+
test_time,
200+
format,
201+
test_config,
202+
prepare_ramdisk,
203+
media_file,
204+
):
205+
"""Send file in different supported pixel formats without conversion during transport"""
206+
media_file_info, media_file_path = media_file
207+
text_format, file_format = pixel_formats[format]
208+
host = list(hosts.values())[0]
209+
210+
capture_cfg = dict(test_config.get("capture_cfg", {}))
211+
capture_cfg["test_name"] = f"test_format_refactored_formats_{format}"
212+
213+
app = RxTxApp(f"{build}/tests/tools/RxTxApp/build")
214+
215+
app.create_command(
216+
session_type="st20p",
217+
nic_port_list=host.vfs,
218+
test_mode="multicast",
219+
packing="GPM",
220+
width=media_file_info["width"],
221+
height=media_file_info["height"],
222+
framerate="p30",
223+
pixel_format=file_format,
224+
transport_format=format,
225+
input_file=media_file_path,
226+
test_time=test_time,
227+
)
228+
229+
app.execute_test(
230+
build=build,
231+
test_time=test_time,
232+
host=host,
233+
capture_cfg=capture_cfg,
234+
)
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# SPDX-License-Identifier: BSD-3-Clause
2+
# Copyright(c) 2024-2025 Intel Corporation
3+
4+
import pytest
5+
from mtl_engine.media_files import yuv_files_422rfc10
6+
from mtl_engine.rxtxapp import RxTxApp
7+
8+
9+
@pytest.mark.nightly
10+
@pytest.mark.parametrize(
11+
"media_file",
12+
[yuv_files_422rfc10["ParkJoy_1080p"]],
13+
indirect=["media_file"],
14+
ids=["ParkJoy_1080p"],
15+
)
16+
@pytest.mark.parametrize(
17+
"fps",
18+
[
19+
"p23",
20+
"p24",
21+
"p25",
22+
pytest.param("p29", marks=pytest.mark.smoke),
23+
"p30",
24+
"p50",
25+
"p59",
26+
"p60",
27+
"p100",
28+
"p119",
29+
"p120",
30+
],
31+
)
32+
def test_fps_refactored(
33+
hosts,
34+
build,
35+
media,
36+
nic_port_list,
37+
test_time,
38+
fps,
39+
prepare_ramdisk,
40+
media_file,
41+
):
42+
"""Test different frame rates"""
43+
media_file_info, media_file_path = media_file
44+
host = list(hosts.values())[0]
45+
46+
app = RxTxApp(f"{build}/tests/tools/RxTxApp/build")
47+
48+
config_params = {
49+
"session_type": "st20p",
50+
"nic_port_list": host.vfs,
51+
"test_mode": "multicast",
52+
"destination_ip": "239.168.48.9",
53+
"port": 20000,
54+
"width": media_file_info["width"],
55+
"height": media_file_info["height"],
56+
"framerate": fps,
57+
"pixel_format": media_file_info["file_format"],
58+
"transport_format": media_file_info["format"],
59+
"input_file": media_file_path,
60+
"test_time": test_time,
61+
}
62+
63+
if fps in ["p30", "p50", "p59", "p60"]:
64+
config_params.update({"pacing": "gap", "tx_no_chain": True})
65+
elif fps in ["p100", "p119", "p120"]:
66+
config_params.update({"pacing": "linear", "tx_no_chain": True})
67+
68+
app.create_command(**config_params)
69+
70+
actual_test_time = test_time
71+
if fps in ["p30", "p50", "p59", "p60"]:
72+
actual_test_time = max(test_time, 15)
73+
elif fps in ["p100", "p119", "p120"]:
74+
actual_test_time = max(test_time, 10)
75+
76+
app.execute_test(build=build, test_time=actual_test_time, host=host)

0 commit comments

Comments
 (0)