Skip to content

Commit 41c8b51

Browse files
Test: Gstreamer dual tests (#1244)
Fix GStreamer audio tests by providing the correct formats. Add the ability for tests to be run remotely, via fixing the local host to work only on components of the tests. Add the ability for gstreamer tests to be run with dual host mode. --------- Co-authored-by: Dawid Wesierski <dawid.wesierski@intel.com>
1 parent 031e92b commit 41c8b51

File tree

18 files changed

+623
-111
lines changed

18 files changed

+623
-111
lines changed

tests/validation/mtl_engine/GstreamerApp.py

Lines changed: 195 additions & 82 deletions
Large diffs are not rendered by default.

tests/validation/tests/dual/gstreamer/__init__.py

Whitespace-only changes.

tests/validation/tests/dual/gstreamer/anc_format/__init__.py

Whitespace-only changes.
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
# SPDX-License-Identifier: BSD-3-Clause
2+
# Copyright(c) 2024-2025 Intel Corporation
3+
4+
import os
5+
6+
import mtl_engine.media_creator as media_create
7+
import pytest
8+
from mtl_engine import GstreamerApp
9+
10+
11+
@pytest.mark.parametrize("fps", [24, 25, 30, 50, 60])
12+
@pytest.mark.parametrize("file_size_kb", [10, 100])
13+
@pytest.mark.parametrize("framebuff", [3])
14+
def test_st40p_fps_size_dual(
15+
hosts,
16+
build,
17+
media,
18+
nic_port_list,
19+
file_size_kb,
20+
fps,
21+
framebuff,
22+
test_time,
23+
test_config,
24+
prepare_ramdisk,
25+
):
26+
"""Test GStreamer ST40P ANC format in dual host configuration."""
27+
# Get TX and RX hosts
28+
host_list = list(hosts.values())
29+
if len(host_list) < 2:
30+
pytest.skip("Dual tests require at least 2 hosts")
31+
32+
tx_host = host_list[0]
33+
rx_host = host_list[1]
34+
35+
# Create input file on TX host
36+
input_file_path = media_create.create_text_file(
37+
size_kb=file_size_kb,
38+
output_path=os.path.join(media, "test_anc.txt"),
39+
host=tx_host,
40+
)
41+
42+
# Create output file path for RX host
43+
output_file_path = os.path.join(media, "output_anc_dual.txt")
44+
45+
# Setup TX pipeline using existing function
46+
tx_config = GstreamerApp.setup_gstreamer_st40p_tx_pipeline(
47+
build=build,
48+
nic_port_list=tx_host.vfs[0],
49+
input_path=input_file_path,
50+
tx_payload_type=113,
51+
tx_queues=4,
52+
tx_framebuff_cnt=framebuff,
53+
tx_fps=fps,
54+
tx_did=67,
55+
tx_sdid=2,
56+
)
57+
58+
# Setup RX pipeline using existing function
59+
rx_config = GstreamerApp.setup_gstreamer_st40p_rx_pipeline(
60+
build=build,
61+
nic_port_list=rx_host.vfs[0],
62+
output_path=output_file_path,
63+
rx_payload_type=113,
64+
rx_queues=4,
65+
timeout=15,
66+
)
67+
68+
capture_cfg = dict(test_config.get("capture_cfg", {})) if test_config else {}
69+
capture_cfg["test_name"] = (
70+
f"test_st40p_fps_size_dual_{fps}_{file_size_kb}kb_{framebuff}"
71+
)
72+
73+
try:
74+
result = GstreamerApp.execute_test(
75+
build=build,
76+
tx_command=tx_config,
77+
rx_command=rx_config,
78+
input_file=input_file_path,
79+
output_file=output_file_path,
80+
test_time=test_time,
81+
tx_host=tx_host,
82+
rx_host=rx_host,
83+
sleep_interval=3,
84+
tx_first=False,
85+
capture_cfg=capture_cfg,
86+
)
87+
88+
assert (
89+
result
90+
), f"GStreamer dual ST40P test failed for fps={fps}, size={file_size_kb}KB"
91+
92+
finally:
93+
# Remove the input file on TX host and output file on RX host
94+
media_create.remove_file(input_file_path, host=tx_host)
95+
media_create.remove_file(output_file_path, host=rx_host)

tests/validation/tests/dual/gstreamer/audio_format/__init__.py

Whitespace-only changes.
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
# SPDX-License-Identifier: BSD-3-Clause
2+
# Copyright(c) 2024-2025 Intel Corporation
3+
4+
import os
5+
6+
import mtl_engine.media_creator as media_create
7+
import pytest
8+
from mtl_engine import GstreamerApp
9+
10+
11+
@pytest.mark.parametrize("audio_format", ["S8", "S16BE", "S24BE"])
12+
@pytest.mark.parametrize("audio_channel", [1, 2])
13+
@pytest.mark.parametrize("audio_rate", [44100, 48000, 96000])
14+
def test_audio_format_dual(
15+
hosts,
16+
build,
17+
media,
18+
nic_port_list,
19+
audio_format,
20+
audio_channel,
21+
audio_rate,
22+
test_time,
23+
test_config,
24+
prepare_ramdisk,
25+
):
26+
"""Test GStreamer ST30 audio format in dual host configuration."""
27+
# Get TX and RX hosts
28+
host_list = list(hosts.values())
29+
if len(host_list) < 2:
30+
pytest.skip("Dual tests require at least 2 hosts")
31+
32+
tx_host = host_list[0]
33+
rx_host = host_list[1]
34+
35+
# Create input file on TX host
36+
input_file_path = os.path.join(media, "test_audio.pcm")
37+
38+
# media_create.create_audio_file_sox(
39+
# sample_rate=audio_rate,
40+
# channels=audio_channel,
41+
# bit_depth=GstreamerApp.audio_format_change(audio_format),
42+
# duration=10,
43+
# frequency=440,
44+
# output_path=input_file_path,
45+
# host=tx_host,
46+
# )
47+
48+
# Create output file path for RX host
49+
output_file_path = os.path.join(
50+
media, f"output_audio_dual_{audio_format}_{audio_channel}_{audio_rate}.pcm"
51+
)
52+
53+
# Setup TX pipeline using existing function
54+
tx_config = GstreamerApp.setup_gstreamer_st30_tx_pipeline(
55+
build=build,
56+
nic_port_list=tx_host.vfs[0],
57+
input_path=input_file_path,
58+
tx_payload_type=111,
59+
tx_queues=4,
60+
audio_format=audio_format,
61+
channels=audio_channel,
62+
sampling=audio_rate,
63+
)
64+
65+
# Setup RX pipeline using existing function
66+
rx_config = GstreamerApp.setup_gstreamer_st30_rx_pipeline(
67+
build=build,
68+
nic_port_list=rx_host.vfs[0],
69+
output_path=output_file_path,
70+
rx_payload_type=111,
71+
rx_queues=4,
72+
rx_audio_format=GstreamerApp.audio_format_change(audio_format, rx_side=True),
73+
rx_channels=audio_channel,
74+
rx_sampling=audio_rate,
75+
)
76+
77+
capture_cfg = dict(test_config.get("capture_cfg", {})) if test_config else {}
78+
capture_cfg["test_name"] = (
79+
f"test_audio_format_dual_{audio_format}_{audio_channel}_{audio_rate}"
80+
)
81+
82+
try:
83+
result = GstreamerApp.execute_test(
84+
build=build,
85+
tx_command=tx_config,
86+
rx_command=rx_config,
87+
input_file=input_file_path,
88+
output_file=output_file_path,
89+
test_time=test_time,
90+
tx_host=tx_host,
91+
rx_host=rx_host,
92+
tx_first=False,
93+
sleep_interval=1,
94+
capture_cfg=capture_cfg,
95+
)
96+
97+
assert (
98+
result
99+
), f"GStreamer dual audio format test failed for format {audio_format}"
100+
101+
finally:
102+
# Remove the output file on RX host
103+
# media_create.remove_file(input_file_path, host=tx_host)
104+
media_create.remove_file(output_file_path, host=rx_host)

tests/validation/tests/dual/gstreamer/video_format/__init__.py

Whitespace-only changes.
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# SPDX-License-Identifier: BSD-3-Clause
2+
# Copyright(c) 2024-2025 Intel Corporation
3+
4+
import os
5+
6+
import mtl_engine.media_creator as media_create
7+
import pytest
8+
from mtl_engine import GstreamerApp
9+
from mtl_engine.media_files import gstreamer_formats
10+
11+
12+
@pytest.mark.parametrize("file", gstreamer_formats.keys())
13+
def test_video_format_dual(
14+
hosts,
15+
build,
16+
media,
17+
nic_port_list,
18+
file,
19+
test_time,
20+
test_config,
21+
prepare_ramdisk,
22+
):
23+
video_file = gstreamer_formats[file]
24+
25+
# Get TX and RX hosts
26+
host_list = list(hosts.values())
27+
if len(host_list) < 2:
28+
pytest.skip("Dual tests require at least 2 hosts")
29+
30+
tx_host = host_list[0]
31+
rx_host = host_list[1]
32+
33+
# Create input file on TX host
34+
input_file_path = media_create.create_video_file(
35+
width=video_file["width"],
36+
height=video_file["height"],
37+
framerate=video_file["fps"],
38+
format=GstreamerApp.video_format_change(video_file["format"]),
39+
duration=3,
40+
media_path=media,
41+
host=tx_host,
42+
)
43+
44+
# Create output file path for RX host
45+
output_file_path = os.path.join(media, f"output_video_dual_{file}.yuv")
46+
47+
# Setup TX pipeline using existing function
48+
tx_config = GstreamerApp.setup_gstreamer_st20p_tx_pipeline(
49+
build=build,
50+
nic_port_list=tx_host.vfs[0],
51+
input_path=input_file_path,
52+
width=video_file["width"],
53+
height=video_file["height"],
54+
framerate=video_file["fps"],
55+
format=GstreamerApp.video_format_change(video_file["format"]),
56+
tx_payload_type=112,
57+
tx_queues=4,
58+
)
59+
60+
# Setup RX pipeline using existing function
61+
rx_config = GstreamerApp.setup_gstreamer_st20p_rx_pipeline(
62+
build=build,
63+
nic_port_list=rx_host.vfs[0],
64+
output_path=output_file_path,
65+
width=video_file["width"],
66+
height=video_file["height"],
67+
framerate=video_file["fps"],
68+
format=GstreamerApp.video_format_change(video_file["format"]),
69+
rx_payload_type=112,
70+
rx_queues=4,
71+
)
72+
73+
capture_cfg = dict(test_config.get("capture_cfg", {})) if test_config else {}
74+
capture_cfg["test_name"] = f"test_video_format_dual_{file}"
75+
76+
try:
77+
# Use the unified execute_test function for dual host execution
78+
result = GstreamerApp.execute_test(
79+
build=build,
80+
tx_command=tx_config,
81+
rx_command=rx_config,
82+
input_file=input_file_path,
83+
output_file=output_file_path,
84+
test_time=test_time,
85+
tx_host=tx_host,
86+
rx_host=rx_host,
87+
tx_first=False,
88+
capture_cfg=capture_cfg,
89+
)
90+
91+
assert result, f"GStreamer dual video format test failed for format {file}"
92+
93+
finally:
94+
# Remove the input file on TX host and output file on RX host
95+
media_create.remove_file(input_file_path, host=tx_host)
96+
media_create.remove_file(output_file_path, host=rx_host)

tests/validation/tests/dual/gstreamer/video_resolution/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)