Skip to content

Commit e77427c

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 e77427c

File tree

8 files changed

+1008
-0
lines changed

8 files changed

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

0 commit comments

Comments
 (0)