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:32 +0000 |
commit | 596fcd883f7340a06d083597abf5d1873c695b7c (patch) | |
tree | 0d593802629b9578a32da84772ed167c8adcb33a /meta/lib | |
parent | 02b01be41f06ee87caec8fec2f1c69423caab70c (diff) | |
download | poky-596fcd883f7340a06d083597abf5d1873c695b7c.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.
(From OE-Core rev: e478381ac1cccc5f882198fd11c8757db7e3741a)
Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-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): | |||
153 | else: | 153 | else: |
154 | raise RuntimeError("Duplicate controller module found for %s. Layers should create unique controller module names" % module) | 154 | raise RuntimeError("Duplicate controller module found for %s. Layers should create unique controller module names" % module) |
155 | 155 | ||
156 | for p in sys.path: | 156 | # sys.path can contain duplicate paths, but because of the login in |
157 | # add_controller_list this doesn't work and causes testimage to abort. | ||
158 | # Remove duplicates using an intermediate dictionary to ensure this | ||
159 | # doesn't happen. | ||
160 | for p in list(dict.fromkeys(sys.path)): | ||
157 | controllerpath = os.path.join(p, 'oeqa', 'controllers') | 161 | controllerpath = os.path.join(p, 'oeqa', 'controllers') |
158 | if os.path.exists(controllerpath): | 162 | if os.path.exists(controllerpath): |
159 | add_controller_list(controllerpath) | 163 | add_controller_list(controllerpath) |