]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
selftest: Don’t use invalid escape sequences
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Tue, 22 Aug 2023 23:00:42 +0000 (11:00 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 30 Aug 2023 02:15:29 +0000 (02:15 +0000)
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
selftest/tap2subunit

index e569e7f8d145951814865035c563d20cdf7a729e..a1b24133a78a0d8e0ec490a993e0f87ffca56c3b 100755 (executable)
@@ -60,7 +60,8 @@ def TAP2SubUnit(tap, subunit):
         del log[:]
     for line in tap:
         if state == BEFORE_PLAN:
-            match = re.match("(\d+)\.\.(\d+)\s*(?:\#\s+(.*))?\n", line)
+            match = re.match(r"(\d+)\.\.(\d+)\s*(?:\#\s+(.*))?"
+                             "\n", line)
             if match:
                 state = AFTER_PLAN
                 _, plan_stop, comment = match.groups()
@@ -74,7 +75,8 @@ def TAP2SubUnit(tap, subunit):
                     subunit.write("]\n")
                 continue
         # not a plan line, or have seen one before
-        match = re.match("(ok|not ok)(?:\s+(\d+)?)?(?:\s+([^#]*[^#\s]+)\s*)?(?:\s+#\s+(TODO|SKIP|skip|todo)(?:\s+(.*))?)?\n", line)
+        match = re.match(r"(ok|not ok)(?:\s+(\d+)?)?(?:\s+([^#]*[^#\s]+)\s*)?(?:\s+#\s+(TODO|SKIP|skip|todo)(?:\s+(.*))?)?"
+                         "\n", line)
         if match:
             # new test, emit current one.
             _emit_test()
@@ -101,7 +103,8 @@ def TAP2SubUnit(tap, subunit):
             test_name = "test %d%s" % (plan_start, description)
             plan_start += 1
             continue
-        match = re.match("Bail out\!(?:\s*(.*))?\n", line)
+        match = re.match(r"Bail out\!(?:\s*(.*))?"
+                         "\n", line)
         if match:
             reason, = match.groups()
             if reason is None:
@@ -113,7 +116,8 @@ def TAP2SubUnit(tap, subunit):
             result = "error"
             state = SKIP_STREAM
             continue
-        match = re.match("\#.*\n", line)
+        match = re.match(r"\#.*"
+                         "\n", line)
         if match:
             log.append(line[:-1])
             continue