diff options
author | Ross Burton <ross.burton@arm.com> | 2023-09-23 14:04:07 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-09-26 10:25:42 +0100 |
commit | c7957aeeb520c51e1ffb335462208b6e7519726c (patch) | |
tree | cecae062ba28087636c600368f75a4cd8bbeb88a /meta | |
parent | 6a660d8b44031ae5d4996a1170de7d0327613f80 (diff) | |
download | poky-c7957aeeb520c51e1ffb335462208b6e7519726c.tar.gz |
oeqa/runtime/parselogs: improve find call
getLogList() uses remote find invocations to find the logs. Instead of
relying on shell expansion of wildcards and redundant use of -maxdepth
(pointless as the shell expansion means the find is passed the files to
return), invoke find idiomatically by telling it what directory to
search for and escape the glob so find processes it.
Also remove many pointless str() calls.
(From OE-Core rev: 03bb14cebf5879472a8da78d892ecd5c5df5c3cf)
Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/lib/oeqa/runtime/cases/parselogs.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/meta/lib/oeqa/runtime/cases/parselogs.py b/meta/lib/oeqa/runtime/cases/parselogs.py index 6e5dc75306..93782b844b 100644 --- a/meta/lib/oeqa/runtime/cases/parselogs.py +++ b/meta/lib/oeqa/runtime/cases/parselogs.py | |||
@@ -229,18 +229,18 @@ class ParseLogsTest(OERuntimeTestCase): | |||
229 | def getLogList(self, log_locations): | 229 | def getLogList(self, log_locations): |
230 | logs = [] | 230 | logs = [] |
231 | for location in log_locations: | 231 | for location in log_locations: |
232 | status, _ = self.target.run('test -f ' + str(location)) | 232 | status, _ = self.target.run('test -f %s' % location) |
233 | if status == 0: | 233 | if status == 0: |
234 | logs.append(str(location)) | 234 | logs.append(location) |
235 | else: | 235 | else: |
236 | status, _ = self.target.run('test -d ' + str(location)) | 236 | status, _ = self.target.run('test -d %s' % location) |
237 | if status == 0: | 237 | if status == 0: |
238 | cmd = 'find ' + str(location) + '/*.log -maxdepth 1 -type f' | 238 | cmd = 'find %s -name \\*.log -maxdepth 1 -type f' % location |
239 | status, output = self.target.run(cmd) | 239 | status, output = self.target.run(cmd) |
240 | if status == 0: | 240 | if status == 0: |
241 | output = output.splitlines() | 241 | output = output.splitlines() |
242 | for logfile in output: | 242 | for logfile in output: |
243 | logs.append(os.path.join(location, str(logfile))) | 243 | logs.append(os.path.join(location, logfile)) |
244 | return logs | 244 | return logs |
245 | 245 | ||
246 | # Copy the log files to be parsed locally | 246 | # Copy the log files to be parsed locally |