summaryrefslogtreecommitdiffstats
path: root/meta
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:27 +0000
commitfa12ad627b49290c1a03f089983093ebcdef000b (patch)
treefacbb372b4e91f4a517734f217cc192968930b52 /meta
parentc7a841625dfe5da43e9bdfe9b47ab647c1164e90 (diff)
downloadpoky-fa12ad627b49290c1a03f089983093ebcdef000b.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: 9c4c3c876dd5d224133571fcad1095af1098ae1d) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/lib/oeqa/selftest/context.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/meta/lib/oeqa/selftest/context.py b/meta/lib/oeqa/selftest/context.py
index cac049f8cb..33316d3179 100644
--- a/meta/lib/oeqa/selftest/context.py
+++ b/meta/lib/oeqa/selftest/context.py
@@ -96,11 +96,17 @@ class OESelftestTestContextExecutor(OETestContextExecutor):
96 return cases_paths 96 return cases_paths
97 97
98 def _process_args(self, logger, args): 98 def _process_args(self, logger, args):
99 args.output_log = '%s-results-%s.log' % (self.name, 99
100 time.strftime("%Y%m%d%H%M%S")) 100 args.test_start_time = time.strftime("%Y%m%d%H%M%S")
101 args.test_data_file = None 101 args.test_data_file = None
102 args.CASES_PATHS = None 102 args.CASES_PATHS = None
103 103
104 bbvars = get_bb_vars()
105 logdir = os.environ.get("BUILDDIR")
106 if 'LOG_DIR' in bbvars:
107 logdir = bbvars['LOG_DIR']
108 args.output_log = logdir + '/%s-results-%s.log' % (self.name, args.test_start_time)
109
104 super(OESelftestTestContextExecutor, self)._process_args(logger, args) 110 super(OESelftestTestContextExecutor, self)._process_args(logger, args)
105 111
106 if args.list_modules: 112 if args.list_modules:
@@ -110,7 +116,7 @@ class OESelftestTestContextExecutor(OETestContextExecutor):
110 elif args.list_tests: 116 elif args.list_tests:
111 args.list_tests = 'name' 117 args.list_tests = 'name'
112 118
113 self.tc_kwargs['init']['td'] = get_bb_vars() 119 self.tc_kwargs['init']['td'] = bbvars
114 self.tc_kwargs['init']['machines'] = self._get_available_machines() 120 self.tc_kwargs['init']['machines'] = self._get_available_machines()
115 121
116 builddir = os.environ.get("BUILDDIR") 122 builddir = os.environ.get("BUILDDIR")
@@ -270,7 +276,7 @@ class OESelftestTestContextExecutor(OETestContextExecutor):
270 276
271 output_link = os.path.join(os.path.dirname(args.output_log), 277 output_link = os.path.join(os.path.dirname(args.output_log),
272 "%s-results.log" % self.name) 278 "%s-results.log" % self.name)
273 if os.path.exists(output_link): 279 if os.path.lexists(output_link):
274 os.remove(output_link) 280 os.remove(output_link)
275 os.symlink(args.output_log, output_link) 281 os.symlink(args.output_log, output_link)
276 282