From ecb1c7fa2136126222944d82b1d0b76ed00faee0 Mon Sep 17 00:00:00 2001 From: methanal <baclofen@tuta.io> Date: Wed, 6 Nov 2024 23:26:23 +0530 Subject: [PATCH] CI: deviceinfo: allow inline comments (MR 5766) The current test script disallows these kinds of comments: deviceinfo_some_variable="some_value" # an inline comment Since deviceinfo is essentially a shell script, it does make sense to allow inline comments. It is relatively simple to implement as well, by adjusting the regex. [ci:skip-build]: already built successfully in CI --- .ci/testcases/test_deviceinfo.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.ci/testcases/test_deviceinfo.py b/.ci/testcases/test_deviceinfo.py index 5f29c4a98fc..d290b7e8042 100644 --- a/.ci/testcases/test_deviceinfo.py +++ b/.ci/testcases/test_deviceinfo.py @@ -36,7 +36,7 @@ def test_deviceinfo(): # Iterate over all devices last_exception = None count = 0 - pattern = re.compile("^deviceinfo_[a-zA-Z0-9_]*=\".*\"$") + pattern = re.compile("^deviceinfo_[a-zA-Z0-9_]*=\".*\"(\\s*# .*)?$") for folder in pkgrepo_iglob("device/*/device-*"): device = folder.name.split("-", 1)[1] @@ -63,8 +63,8 @@ def test_deviceinfo(): # Check line against regex (can't use multiple lines etc.) if not pattern.match(line) or line.endswith("\\\""): raise RuntimeError("Line looks invalid, maybe missing" - " quotes/multi-line string/comment next" - f" to line instead of above? {line}") + " quotes/multi-line string/malformed" + f" inline comment? {line}") # Successful deviceinfo parsing / obsolete options info = pmb.parse.deviceinfo(device) -- GitLab