summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorFranck Bui <fbui@suse.com>2018-02-23 17:12:50 +0100
committerFranck Bui <fbui@suse.com>2018-02-27 14:42:09 +0100
commit75a56cb63259505e568d0524461d446040ceba6c (patch)
treee109eb037fddd09daa1aa8a0ff1e56026bf4da1e /test
parentrule-syntax-check: PROGRAM is not supposed to get value assigned (diff)
downloadsystemd-75a56cb63259505e568d0524461d446040ceba6c.tar.xz
systemd-75a56cb63259505e568d0524461d446040ceba6c.zip
rule-syntax-check: values can contain escaped double quotes
This is true since commit 7e760b79ad143b26a5c937afa7666a7c40508f85. Note that the changes in the regex expressions relies on the fact that the script assumes that the comma separator is mandatory. Add a comment in the script to clarify this.
Diffstat (limited to 'test')
-rwxr-xr-xtest/rule-syntax-check.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/test/rule-syntax-check.py b/test/rule-syntax-check.py
index f24285ddac6..dcbab5fc6dc 100755
--- a/test/rule-syntax-check.py
+++ b/test/rule-syntax-check.py
@@ -28,10 +28,10 @@ rules_files = sys.argv[1:]
if not rules_files:
sys.exit('Specify files to test as arguments')
-no_args_tests = re.compile(r'(ACTION|DEVPATH|KERNELS?|NAME|SYMLINK|SUBSYSTEMS?|DRIVERS?|TAG|PROGRAM|RESULT|TEST)\s*(?:=|!)=\s*"([^"]*)"$')
-args_tests = re.compile(r'(ATTRS?|ENV|TEST){([a-zA-Z0-9/_.*%-]+)}\s*(?:=|!)=\s*"([^"]*)"$')
-no_args_assign = re.compile(r'(NAME|SYMLINK|OWNER|GROUP|MODE|TAG|RUN|LABEL|GOTO|OPTIONS|IMPORT)\s*(?:\+=|:=|=)\s*"([^"]*)"$')
-args_assign = re.compile(r'(ATTR|ENV|IMPORT|RUN){([a-zA-Z0-9/_.*%-]+)}\s*(=|\+=)\s*"([^"]*)"$')
+no_args_tests = re.compile(r'(ACTION|DEVPATH|KERNELS?|NAME|SYMLINK|SUBSYSTEMS?|DRIVERS?|TAG|PROGRAM|RESULT|TEST)\s*(?:=|!)=\s*"(.*)"$')
+args_tests = re.compile(r'(ATTRS?|ENV|TEST){([a-zA-Z0-9/_.*%-]+)}\s*(?:=|!)=\s*"(.*)"$')
+no_args_assign = re.compile(r'(NAME|SYMLINK|OWNER|GROUP|MODE|TAG|RUN|LABEL|GOTO|OPTIONS|IMPORT)\s*(?:\+=|:=|=)\s*"(.*)"$')
+args_assign = re.compile(r'(ATTR|ENV|IMPORT|RUN){([a-zA-Z0-9/_.*%-]+)}\s*(=|\+=)\s*"(.*)"$')
result = 0
buffer = ''
@@ -54,6 +54,8 @@ for path in rules_files:
if not line or line.startswith('#'):
continue
+ # Separator ',' is normally optional but we make it mandatory here as
+ # it generally improves the readability of the rules.
for clause in line.split(','):
clause = clause.strip()
if not (no_args_tests.match(clause) or args_tests.match(clause) or