All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] oe-selftest improvements
@ 2020-06-03 20:07 Paul Barker
  2020-06-03 20:07 ` [PATCH 1/3] oe-selftest: Allow overriding the build directory used for tests Paul Barker
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Paul Barker @ 2020-06-03 20:07 UTC (permalink / raw)
  To: openembedded-core; +Cc: Paul Barker

These patches add some extra options to oe-selftest and fix the test
case patching logic discussed with RP on IRC.

The last patch may fix [1] but further confirmation is needed.

[1]: https://bugzilla.yoctoproject.org/show_bug.cgi?id=13815 

Paul Barker (3):
  oe-selftest: Allow overriding the build directory used for tests
  oe-selftest: Support verbose log output
  oe-selftest: Recursively patch test case paths

 meta/lib/oeqa/core/context.py     |  2 ++
 meta/lib/oeqa/selftest/context.py | 25 +++++++++++++++++++++----
 2 files changed, 23 insertions(+), 4 deletions(-)

-- 
2.26.2


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/3] oe-selftest: Allow overriding the build directory used for tests
  2020-06-03 20:07 [PATCH 0/3] oe-selftest improvements Paul Barker
@ 2020-06-03 20:07 ` Paul Barker
  2020-06-03 20:07 ` [PATCH 2/3] oe-selftest: Support verbose log output Paul Barker
  2020-06-03 20:07 ` [PATCH 3/3] oe-selftest: Recursively patch test case paths Paul Barker
  2 siblings, 0 replies; 4+ messages in thread
From: Paul Barker @ 2020-06-03 20:07 UTC (permalink / raw)
  To: openembedded-core; +Cc: Paul Barker

This may be useful if the parent directory of the original builddir is
not writable, on a lower performance drive, etc.

Signed-off-by: Paul Barker <pbarker@konsulko.com>
---
 meta/lib/oeqa/selftest/context.py | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/meta/lib/oeqa/selftest/context.py b/meta/lib/oeqa/selftest/context.py
index 48ec5d419c..17f2a0cf6b 100644
--- a/meta/lib/oeqa/selftest/context.py
+++ b/meta/lib/oeqa/selftest/context.py
@@ -22,18 +22,22 @@ from oeqa.core.exception import OEQAPreRun, OEQATestNotFound
 from oeqa.utils.commands import runCmd, get_bb_vars, get_test_layer
 
 class OESelftestTestContext(OETestContext):
-    def __init__(self, td=None, logger=None, machines=None, config_paths=None):
+    def __init__(self, td=None, logger=None, machines=None, config_paths=None, newbuilddir=None):
         super(OESelftestTestContext, self).__init__(td, logger)
 
         self.machines = machines
         self.custommachine = None
         self.config_paths = config_paths
+        self.newbuilddir = newbuilddir
 
     def setup_builddir(self, suffix, selftestdir, suite):
         builddir = os.environ['BUILDDIR']
         if not selftestdir:
             selftestdir = get_test_layer()
-        newbuilddir = builddir + suffix
+        if self.newbuilddir:
+            newbuilddir = os.path.join(self.newbuilddir, 'build' + suffix)
+        else:
+            newbuilddir = builddir + suffix
         newselftestdir = newbuilddir + "/meta-selftest"
 
         if os.path.exists(newbuilddir):
@@ -133,6 +137,7 @@ class OESelftestTestContextExecutor(OETestContextExecutor):
                 action='append', default=None,
                 help='Exclude all (unhidden) tests that match any of the specified tag(s). (exclude applies before select)')
 
+        parser.add_argument('-B', '--newbuilddir', help='New build directory to use for tests.')
         parser.set_defaults(func=self.run)
 
     def _get_available_machines(self):
@@ -187,6 +192,7 @@ class OESelftestTestContextExecutor(OETestContextExecutor):
         self.tc_kwargs['init']['config_paths']['builddir'] = builddir
         self.tc_kwargs['init']['config_paths']['localconf'] = os.path.join(builddir, "conf/local.conf")
         self.tc_kwargs['init']['config_paths']['bblayers'] = os.path.join(builddir, "conf/bblayers.conf")
