1
1
# SPDX-License-Identifier: BSD-3-Clause
2
2
# Copyright(c) 2024-2025 Intel Corporation
3
3
4
- import hashlib
5
4
import logging
6
5
import os
7
- import time
8
6
import re
7
+ import time
9
8
10
9
from mtl_engine .RxTxApp import prepare_tcpdump
11
10
@@ -54,20 +53,20 @@ def fract_format(framerate: str) -> str:
54
53
# If already in fractional format, return as-is
55
54
if "/" in framerate :
56
55
return framerate
57
-
56
+
58
57
# Convert specific decimal framerates to fractional format
59
58
framerate_map = {
60
59
"23.98" : "2398/100" ,
61
- "23.976" : "2398/100" ,
60
+ "23.976" : "2398/100" ,
62
61
"29.97" : "2997/100" ,
63
62
"59.94" : "5994/100" ,
64
63
"119.88" : "11988/100"
65
64
}
66
-
65
+
67
66
# Check if it's one of the special decimal framerates
68
67
if framerate in framerate_map :
69
68
return framerate_map [framerate ]
70
-
69
+
71
70
# For integer framerates, add /1
72
71
try :
73
72
int (framerate ) # Validate it's a number
@@ -324,6 +323,7 @@ def setup_gstreamer_st40p_rx_pipeline(
324
323
325
324
return pipeline_command
326
325
326
+
327
327
def execute_test (
328
328
build : str ,
329
329
tx_command : dict ,
@@ -357,15 +357,15 @@ def execute_test(
357
357
:return: True if test passed, False otherwise
358
358
"""
359
359
is_dual = tx_host is not None and rx_host is not None
360
-
360
+
361
361
if is_dual :
362
362
logger .info ("Executing dual host GStreamer test" )
363
363
tx_remote_host = tx_host
364
364
rx_remote_host = rx_host
365
365
else :
366
366
logger .info ("Executing single host GStreamer test" )
367
367
tx_remote_host = rx_remote_host = host
368
-
368
+
369
369
case_id = os .environ .get ("PYTEST_CURRENT_TEST" , "gstreamer_test" )
370
370
case_id = case_id [: case_id .rfind ("(" ) - 1 ] if "(" in case_id else case_id
371
371
@@ -374,10 +374,10 @@ def execute_test(
374
374
375
375
tx_process = None
376
376
rx_process = None
377
-
377
+
378
378
if is_dual :
379
379
tx_tcpdump = prepare_tcpdump (capture_cfg , tx_host ) if capture_cfg else None
380
- rx_tcpdump = prepare_tcpdump (capture_cfg , rx_host ) if capture_cfg else None
380
+ # rx_tcpdump = prepare_tcpdump(capture_cfg, rx_host) if capture_cfg else None # Unused
381
381
tcpdump = tx_tcpdump
382
382
else :
383
383
tcpdump = prepare_tcpdump (capture_cfg , host )
@@ -496,11 +496,12 @@ def execute_test(
496
496
else :
497
497
# For single host tests, both files are on the same host
498
498
file_compare = compare_files (input_file , output_file , tx_remote_host , rx_remote_host )
499
-
499
+
500
500
logger .info (f"File comparison: { file_compare } " )
501
501
502
502
return file_compare
503
503
504
+
504
505
def compare_files (input_file , output_file , input_host = None , output_host = None ):
505
506
"""
506
507
Compare files on remote hosts.
@@ -519,7 +520,7 @@ def compare_files(input_file, output_file, input_host=None, output_host=None):
519
520
logger .info (f"Input file size: { input_file_size } " )
520
521
else :
521
522
logger .info (f"Input file { input_file } does not exist - skipping input validation" )
522
-
523
+
523
524
# Check output file size (always remote)
524
525
output_stat_proc = run (f"stat -c '%s' { output_file } " , host = output_host )
525
526
if output_stat_proc .return_code != 0 :
@@ -536,7 +537,7 @@ def compare_files(input_file, output_file, input_host=None, output_host=None):
536
537
else :
537
538
log_fail ("Output file is empty" )
538
539
return False
539
-
540
+
540
541
# If input file exists, do full comparison
541
542
if input_file_size != output_file_size :
542
543
log_fail ("File size is different" )
@@ -556,10 +557,10 @@ def compare_files(input_file, output_file, input_host=None, output_host=None):
556
557
557
558
logger .info (f"Input file hash: { i_hash } " )
558
559
logger .info (f"Output file hash: { o_hash } " )
559
-
560
+
560
561
if i_hash and o_hash and i_hash == o_hash :
561
562
return True
562
-
563
+
563
564
except Exception as e :
564
565
log_fail (f"Error during file comparison: { e } " )
565
566
return False
@@ -604,5 +605,4 @@ def get_case_id() -> str:
604
605
605
606
def sanitize_filename (name : str ) -> str :
606
607
"""Replace unsafe characters with underscores"""
607
- import re
608
608
return re .sub (r"[^A-Za-z0-9_.-]" , "_" , name )
0 commit comments