diff options
author | Ross Burton <ross@burtonini.com> | 2022-03-25 12:29:10 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-03-26 09:33:28 +0000 |
commit | e478381ac1cccc5f882198fd11c8757db7e3741a (patch) | |
tree | 79757608ff3c9ff12f1652ad0509c3ab8e74a9a0 | |
parent | 96eac366b7b2ba3a826227f9bfe2c1bedea6943e (diff) | |
download | openembedded-core-e478381ac1cccc5f882198fd11c8757db7e3741a.tar.gz |
oeqa/runtime/context: remove duplicate sys.path entries when looking for modules
sys.path can contain duplicate entries for each layer, which means that
the search in add_controller_list() will find the same name twice and
abort.
As duplicate directories should be harmless, remove any duplicates before
iterating through the entries.
Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-rw-r--r-- | meta/lib/oeqa/runtime/context.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/meta/lib/oeqa/runtime/context.py b/meta/lib/oeqa/runtime/context.py index d707ab263a..8092dd0bae 100644 --- a/meta/lib/oeqa/runtime/context.py +++ b/meta/lib/oeqa/runtime/context.py @@ -153,7 +153,11 @@ class OERuntimeTestContextExecutor(OETestContextExecutor): else: raise RuntimeError("Duplicate controller module found for %s. Layers should create unique controller module names" % module) - for p in sys.path: + # sys.path can contain duplicate paths, but because of the login in + # add_controller_list this doesn't work and causes testimage to abort. + # Remove duplicates using an intermediate dictionary to ensure this + # doesn't happen. + for p in list(dict.fromkeys(sys.path)): controllerpath = os.path.join(p, 'oeqa', 'controllers') if os.path.exists(controllerpath): add_controller_list(controllerpath) |