Skip to content

Commit 307c69f

Browse files
authored
tests: adapt ST40 ancillary tests for netsniff-ng change (#1323)
Commit 3b1d805 (“Test: Implement packet capture fixture using netsniff-ng tool. (#1283)”) dropped the enable_sudo flag from execute.py, which caused the ST40 ancillary tests and media helper to fail when they still passed enable_sudo=True. This commit removes the stale flag usage and switches the temporary ANC input/output files to /tmp/ so the tests run without elevated privileges on shared CI hosts.
1 parent b4c1020 commit 307c69f

File tree

3 files changed

+33
-28
lines changed

3 files changed

+33
-28
lines changed

tests/validation/mtl_engine/media_creator.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ def _terminate_gst_process_after_duration(duration: int, host):
2020
# Find and terminate the gst-launch process on remote host
2121
terminate_cmd = "pkill -SIGINT gst-launch-1.0"
2222
try:
23-
run(terminate_cmd, host=host, enable_sudo=True)
23+
run(terminate_cmd, host=host)
2424
logger.info("Sent SIGINT to gst-launch process")
2525
except Exception:
2626
# Fallback to SIGTERM
2727
terminate_cmd = "pkill -SIGTERM gst-launch-1.0"
2828
try:
29-
run(terminate_cmd, host=host, enable_sudo=True)
29+
run(terminate_cmd, host=host)
3030
logger.info("Sent SIGTERM to gst-launch process")
3131
except Exception:
3232
pass
@@ -76,7 +76,7 @@ def create_video_file(
7676

7777
# Run the gstreamer command (this will block until process is terminated)
7878
try:
79-
result = run(" ".join(command), host=host, enable_sudo=True)
79+
result = run(" ".join(command), host=host)
8080
# Wait for termination thread to complete
8181
termination_thread.join(timeout=1)
8282

@@ -138,7 +138,7 @@ def create_audio_file_sox(
138138
logger.info(f"Creating audio file with command: {' '.join(command)}")
139139

140140
try:
141-
result = run(" ".join(command), host=host, enable_sudo=True)
141+
result = run(" ".join(command), host=host)
142142
return_code = getattr(result, "returncode", getattr(result, "exit_code", 0))
143143
if return_code == 0:
144144
logger.info(f"Audio file created at {output_path}")
@@ -174,7 +174,7 @@ def create_text_file(size_kb: int, output_path: str = "test_anc.txt", host=None)
174174

175175
try:
176176
for cmd in command_parts:
177-
result = run(cmd, host=host, enable_sudo=True)
177+
result = run(cmd, host=host)
178178
return_code = getattr(result, "returncode", getattr(result, "exit_code", 0))
179179
if return_code != 0:
180180
raise subprocess.SubprocessError(
@@ -244,8 +244,8 @@ def create_ancillary_rfc8331_pseudo_file(
244244

245245
try:
246246
for cmd in command_parts:
247-
result = run(cmd, host=host, enable_sudo=True)
248-
logging.info("f{cmd}")
247+
result = run(cmd, host=host)
248+
logging.info(f"{cmd}")
249249
return_code = getattr(result, "returncode", getattr(result, "exit_code", 0))
250250
if return_code != 0:
251251
raise subprocess.SubprocessError(
@@ -264,11 +264,11 @@ def remove_file(file_path: str, host=None):
264264
# Always attempt to remove the file
265265
command = f"rm -f {file_path}"
266266
try:
267-
run(command, host=host, enable_sudo=True)
267+
run(command, host=host)
268268

269269
# Check if file still exists after removal attempt
270270
check_cmd = f"test -f {file_path}"
271-
result = run(check_cmd, host=host, enable_sudo=True)
271+
result = run(check_cmd, host=host)
272272
return_code = getattr(result, "returncode", getattr(result, "exit_code", 0))
273273

274274
if return_code != 0:

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
# SPDX-License-Identifier: BSD-3-Clause
22
# Copyright(c) 2024-2025 Intel Corporation
33

4-
import os
5-
64
import mtl_engine.media_creator as media_create
75
import pytest
86
from mtl_engine import GstreamerApp
97

8+
TMP_INPUT_FILE = "/tmp/test_anc.txt"
9+
TMP_OUTPUT_FILE = "/tmp/output_anc_dual.txt"
10+
1011

1112
@pytest.mark.dual
1213
@pytest.mark.parametrize("fps", [24, 25, 30, 50, 60])
@@ -36,12 +37,12 @@ def test_st40p_fps_size_dual(
3637
# Create input file on TX host
3738
input_file_path = media_create.create_text_file(
3839
size_kb=file_size_kb,
39-
output_path=os.path.join(media, "test_anc.txt"),
40+
output_path=TMP_INPUT_FILE,
4041
host=tx_host,
4142
)
4243

4344
# Create output file path for RX host
44-
output_file_path = os.path.join(media, "output_anc_dual.txt")
45+
output_file_path = TMP_OUTPUT_FILE
4546

4647
# Setup TX pipeline using existing function
4748
tx_config = GstreamerApp.setup_gstreamer_st40p_tx_pipeline(
@@ -63,6 +64,7 @@ def test_st40p_fps_size_dual(
6364
output_path=output_file_path,
6465
rx_payload_type=113,
6566
rx_queues=4,
67+
rx_framebuff_cnt=framebuff,
6668
timeout=15,
6769
)
6870

tests/validation/tests/single/gstreamer/anc_format/test_anc_format.py

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
# SPDX-License-Identifier: BSD-3-Clause
22
# Copyright(c) 2024-2025 Intel Corporation
33

4-
import os
5-
64
import mtl_engine.media_creator as media_create
75
import pytest
86
from mtl_engine import GstreamerApp
97

8+
TMP_INPUT_FILE = "/tmp/test_anc.txt"
9+
TMP_OUTPUT_FILE = "/tmp/output_anc.txt"
10+
1011

1112
@pytest.mark.parametrize("fps", [24, 25, 30, 50, 60, 100, 120])
1213
@pytest.mark.parametrize("file_size_kb", [10, 100])
@@ -28,7 +29,7 @@ def test_st40p_fps_size(
2829

2930
input_file_path = media_create.create_text_file(
3031
size_kb=file_size_kb,
31-
output_path=os.path.join(media, "test_anc.txt"),
32+
output_path=TMP_INPUT_FILE,
3233
host=host,
3334
)
3435

@@ -47,9 +48,10 @@ def test_st40p_fps_size(
4748
rx_config = GstreamerApp.setup_gstreamer_st40p_rx_pipeline(
4849
build=build,
4950
nic_port_list=host.vfs[1],
50-
output_path=os.path.join(media, "output_anc.txt"),
51+
output_path=TMP_OUTPUT_FILE,
5152
rx_payload_type=113,
5253
rx_queues=4,
54+
rx_framebuff_cnt=framebuff,
5355
timeout=15,
5456
)
5557

@@ -59,7 +61,7 @@ def test_st40p_fps_size(
5961
tx_command=tx_config,
6062
rx_command=rx_config,
6163
input_file=input_file_path,
62-
output_file=os.path.join(media, "output_anc.txt"),
64+
output_file=TMP_OUTPUT_FILE,
6365
test_time=test_time,
6466
host=host,
6567
tx_first=False,
@@ -68,7 +70,7 @@ def test_st40p_fps_size(
6870
finally:
6971
# Remove the files after the test
7072
media_create.remove_file(input_file_path, host=host)
71-
media_create.remove_file(os.path.join(media, "output_anc.txt"), host=host)
73+
media_create.remove_file(TMP_OUTPUT_FILE, host=host)
7274

7375

7476
@pytest.mark.parametrize("fps", [60])
@@ -94,7 +96,7 @@ def test_st40p_framebuff(
9496

9597
input_file_path = media_create.create_text_file(
9698
size_kb=file_size_kb,
97-
output_path=os.path.join(media, "test_anc.txt"),
99+
output_path=TMP_INPUT_FILE,
98100
host=host,
99101
)
100102

@@ -108,15 +110,15 @@ def test_st40p_framebuff(
108110
tx_fps=fps,
109111
tx_did=67,
110112
tx_sdid=2,
111-
tx_rfc8331=True,
112113
)
113114

114115
rx_config = GstreamerApp.setup_gstreamer_st40p_rx_pipeline(
115116
build=build,
116117
nic_port_list=host.vfs[1],
117-
output_path=os.path.join(media, "output_anc.txt"),
118+
output_path=TMP_OUTPUT_FILE,
118119
rx_payload_type=113,
119120
rx_queues=4,
121+
rx_framebuff_cnt=framebuff,
120122
timeout=timeout_period + 10,
121123
)
122124

@@ -126,7 +128,7 @@ def test_st40p_framebuff(
126128
tx_command=tx_config,
127129
rx_command=rx_config,
128130
input_file=input_file_path,
129-
output_file=os.path.join(media, "output_anc.txt"),
131+
output_file=TMP_OUTPUT_FILE,
130132
test_time=test_time,
131133
host=host,
132134
tx_first=False,
@@ -135,7 +137,7 @@ def test_st40p_framebuff(
135137
finally:
136138
# Remove the files after the test
137139
media_create.remove_file(input_file_path, host=host)
138-
media_create.remove_file(os.path.join(media, "output_anc.txt"), host=host)
140+
media_create.remove_file(TMP_OUTPUT_FILE, host=host)
139141

140142

141143
@pytest.mark.parametrize("fps", [24, 25, 30, 50, 60, 100, 120])
@@ -158,7 +160,7 @@ def test_st40p_format_8331(
158160

159161
input_file_path = media_create.create_ancillary_rfc8331_pseudo_file(
160162
size_frames=fps * 10,
161-
output_path=os.path.join(media, "test_anc.txt"),
163+
output_path=TMP_INPUT_FILE,
162164
host=host,
163165
)
164166

@@ -178,9 +180,10 @@ def test_st40p_format_8331(
178180
rx_config = GstreamerApp.setup_gstreamer_st40p_rx_pipeline(
179181
build=build,
180182
nic_port_list=host.vfs[1],
181-
output_path=os.path.join(media, "output_anc.txt"),
183+
output_path=TMP_OUTPUT_FILE,
182184
rx_payload_type=113,
183185
rx_queues=4,
186+
rx_framebuff_cnt=framebuff,
184187
timeout=timeout_period + 10,
185188
capture_metadata=True,
186189
)
@@ -191,7 +194,7 @@ def test_st40p_format_8331(
191194
tx_command=tx_config,
192195
rx_command=rx_config,
193196
input_file=input_file_path,
194-
output_file=os.path.join(media, "output_anc.txt"),
197+
output_file=TMP_OUTPUT_FILE,
195198
test_time=test_time,
196199
host=host,
197200
tx_first=False,
@@ -200,4 +203,4 @@ def test_st40p_format_8331(
200203
finally:
201204
# Remove the files after the test
202205
media_create.remove_file(input_file_path, host=host)
203-
media_create.remove_file(os.path.join(media, "output_anc.txt"), host=host)
206+
media_create.remove_file(TMP_OUTPUT_FILE, host=host)

0 commit comments

Comments
 (0)