oeqa/runtime/parselogs: use -F to search fixed strings for grep

The grep output is not correct if the log message contains special
characters. Use -F which tells grep to search for fixed strings, not
expressions and pass lists instead of strings to subprocess.

(From OE-Core rev: bfc8304d4c10b5601a618011893369831baaf511)

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Yi Zhao 2016-01-14 15:08:37 +08:00 committed by Richard Purdie
parent b8e11e2d6e
commit 7a0b1c1850
1 changed files with 1 additions and 2 deletions

View File

@ -221,9 +221,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)
try:
grep_output = subprocess.check_output(command, shell=True)
grep_output = subprocess.check_output(['grep', '-F', xrez, '-B', str(lines_before), '-A', str(lines_after), log])
except:
pass
results[log.replace('target_logs/','')][xrez]=grep_output