[oe-commits] [openembedded-core] 17/22: oeqa/selftest/context: Improve log file handling
git at git.openembedded.org
git at git.openembedded.org
Thu Nov 29 12:48:43 UTC 2018
This is an automated email from the git hooks/post-receive script.
rpurdie pushed a commit to branch master-next
in repository openembedded-core.
commit 0b4e0f131aad421090da23ab3efe96879cb1ac02
Author: Richard Purdie <richard.purdie at linuxfoundation.org>
AuthorDate: Thu Nov 29 12:07:53 2018 +0000
oeqa/selftest/context: Improve log file handling
The existing logfile is simply placed in the current directory. Since the test
changes cwd to BUILDDIR, the symlink to the log can be placed in an invalid
directory. We also see trackbacks if the symlink is invalid.
Improve things by:
* Placing logs in LOG_DIR (or BUILDDIR if unset).
* Using a full path to the log meaning the log and link are placed in the same directory.
* Using lexists instead of exists so invalid symlinks are handled correctly.
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
meta/lib/oeqa/selftest/context.py | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/meta/lib/oeqa/selftest/context.py b/meta/lib/oeqa/selftest/context.py
index dab7268..c521290 100644
--- a/meta/lib/oeqa/selftest/context.py
+++ b/meta/lib/oeqa/selftest/context.py
@@ -101,10 +101,15 @@ class OESelftestTestContextExecutor(OETestContextExecutor):
def _process_args(self, logger, args):
args.test_start_time = time.strftime("%Y%m%d%H%M%S")
- args.output_log = '%s-results-%s.log' % (self.name, args.test_start_time)
args.test_data_file = None
args.CASES_PATHS = None
+ bbvars = get_bb_vars()
+ logdir = os.environ.get("BUILDDIR")
+ if 'LOG_DIR' in bbvars:
+ logdir = bbvars['LOG_DIR']
+ args.output_log = logdir + '/%s-results-%s.log' % (self.name, args.test_start_time)
+
super(OESelftestTestContextExecutor, self)._process_args(logger, args)
if args.list_modules:
@@ -114,7 +119,7 @@ class OESelftestTestContextExecutor(OETestContextExecutor):
elif args.list_tests:
args.list_tests = 'name'
- self.tc_kwargs['init']['td'] = get_bb_vars()
+ self.tc_kwargs['init']['td'] = bbvars
self.tc_kwargs['init']['machines'] = self._get_available_machines()
builddir = os.environ.get("BUILDDIR")
@@ -304,7 +309,7 @@ class OESelftestTestContextExecutor(OETestContextExecutor):
output_link = os.path.join(os.path.dirname(args.output_log),
"%s-results.log" % self.name)
- if os.path.exists(output_link):
+ if os.path.lexists(output_link):
os.remove(output_link)
os.symlink(args.output_log, output_link)
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Openembedded-commits
mailing list