]> code.ossystems Code Review - openembedded-core.git/commitdiff
oe-selftest: Recursively patch test case paths
authorPaul Barker <pbarker@konsulko.com>
Wed, 3 Jun 2020 20:07:38 +0000 (21:07 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 4 Jun 2020 12:21:01 +0000 (13:21 +0100)
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>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/lib/oeqa/selftest/context.py

index 7589ca3c1fd1545269ff5a2ed000d453f2fb848e..494e9dbd1ec8f569f35e7407bb6c996a636c10e8 100644 (file)
@@ -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):