From 75de3c4ce2d7de4ff83315b25224c97156d0d173 Mon Sep 17 00:00:00 2001 From: Raghavendran Ramanathan Date: Thu, 31 Jul 2025 19:55:36 -0700 Subject: [PATCH 1/2] Check the sai.profile lines for comments. --- tests/ip/link_local/test_link_local_ip.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/ip/link_local/test_link_local_ip.py b/tests/ip/link_local/test_link_local_ip.py index 342ea54678c..1d74bb5a73d 100644 --- a/tests/ip/link_local/test_link_local_ip.py +++ b/tests/ip/link_local/test_link_local_ip.py @@ -61,8 +61,10 @@ def check_if_test_is_supported(duthost): sai_settings = {} sai_profile = "/usr/share/sonic/device/{}/{}/sai.profile".format(platform, hwsku) for line in duthost.command("cat %s" % sai_profile)["stdout_lines"]: - key, value = line.split("=") - sai_settings[key] = value + if (not re.match("^#", line)) and re.search("=", line): + # line should not a comment, and must contain the "=". + key, value = line.split("=") + sai_settings[key] = value if int(sai_settings.get("SAI_NOT_DROP_SIP_DIP_LINK_LOCAL", 0)) != 1: pytest.skip("Test is not supported, SAI_NOT_DROP_SIP_DIP_LINK_LOCAL is not equal 1 or not specified") From 5b857b58b23c95c2beb0064e184046129812ed50 Mon Sep 17 00:00:00 2001 From: Raghavendran Ramanathan Date: Thu, 31 Jul 2025 19:57:31 -0700 Subject: [PATCH 2/2] Add to check for space before the # sign. --- tests/ip/link_local/test_link_local_ip.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/ip/link_local/test_link_local_ip.py b/tests/ip/link_local/test_link_local_ip.py index 1d74bb5a73d..3e7cdc1dc66 100644 --- a/tests/ip/link_local/test_link_local_ip.py +++ b/tests/ip/link_local/test_link_local_ip.py @@ -61,7 +61,7 @@ def check_if_test_is_supported(duthost): sai_settings = {} sai_profile = "/usr/share/sonic/device/{}/{}/sai.profile".format(platform, hwsku) for line in duthost.command("cat %s" % sai_profile)["stdout_lines"]: - if (not re.match("^#", line)) and re.search("=", line): + if (not re.match("^[ \t]*#", line)) and re.search("=", line): # line should not a comment, and must contain the "=". key, value = line.split("=") sai_settings[key] = value