Skip to content

Commit 9375b9c

Browse files
rraghav-ciscogshemesh2
authored andcommitted
Check for comments in sai.profile lines in the test_link_local_ip.py (sonic-net#19989)
* Check the sai.profile lines for comments. * Add to check for space before the # sign. Signed-off-by: Guy Shemesh <gshemesh@nvidia.com>
1 parent 4ea3f4e commit 9375b9c

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

tests/ip/link_local/test_link_local_ip.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,10 @@ def check_if_test_is_supported(duthost):
6161
sai_settings = {}
6262
sai_profile = "/usr/share/sonic/device/{}/{}/sai.profile".format(platform, hwsku)
6363
for line in duthost.command("cat %s" % sai_profile)["stdout_lines"]:
64-
key, value = line.split("=")
65-
sai_settings[key] = value
64+
if (not re.match("^[ \t]*#", line)) and re.search("=", line):
65+
# line should not a comment, and must contain the "=".
66+
key, value = line.split("=")
67+
sai_settings[key] = value
6668
if int(sai_settings.get("SAI_NOT_DROP_SIP_DIP_LINK_LOCAL", 0)) != 1:
6769
pytest.skip("Test is not supported, SAI_NOT_DROP_SIP_DIP_LINK_LOCAL is not equal 1 or not specified")
6870

0 commit comments

Comments
 (0)