+        self.tc_kwargs['init']['newbuilddir'] = args.newbuilddir
 
         def tag_filter(tags):
             if args.exclude_tags:
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/3] oe-selftest: Support verbose log output
  2020-06-03 20:07 [PATCH 0/3] oe-selftest improvements Paul Barker
  2020-06-03 20:07 ` [PATCH 1/3] oe-selftest: Allow overriding the build directory used for tests Paul Barker
@ 2020-06-03 20:07 ` Paul Barker
  2020-06-03 20:07 ` [PATCH 3/3] oe-selftest: Recursively patch test case paths Paul Barker
  2 siblings, 0 replies; 4+ messages in thread
From: Paul Barker @ 2020-06-03 20:07 UTC (permalink / raw)
  To: openembedded-core; +Cc: Paul Barker

Signed-off-by: Paul Barker <pbarker@konsulko.com>
---
 meta/lib/oeqa/core/context.py     | 2 ++
 meta/lib/oeqa/selftest/context.py | 1 +
 2 files changed, 3 insertions(+)

diff --git a/meta/lib/oeqa/core/context.py b/meta/lib/oeqa/core/context.py
index 4705d608ac..7d3fa3b84a 100644
--- a/meta/lib/oeqa/core/context.py
+++ b/meta/lib/oeqa/core/context.py
@@ -156,6 +156,8 @@ class OETestContextExecutor(object):
         fh = logging.FileHandler(args.output_log)
         fh.setFormatter(formatter)
         logger.addHandler(fh)
+        if getattr(args, 'verbose', False):
+            logger.setLevel('DEBUG')
 
         return logger
 
diff --git a/meta/lib/oeqa/selftest/context.py b/meta/lib/oeqa/selftest/context.py
index 17f2a0cf6b..7589ca3c1f 100644
--- a/meta/lib/oeqa/selftest/context.py
+++ b/meta/lib/oeqa/selftest/context.py
@@ -138,6 +138,7 @@ class OESelftestTestContextExecutor(OETestContextExecutor):
                 help='Exclude all (unhidden) tests that match any of the specified tag(s). (exclude applies before select)')
 
         parser.add_argument('-B', '--newbuilddir', help='New build directory to use for tests.')
+        parser.add_argument('-v', '--verbose', action='store_true')
         parser.set_defaults(func=self.run)
 
     def _get_available_machines(self):
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 3/3] oe-selftest: Recursively patch test case paths
  2020-06-03 20:07 [PATCH 0/3] oe-selftest improvements Paul Barker
  2020-06-03 20:07 ` [PATCH 1/3] oe-selftest: Allow overriding the build directory used for tests Paul Barker
  2020-06-03 20:07 ` [PATCH 2/3] oe-selftest: Support verbose log output Paul Barker
@ 2020-06-03 20:07 ` Paul Barker
  2 siblings, 0 replies; 4+ messages in thread
From: Paul Barker @ 2020-06-03 20:07 UTC (permalink / raw)
  To: openembedded-core; +Cc: Paul Barker

This ensures that builddir is updated correctly to point to the new
selftest build directory when we're given a list of test suites instead
of a list of test cases.

Signed-off-by: Paul Barker <pbarker@konsulko.com>
---
 meta/lib/oeqa/selftest/context.py | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/meta/lib/oeqa/selftest/context.py b/meta/lib/oeqa/selftest/context.py
index 7589ca3c1f..494e9dbd1e 100644
--- a/meta/lib/oeqa/selftest/context.py
+++ b/meta/lib/oeqa/selftest/context.py
@@ -10,6 +10,7 @@ import glob
 import sys
 import importlib
 import subprocess
+import unittest
 from random import choice
 
 import oeqa
@@ -60,9 +61,9 @@ class OESelftestTestContext(OETestContext):
 
         os.chdir(newbuilddir)
 
-        for t in suite:
+        def patch_test(t):
             if not hasattr(t, "tc"):
-                continue
+                return
             cp = t.tc.config_paths
             for p in cp:
                 if selftestdir in cp[p] and newselftestdir not in cp[p]:
@@ -70,6 +71,15 @@ class OESelftestTestContext(OETestContext):
                 if builddir in cp[p] and newbuilddir not in cp[p]:
                     cp[p] = cp[p].replace(builddir, newbuilddir)
 
+        def patch_suite(s):
+            for x in s:
+                if isinstance(x, unittest.TestSuite):
+                    patch_suite(x)
+                else:
+                    patch_test(x)
+
+        patch_suite(suite)
+
         return (builddir, newbuilddir)
 
     def prepareSuite(self, suites, processes):
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-06-03 20:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-03 20:07 [PATCH 0/3] oe-selftest improvements Paul Barker
2020-06-03 20:07 ` [PATCH 1/3] oe-selftest: Allow overriding the build directory used for tests Paul Barker
2020-06-03 20:07 ` [PATCH 2/3] oe-selftest: Support verbose log output Paul Barker
2020-06-03 20:07 ` [PATCH 3/3] oe-selftest: Recursively patch test case paths Paul Barker

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.