[tools] winetest/dissect: Improve the pid detection on garbled lines.

Francois Gouget fgouget at codeweavers.com
Mon Mar 15 04:30:26 CDT 2021


The pid is always printed with a fixed width so this should be taken
into account to avoid matching too much. For instance in
'garbage1234:unit.c:...' one should match '1234', not 'e1234' which
would lead to a mismatch with the pids on other lines.
This is particularly important for the exception, summary and done
lines.
This also means the matching can be simplified a bit since we know
where the relevant part of the line starts.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
 winetest/dissect | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/winetest/dissect b/winetest/dissect
index 304e9c998..919b17ac3 100755
--- a/winetest/dissect
+++ b/winetest/dissect
@@ -665,9 +665,7 @@ while ($line = <IN>) {
       check_unit($l_unit, "IgnoreExceptions");
       $ignore_exceptions = $l_ignore;
     }
-    elsif (($unit ne "" and
-            $line =~ /([0-9a-f]+):($units_re):[0-9.]* unhandled exception [0-9a-fA-F]{8} at /) or
-           $line =~ /^([0-9a-f]+):([_.a-z0-9]+):[0-9.]* unhandled exception [0-9a-fA-F]{8} at /)
+    elsif ($line =~ /([0-9a-f]{4}):([_.a-z0-9]+):[0-9.]* unhandled exception [0-9a-fA-F]{8} at /)
     {
         my ($l_pid, $l_unit) = ($1, $2);
         my $class = "";
@@ -699,8 +697,8 @@ while ($line = <IN>) {
         add_test_line($class, escapeHTML($line));
     }
     elsif (($unit ne "" and
-            $line =~ /^(.*?)($units_re)\.c:(\d+)(:[0-9.]* unhandled exception [0-9a-fA-F]{8} in child process ([0-9a-f]+).*)$/) or
-           $line =~ /^()([_.a-z0-9]+)\.c:(\d+)(:[0-9.]* unhandled exception [0-9a-fA-F]{8} in child process ([0-9a-f]+).*)$/)
+            $line =~ /^(.*?)($units_re)\.c:(\d+)(:[0-9.]* unhandled exception [0-9a-fA-F]{8} in child process ([0-9a-f]{4}).*)$/) or
+           $line =~ /^()([_.a-z0-9]+)\.c:(\d+)(:[0-9.]* unhandled exception [0-9a-fA-F]{8} in child process ([0-9a-f]{4}).*)$/)
     {
         my ($pollution, $l_unit, $l_num, $l_text, $l_pid) = ($1, $2, $3, $4, $5);
         my $class = "";
@@ -729,9 +727,7 @@ while ($line = <IN>) {
                                get_source_link($l_unit, $l_num) .
                                escapeHTML($l_text));
     }
-    elsif (($unit ne "" and
-            $line =~ /([0-9a-f]+):($unit):[0-9.]* (\d+) tests? executed \((\d+) marked as todo, (\d+) failures?\), (\d+) skipped\./) or
-           $line =~ /^([0-9a-f]+):([_a-z0-9]+):[0-9.]* (\d+) tests? executed \((\d+) marked as todo, (\d+) failures?\), (\d+) skipped\./)
+    elsif ($line =~ /([0-9a-f]{4}):([_a-z0-9]+):[0-9.]* (\d+) tests? executed \((\d+) marked as todo, (\d+) failures?\), (\d+) skipped\./)
     {
         my ($l_pid, $l_unit, $l_total, $l_todo, $l_failures, $l_skipped) = ($1, $2, $3, $4, $5, $6);
 
@@ -754,8 +750,8 @@ while ($line = <IN>) {
         }
     }
     elsif (($dll ne "" and
-            $line =~ /(\Q$dll\E):([_a-z0-9]+):([0-9a-f]+) done \((-?\d+)\) in /) or
-           $line =~ /^([_.a-z0-9-]+):([_a-z0-9]+):([0-9a-f]+) done \((-?\d+)\) in /)
+            $line =~ /(\Q$dll\E):([_a-z0-9]+):([0-9a-f]{4}) done \((-?\d+)\) in /) or
+           $line =~ /^([_.a-z0-9-]+):([_a-z0-9]+):([0-9a-f]{4}) done \((-?\d+)\) in /)
     {
         my ($l_dll, $l_unit, $l_pid, $l_rc) = ($1, $2, $3, $4);
 
-- 
2.20.1




More information about the wine-devel mailing list