summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2018-11-29 12:07:53 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-12-06 10:18:37 +0000
commit1ec53b8d82491aeb9f49e7a78f531e98b5608f0f (patch)
tree2169ef10e5badd7f7960bf449ea50d1b013853a7
parenta883aa053ddeb4591109c7c1374525e63a59bd80 (diff)
downloadopenembedded-core-1ec53b8d82491aeb9f49e7a78f531e98b5608f0f.tar.gz
openembedded-core-1ec53b8d82491aeb9f49e7a78f531e98b5608f0f.tar.bz2
openembedded-core-1ec53b8d82491aeb9f49e7a78f531e98b5608f0f.zip
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. (From OE-Core rev: 750ece11bed0e62a11e0003d1d16a81f7c219761) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/lib/oeqa/selftest/context.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/meta/lib/oeqa/selftest/context.py b/meta/lib/oeqa/selftest/context.py
index 302ff73bed..fd9280f8a9 100644
--- a/meta/lib/oeqa/selftest/context.py
+++ b/meta/lib/oeqa/selftest/context.py
@@ -100,10 +100,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:
@@ -113,7 +118,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")
@@ -303,7 +308,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)