From 6d7fc2624fc195f7dc27b81d294746613c756c11 Mon Sep 17 00:00:00 2001 From: Paul Barker Date: Wed, 3 Jun 2020 21:07:38 +0100 Subject: oe-selftest: Recursively patch test case paths 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. (From OE-Core rev: 6812affe76ee2704a8008d58ffc6a2e87b543f1d) Signed-off-by: Paul Barker Signed-off-by: Richard Purdie (cherry picked from commit 56e211d0f3c6cb84f5982e5de00faeeed69c1912) Signed-off-by: Steve Sakoman Signed-off-by: Richard Purdie --- meta/lib/oeqa/selftest/context.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'meta/lib') diff --git a/meta/lib/oeqa/selftest/context.py b/meta/lib/oeqa/selftest/context.py index 17f2a0cf6b..ba13732253 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): -- cgit v1.2.3-54-g00ecf