Sometimes the grep output is not correct if the log message contains
some special characters. Use re.escape to escape all non-alphanumerics
before grep

Signed-off-by: Yi Zhao <yi.z...@windriver.com>
---
 meta/lib/oeqa/runtime/parselogs.py |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/meta/lib/oeqa/runtime/parselogs.py 
b/meta/lib/oeqa/runtime/parselogs.py
index fc2bc38..7fc7932 100644
--- a/meta/lib/oeqa/runtime/parselogs.py
+++ b/meta/lib/oeqa/runtime/parselogs.py
@@ -1,6 +1,7 @@
 import os
 import unittest
 import subprocess
+import re
 from oeqa.oetest import oeRuntimeTest
 from oeqa.utils.decorators import *
 
@@ -50,7 +51,7 @@ x86_common = [
 qemux86_common = [
     'wrong ELF class',
     "fail to add MMCONFIG information, can't access extended PCI configuration 
space under this bridge.",
-    "can't claim BAR ",
+    "can\'t claim BAR ",
 ] + common_errors
 
 ignore_errors = { 
@@ -221,7 +222,8 @@ class ParseLogsTest(oeRuntimeTest):
                 results[log.replace('target_logs/','')] = {}
                 rez = result.splitlines()
                 for xrez in rez:
-                    command = "grep \"\\"+str(xrez)+"\" -B 
"+str(lines_before)+" -A "+str(lines_after)+" "+str(log)
+                    nxrez = re.escape(xrez)
+                    command = "grep -E \""+str(nxrez)+"\" -B 
"+str(lines_before)+" -A "+str(lines_after)+" "+str(log)
                     try:
                         grep_output = subprocess.check_output(command, 
shell=True)
                     except:
-- 
1.7.9.5

-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Reply via email to