Skip to content

Commit 9e42c6a

Browse files
committed
Add dual host GStreamer tests
1 parent 9bac7a5 commit 9e42c6a

File tree

10 files changed

+1021
-0
lines changed

10 files changed

+1021
-0
lines changed

tests/validation/mtl_engine/GstreamerApp.py

Lines changed: 721 additions & 0 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: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
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+
capture_cfg = dict(test_config.get("capture_cfg", {})) if test_config else {}
43+
capture_cfg["test_name"] = (
44+
f"test_st40p_fps_size_dual_{fps}_{file_size_kb}kb_{framebuff}"
45+
)
46+
47+
try:
48+
result = GstreamerApp.execute_dual_st40_test(
49+
build=build,
50+
tx_nic_port=tx_host.vfs[0],
51+
rx_nic_port=rx_host.vfs[0],
52+
input_path=input_file_path,
53+
payload_type=113,
54+
queues=4,
55+
tx_framebuff_cnt=framebuff,
56+
tx_fps=fps,
57+
tx_did=67,
58+
tx_sdid=2,
59+
timeout=40000,
60+
test_time=test_time,
61+
tx_host=tx_host,
62+
rx_host=rx_host,
63+
capture_cfg=capture_cfg,
64+
)
65+
66+
assert result, f"GStreamer dual ST40P test failed for fps={fps}, size={file_size_kb}KB"
67+
68+
finally:
69+
# Remove the input file on TX host
70+
media_create.remove_file(input_file_path, host=tx_host)

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

Whitespace-only changes.
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
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", "s16le", "s24le"])
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+
capture_cfg = dict(test_config.get("capture_cfg", {})) if test_config else {}
49+
capture_cfg["test_name"] = (
50+
f"test_audio_format_dual_{audio_format}_{audio_channel}_{audio_rate}"
51+
)
52+
53+
try:
54+
result = GstreamerApp.execute_dual_st30_test(
55+
build=build,
56+
tx_nic_port=tx_host.vfs[0],
57+
rx_nic_port=rx_host.vfs[0],
58+
input_path=input_file_path,
59+
payload_type=111,
60+
queues=4,
61+
audio_format=audio_format,
62+
channels=audio_channel,
63+
sampling=audio_rate,
64+
test_time=test_time,
65+
tx_host=tx_host,
66+
rx_host=rx_host,
67+
capture_cfg=capture_cfg,
68+
)
69+
70+
assert result, f"GStreamer dual audio format test failed for format {audio_format}"
71+
72+
finally:
73+
# Remove the input file on TX host
74+
media_create.remove_file(input_file_path, host=tx_host)

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

Whitespace-only changes.
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
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+
"""
24+
Test GStreamer ST20P video format in dual host configuration using single host setup functions.
25+
This test now reuses single host pipeline setup functions with dual host networking updates.
26+
"""
27+
video_file = gstreamer_formats[file]
28+
29+
# Get TX and RX hosts
30+
host_list = list(hosts.values())
31+
if len(host_list) < 2:
32+
pytest.skip("Dual tests require at least 2 hosts")
33+
34+
tx_host = host_list[0]
35+
rx_host = host_list[1]
36+
37+
# Create input file on TX host
38+
input_file_path = media_create.create_video_file(
39+
width=video_file["width"],
40+
height=video_file["height"],
41+
framerate=video_file["fps"],
42+
format=GstreamerApp.video_format_change(video_file["format"]),
43+
media_path=media,
44+
host=tx_host,
45+
)
46+
47+
capture_cfg = dict(test_config.get("capture_cfg", {})) if test_config else {}
48+
capture_cfg["test_name"] = f"test_video_format_dual_{file}"
49+
50+
try:
51+
result = GstreamerApp.execute_dual_st20p_test(
52+
build=build,
53+
tx_nic_port=tx_host.vfs[0],
54+
rx_nic_port=rx_host.vfs[0],
55+
input_path=input_file_path,
56+
width=video_file["width"],
57+
height=video_file["height"],
58+
framerate=video_file["fps"],
59+
format=GstreamerApp.video_format_change(video_file["format"]),
60+
payload_type=112,
61+
queues=4,
62+
test_time=test_time,
63+
tx_host=tx_host,
64+
rx_host=rx_host,
65+
capture_cfg=capture_cfg,
66+
)
67+
68+
assert result, f"GStreamer dual video format test failed for format {file}"
69+
70+
finally:
71+
# Remove the input file on TX host
72+
media_create.remove_file(input_file_path, host=tx_host)

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

Whitespace-only changes.
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
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 yuv_files
10+
from tests.xfail import SDBQ1971_conversion_v210_720p_error
11+
12+
13+
@pytest.mark.parametrize(
14+
"file",
15+
[
16+
pytest.param(f, marks=pytest.mark.smoke) if f == "i1080p59" else f
17+
for f in yuv_files.keys()
18+
],
19+
)
20+
def test_video_resolutions_dual(
21+
hosts,
22+
build,
23+
media,
24+
nic_port_list,
25+
file,
26+
request,
27+
test_time,
28+
test_config,
29+
prepare_ramdisk,
30+
):
31+
"""Test GStreamer ST20P video resolution in dual host configuration."""
32+
video_file = yuv_files[file]
33+
video_file["format"] = "v210"
34+
35+
# Get TX and RX hosts
36+
host_list = list(hosts.values())
37+
if len(host_list) < 2:
38+
pytest.skip("Dual tests require at least 2 hosts")
39+
40+
tx_host = host_list[0]
41+
rx_host = host_list[1]
42+
43+
SDBQ1971_conversion_v210_720p_error(
44+
video_format=video_file["format"],
45+
resolution_width=video_file["height"],
46+
request=request,
47+
)
48+
49+
# Create input file on TX host
50+
input_file_path = media_create.create_video_file(
51+
width=video_file["width"],
52+
height=video_file["height"],
53+
framerate=video_file["fps"],
54+
format=GstreamerApp.video_format_change(video_file["format"]),
55+
media_path=media,
56+
host=tx_host,
57+
)
58+
59+
capture_cfg = dict(test_config.get("capture_cfg", {})) if test_config else {}
60+
capture_cfg["test_name"] = f"test_video_resolutions_dual_{file}"
61+
62+
try:
63+
result = GstreamerApp.execute_dual_st20p_test(
64+
build=build,
65+
tx_nic_port=tx_host.vfs[0],
66+
rx_nic_port=rx_host.vfs[0],
67+
input_path=input_file_path,
68+
width=video_file["width"],
69+
height=video_file["height"],
70+
framerate=video_file["fps"],
71+
format=GstreamerApp.video_format_change(video_file["format"]),
72+
payload_type=112,
73+
queues=4,
74+
test_time=test_time,
75+
tx_host=tx_host,
76+
rx_host=rx_host,
77+
capture_cfg=capture_cfg,
78+
)
79+
80+
assert result, f"GStreamer dual video resolution test failed for resolution {file}"
81+
82+
finally:
83+
# Remove the input file on TX host
84+
media_create.remove_file(input_file_path, host=tx_host)

0 commit comments

Comments
 (0)