summaryrefslogtreecommitdiffstats
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-16 14:31:33 +0000
commit3c27f3b3a76e3cb11faf119a4edb3c96e9e7e607 (patch)
treee3ea09c25003c1f2fff7e3aaeda4b8b1c2bc118c
parentc414b06ea63c5222f40e9ef327fcc77a8bac3efa (diff)
downloadpoky-3c27f3b3a76e3cb11faf119a4edb3c96e9e7e607.tar.gz
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) (From OE-Core rev: 1ec53b8d82491aeb9f49e7a78f531e98b5608f0f) 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):
100 100
101 def _process_args(self, logger, args): 101 def _process_args(self, logger, args):
102 args.test_start_time = time.strftime("%Y%m%d%H%M%S") 102 args.test_start_time = time.strftime("%Y%m%d%H%M%S")
103 args.output_log = '%s-results-%s.log' % (self.name, args.test_start_time)
104 args.test_data_file = None 103 args.test_data_file = None
105 args.CASES_PATHS = None 104 args.CASES_PATHS = None
106 105
106 bbvars = get_bb_vars()
107 logdir = os.environ.get("BUILDDIR")
108 if 'LOG_DIR' in bbvars:
109 logdir = bbvars['LOG_DIR']
110 args.output_log = logdir + '/%s-results-%s.log' % (self.name, args.test_start_time)
111
107 super(OESelftestTestContextExecutor, self)._process_args(logger, args) 112 super(OESelftestTestContextExecutor, self)._process_args(logger, args)
108 113
109 if args.list_modules: 114 if args.list_modules:
@@ -113,7 +118,7 @@ class OESelftestTestContextExecutor(OETestContextExecutor):
113 elif args.list_tests: 118 elif args.list_tests:
114 args.list_tests = 'name' 119 args.list_tests = 'name'
115 120
116 self.tc_kwargs['init']['td'] = get_bb_vars() 121 self.tc_kwargs['init']['td'] = bbvars
117 self.tc_kwargs['init']['machines'] = self._get_available_machines() 122 self.tc_kwargs['init']['machines'] = self._get_available_machines()
118 123
119 builddir = os.environ.get("BUILDDIR") 124 builddir = os.environ.get("BUILDDIR")
@@ -303,7 +308,7 @@ class OESelftestTestContextExecutor(OETestContextExecutor):
303 308
304 output_link = os.path.join(os.path.dirname(args.output_log), 309 output_link = os.path.join(os.path.dirname(args.output_log),
305 "%s-results.log" % self.name) 310 "%s-results.log" % self.name)
306 if os.path.exists(output_link): 311 if os.path.lexists(output_link):
307 os.remove(output_link) 312 os.remove(output_link)
308 os.symlink(args.output_log, output_link) 313 os.symlink(args.output_log, output_link)
309 314