diff options
author | Yi Zhao <yi.zhao@windriver.com> | 2016-01-14 15:08:37 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-01-19 17:37:33 +0000 |
commit | 7a0b1c185083806500492cf87e823dd6c4b1795e (patch) | |
tree | ab4be5620221e726deb5b1d61dceb5f5f4a7cf6b | |
parent | b8e11e2d6ec8e78051266dab4d58ee51c46b96fd (diff) | |
download | poky-7a0b1c185083806500492cf87e823dd6c4b1795e.tar.gz |
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>
-rw-r--r-- | meta/lib/oeqa/runtime/parselogs.py | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/meta/lib/oeqa/runtime/parselogs.py b/meta/lib/oeqa/runtime/parselogs.py index fc2bc38935..5a2d50f0a3 100644 --- a/meta/lib/oeqa/runtime/parselogs.py +++ b/meta/lib/oeqa/runtime/parselogs.py | |||
@@ -221,9 +221,8 @@ class ParseLogsTest(oeRuntimeTest): | |||
221 | results[log.replace('target_logs/','')] = {} | 221 | results[log.replace('target_logs/','')] = {} |
222 | rez = result.splitlines() | 222 | rez = result.splitlines() |
223 | for xrez in rez: | 223 | for xrez in rez: |
224 | command = "grep \"\\"+str(xrez)+"\" -B "+str(lines_before)+" -A "+str(lines_after)+" "+str(log) | ||
225 | try: | 224 | try: |
226 | grep_output = subprocess.check_output(command, shell=True) | 225 | grep_output = subprocess.check_output(['grep', '-F', xrez, '-B', str(lines_before), '-A', str(lines_after), log]) |
227 | except: | 226 | except: |
228 | pass | 227 | pass |
229 | results[log.replace('target_logs/','')][xrez]=grep_output | 228 | results[log.replace('target_logs/','')][xrez]=grep_output |