Skip to content

Commit 73b77f9

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 73b77f9

File tree

8 files changed

+1015
-0
lines changed

8 files changed

+1015
-0
lines changed
Lines changed: 268 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,268 @@
1+
# SPDX-License-Identifier: BSD-3-Clause
2+
# Copyright(c) 2024-2025 Intel Corporation
3+
4+
import os
5+
6+
import pytest
7+
8+
from mtl_engine.media_files import yuv_files_422p10le, yuv_files_422rfc10
9+
from mtl_engine.rxtxapp import RxTxApp
10+
11+
12+
@pytest.mark.smoke
13+
@pytest.mark.nightly
14+
@pytest.mark.parametrize(
15+
"media_file",
16+
list(yuv_files_422p10le.values()),
17+
indirect=["media_file"],
18+
ids=list(yuv_files_422p10le.keys()),
19+
)
20+
def test_422p10le_refactored(
21+
hosts,
22+
build,
23+
media,
24+
nic_port_list,
25+
test_time,
26+
test_config,
27+
prepare_ramdisk,
28+
media_file,
29+
):
30+
"""
31+
Send files in YUV422PLANAR10LE format converting to transport format YUV_422_10bit
32+
Using Application class refactored interface
33+
"""
34+
media_file_info, media_file_path = media_file
35+
host = list(hosts.values())[0]
36+
37+
# Get capture configuration from test_config.yaml
38+
capture_cfg = dict(test_config.get("capture_cfg", {}))
39+
capture_cfg["test_name"] = f"test_format_refactored_{media_file_info['filename']}"
40+
41+
# Create RxTxApp instance directly
42+
app = RxTxApp(f"{build}/tests/tools/RxTxApp/build")
43+
44+
# Configure application using universal parameters
45+
# Note: Passing test_time here ensures it's added to RxTxApp command line
46+
app.create_command(
47+
session_type="st20p",
48+
nic_port_list=host.vfs,
49+
test_mode="multicast",
50+
width=media_file_info["width"],
51+
height=media_file_info["height"],
52+
framerate=f"p{media_file_info['fps']}",
53+
pixel_format=media_file_info["file_format"],
54+
transport_format=media_file_info["format"],
55+
input_file=media_file_path,
56+
test_time=test_time,
57+
)
58+
59+
# Execute test using Application class
60+
app.execute_test(
61+
build=build,
62+
test_time=test_time,
63+
host=host,
64+
capture_cfg=capture_cfg,
65+
)
66+
67+
68+
# List of supported formats based on st_frame_fmt_from_transport()
69+
pixel_formats = dict(
70+
YUV_422_10bit=("ST20_FMT_YUV_422_10BIT", "YUV422RFC4175PG2BE10"),
71+
YUV_422_8bit=("ST20_FMT_YUV_422_8BIT", "UYVY"),
72+
YUV_422_12bit=("ST20_FMT_YUV_422_12BIT", "YUV422RFC4175PG2BE12"),
73+
YUV_444_10bit=("ST20_FMT_YUV_444_10BIT", "YUV444RFC4175PG4BE10"),
74+
YUV_444_12bit=("ST20_FMT_YUV_444_12BIT", "YUV444RFC4175PG2BE12"),
75+
YUV_420_8bit=("ST20_FMT_YUV_420_8BIT", "YUV420CUSTOM8"),
76+
RGB_8bit=("ST20_FMT_RGB_8BIT", "RGB8"),
77+
RGB_10bit=("ST20_FMT_RGB_10BIT", "RGBRFC4175PG4BE10"),
78+
RGB_12bit=("ST20_FMT_RGB_12BIT", "RGBRFC4175PG2BE12"),
79+
YUV_422_PLANAR10LE=("ST20_FMT_YUV_422_PLANAR10LE", "YUV422PLANAR10LE"),
80+
V210=("ST20_FMT_V210", "V210"),
81+
)
82+
83+
84+
# List of supported one-way convertions based on st_frame_get_converter()
85+
convert1_formats = dict(
86+
UYVY="UYVY",
87+
YUV422PLANAR8="YUV422PLANAR8",
88+
YUV420PLANAR8="YUV420PLANAR8",
89+
)
90+
91+
92+
@pytest.mark.nightly
93+
@pytest.mark.parametrize(
94+
"media_file",
95+
[yuv_files_422rfc10["Penguin_1080p"]],
96+
indirect=["media_file"],
97+
ids=["Penguin_1080p"],
98+
)
99+
@pytest.mark.parametrize("format", convert1_formats.keys())
100+
def test_convert_on_rx_refactored(
101+
hosts, build, media, nic_port_list, test_time, format, media_file
102+
):
103+
"""
104+
Send file in YUV_422_10bit pixel formats with supported convertion on RX side
105+
Using Application class refactored interface
106+
"""
107+
media_file_info, media_file_path = media_file
108+
output_format = convert1_formats[format]
109+
host = list(hosts.values())[0]
110+
111+
# Create RxTxApp instance directly
112+
app = RxTxApp(f"{build}/tests/tools/RxTxApp/build")
113+
114+
# Configure application using universal parameters
115+
app.create_command(
116+
session_type="st20p",
117+
nic_port_list=host.vfs,
118+
test_mode="multicast",
119+
packing="GPM",
120+
width=media_file_info["width"],
121+
height=media_file_info["height"],
122+
framerate="p30", # TODO: Hardcoded
123+
pixel_format="YUV422RFC4175PG2BE10",
124+
transport_format="YUV_422_10bit",
125+
input_file=media_file_path,
126+
test_time=test_time,
127+
)
128+
129+
# Execute test using Application class
130+
app.execute_test(
131+
build=build,
132+
test_time=test_time,
133+
host=host,
134+
)
135+
136+
137+
# List of supported two-way convertions based on st_frame_get_converter()
138+
convert2_formats = dict(
139+
V210=("ST20_FMT_YUV_422_10BIT", "YUV_422_10bit", "YUV422RFC4175PG2BE10"),
140+
Y210=("ST20_FMT_YUV_422_10BIT", "YUV_422_10bit", "YUV422RFC4175PG2BE10"),
141+
YUV422PLANAR12LE=(
142+
"ST20_FMT_YUV_422_12BIT",
143+
"YUV_422_12bit",
144+
"YUV422RFC4175PG2BE12",
145+
),
146+
YUV444PLANAR10LE=(
147+
"ST20_FMT_YUV_444_10BIT",
148+
"YUV_444_10bit",
149+
"YUV444RFC4175PG4BE10",
150+
),
151+
YUV444PLANAR12LE=(
152+
"ST20_FMT_YUV_444_12BIT",
153+
"YUV_444_12bit",
154+
"YUV444RFC4175PG2BE12",
155+
),
156+
GBRPLANAR10LE=("ST20_FMT_RGB_10BIT", "RGB_10bit", "RGBRFC4175PG4BE10"),
157+
GBRPLANAR12LE=("ST20_FMT_RGB_12BIT", "RGB_12bit", "RGBRFC4175PG2BE12"),
158+
)
159+
160+
161+
@pytest.mark.parametrize(
162+
"media_file",
163+
[yuv_files_422rfc10["test_8K"]],
164+
indirect=["media_file"],
165+
ids=["test_8K"],
166+
)
167+
@pytest.mark.parametrize("format", convert2_formats.keys())
168+
def test_tx_rx_conversion_refactored(
169+
hosts,
170+
build,
171+
media,
172+
nic_port_list,
173+
test_time,
174+
format,
175+
media_file,
176+
):
177+
"""
178+
Send random file in different pixel formats with supported two-way convertion on TX and RX
179+
Using Application class refactored interface
180+
"""
181+
media_file_info, media_file_path = media_file
182+
text_format, transport_format, _ = convert2_formats[format]
183+
host = list(hosts.values())[0]
184+
185+
# Create RxTxApp instance directly
186+
app = RxTxApp(f"{build}/tests/tools/RxTxApp/build")
187+
188+
# Configure application using universal parameters
189+
app.create_command(
190+
session_type="st20p",
191+
nic_port_list=host.vfs,
192+
test_mode="multicast",
193+
packing="GPM",
194+
width=media_file_info["width"],
195+
height=media_file_info["height"],
196+
framerate="p30", # TODO: Hardcoded
197+
pixel_format=format,
198+
transport_format=transport_format,
199+
input_file=media_file_path,
200+
test_time=test_time,
201+
)
202+
203+
# Execute test using Application class
204+
app.execute_test(
205+
build=build,
206+
test_time=test_time,
207+
host=host,
208+
)
209+
210+
211+
@pytest.mark.parametrize(
212+
"media_file",
213+
[yuv_files_422rfc10["test_8K"]],
214+
indirect=["media_file"],
215+
ids=["test_8K"],
216+
)
217+
@pytest.mark.parametrize("format", pixel_formats.keys())
218+
def test_formats_refactored(
219+
hosts,
220+
build,
221+
media,
222+
nic_port_list,
223+
test_time,
224+
format,
225+
test_config,
226+
prepare_ramdisk,
227+
media_file,
228+
):
229+
"""
230+
Send random file in different supported pixel formats without convertion during transport
231+
Using Application class refactored interface
232+
"""
233+
media_file_info, media_file_path = media_file
234+
text_format, file_format = pixel_formats[format]
235+
host = list(hosts.values())[0]
236+
237+
# Get capture configuration from test_config.yaml
238+
# This controls whether tcpdump capture is enabled, where to store the pcap, etc.
239+
capture_cfg = dict(test_config.get("capture_cfg", {}))
240+
capture_cfg["test_name"] = (
241+
f"test_format_refactored_formats_{format}" # Set a unique pcap file name
242+
)
243+
244+
# Create RxTxApp instance directly
245+
app = RxTxApp(f"{build}/tests/tools/RxTxApp/build")
246+
247+
# Configure application using universal parameters
248+
app.create_command(
249+
session_type="st20p",
250+
nic_port_list=host.vfs,
251+
test_mode="multicast",
252+
packing="GPM",
253+
width=media_file_info["width"],
254+
height=media_file_info["height"],
255+
framerate="p30", # TODO: Hardcoded
256+
pixel_format=file_format,
257+
transport_format=format,
258+
input_file=media_file_path,
259+
test_time=test_time,
260+
)
261+
262+
# Execute test using Application class
263+
app.execute_test(
264+
build=build,
265+
test_time=test_time,
266+
host=host,
267+
capture_cfg=capture_cfg,
268+
)
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
# SPDX-License-Identifier: BSD-3-Clause
2+
# Copyright(c) 2024-2025 Intel Corporation
3+
4+
import pytest
5+
6+
from mtl_engine.app import FFmpeg, GStreamer, RxTxApp
7+
from mtl_engine.media_files import yuv_files_422rfc10
8+
9+
10+
@pytest.mark.nightly
11+
@pytest.mark.parametrize(
12+
"media_file",
13+
[yuv_files_422rfc10["ParkJoy_1080p"]],
14+
indirect=["media_file"],
15+
ids=["ParkJoy_1080p"],
16+
)
17+
@pytest.mark.parametrize(
18+
"fps",
19+
[
20+
"p23",
21+
"p24",
22+
"p25",
23+
pytest.param("p29", marks=pytest.mark.smoke),
24+
"p30",
25+
"p50",
26+
"p59",
27+
"p60",
28+
"p100",
29+
"p119",
30+
"p120",
31+
],
32+
)
33+
def test_fps_refactored(
34+
hosts,
35+
build,
36+
media,
37+
nic_port_list,
38+
test_time,
39+
fps,
40+
prepare_ramdisk,
41+
media_file,
42+
):
43+
"""
44+
Test different frame rates using Application class refactored interface
45+
"""
46+
media_file_info, media_file_path = media_file
47+
host = list(hosts.values())[0]
48+
49+
# Create simple capture configuration
50+
capture_cfg = {
51+
"enable": False,
52+
"test_name": f"test_fps_refactored_{media_file_info['filename']}_{fps}",
53+
"pcap_dir": "/tmp/pcap",
54+
"capture_time": 5,
55+
"interface": None,
56+
}
57+
58+
# Create RxTxApp instance directly
59+
app = RxTxApp(f"{build}/tests/tools/RxTxApp/build")
60+
61+
# Configure application using universal parameters
62+
# Match the original test configuration exactly - use multicast mode for proper TX/RX setup
63+
config_params = {
64+
"session_type": "st20p",
65+
"nic_port_list": host.vfs,
66+
"test_mode": "multicast", # Use multicast like the working original test
67+
"destination_ip": "239.168.48.9", # Multicast destination IP
68+
"port": 20000,
69+
"width": media_file_info["width"],
70+
"height": media_file_info["height"],
71+
"framerate": fps,
72+
"pixel_format": media_file_info["file_format"],
73+
"transport_format": media_file_info["format"],
74+
"input_file": media_file_path,
75+
"test_time": test_time,
76+
}
77+
78+
# Add performance optimizations for frame rates that need more stability
79+
if fps in ["p30", "p50", "p59", "p60"]:
80+
config_params.update(
81+
{
82+
"pacing": "gap", # Use gap pacing for better stability
83+
"tx_no_chain": True, # Optimize for performance
84+
}
85+
)
86+
elif fps in ["p100", "p119", "p120"]:
87+
config_params.update(
88+
{
89+
"pacing": "linear", # Better pacing for high frame rates
90+
"tx_no_chain": True, # Optimize for performance
91+
}
92+
)
93+
94+
app.create_command(**config_params)
95+
96+
# Execute test using Application class
97+
# Use longer test time for accurate FPS measurement and stability
98+
actual_test_time = test_time
99+
if fps in ["p30", "p50", "p59", "p60"]:
100+
actual_test_time = max(test_time, 15) # Minimum 15 seconds for stability
101+
elif fps in ["p100", "p119", "p120"]:
102+
actual_test_time = max(
103+
test_time, 10
104+
) # Minimum 10 seconds for high FPS accuracy
105+
106+
app.execute_test(
107+
build=build,
108+
test_time=actual_test_time,
109+
host=host,
110+
capture_cfg=capture_cfg,
111+
)

0 commit comments

Comments
 (0)