From: Yi Zhao Date: Thu, 14 Jan 2016 07:08:37 +0000 (+0800) Subject: oeqa/runtime/parselogs: use -F to search fixed strings for grep X-Git-Tag: lucaceresoli/bug-15201-perf-libtraceevent-missing~27616 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bfc8304d4c10b5601a618011893369831baaf511;p=thirdparty%2Fopenembedded%2Fopenembedded-core-contrib.git 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. Signed-off-by: Yi Zhao Signed-off-by: Ross Burton --- diff --git a/meta/lib/oeqa/runtime/parselogs.py b/meta/lib/oeqa/runtime/parselogs.py index fc2bc389350..5a2d50f0a3f 100644 --- a/meta/lib/oeqa/runtime/parselogs.py +++ b/meta/lib/oeqa/runtime/parselogs.py @@ -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