From 9408ad93b351c9194b0b2d355f86b28c7be93404 Mon Sep 17 00:00:00 2001
From: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Date: Fri, 9 Dec 2011 11:02:54 +0100
Subject: [PATCH] test2tasks.pl: Fix differing output format of testlib on
 Unix.

Change-Id: I37fb39fa00e7e4a45ac843eba9f50d2d95a56ae1
Reviewed-by: Tobias Hunger <tobias.hunger@nokia.com>
---
 scripts/test2tasks.pl | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/scripts/test2tasks.pl b/scripts/test2tasks.pl
index abaf6ae77a0..7e60fdc12d3 100755
--- a/scripts/test2tasks.pl
+++ b/scripts/test2tasks.pl
@@ -39,18 +39,24 @@ my $lastLine = '';
 while (my $line = <STDIN> ) {
     chomp($line);
     # --- Continuation line?
-    if (substr($line, 0, 1) eq ' ') {
+    if (substr($line, 0, 1) eq ' ' && index($line, 'Loc: [') < 0) {
        $lastLine .= $line;
        next;
     }
-    # --- extract file name based matching '[..\].\tst_lancelot.cpp(258) : failure location'
-    if ($line =~ /^([^(]+)\((\d+)\) : failure location$/) {
-        my $slashPos = rindex($1, '/');
-        $slashPos = rindex($1, "\\") if $slashPos < 0;
-        my $fileName = $slashPos > 0 ? substr($1, $slashPos + 1) : $1;
+    # --- extract file name based matching:
+    #     Windows: '[..\].\tst_lancelot.cpp(258) : failure location'
+    #     Unix:    '  Loc: [file(1596)]'
+    if ($line =~ /^([^(]+)\((\d+)\) : failure location$/
+        || $line =~ /^\s*Loc:\s*\[([^(]+)\((\d+)\).*$/) {
+        my $fullFileName = $1;
         my $line = $2;
-        my $fullFileName = $fileHash{$fileName};
-        $fullFileName = $fileName unless defined $fullFileName;
+        if (index($fullFileName, '/') != 0) { # Unix has absolute file names, Windows may not
+            my $slashPos = rindex($fullFileName, '/');
+            $slashPos = rindex($fullFileName, "\\") if $slashPos < 0;
+            my $fileName = $slashPos > 0 ? substr($1, $slashPos + 1) : $fullFileName;
+            $fullFileName = $fileHash{$fileName};
+            $fullFileName = $fileName unless defined $fullFileName;
+        }
         my $type = index($lastLine, 'FAIL') == 0 ? 'err' : 'unknown';
         print $fullFileName, "\t", $line, "\t", $type, "\t", $lastLine,"\n";
     }
-- 
GitLab