From e8d4831bd75804cc63c679204719dcd163c2637d Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 7 Apr 2021 16:53:23 +1200 Subject: zephyr: zmake: Reset the multiproc module before use At present the logging map from one test can still be around for a following tests. This can cause strange behaviour. Add a reset() function to help with this. Call it from the Zmake constructor which is used by any test which cares about this. BUG=b:177096315 BRANCH=none TEST=with other CLs, see that the tests pass when all run together Signed-off-by: Simon Glass Change-Id: I0bf112e705c6badd3958a0afba8a3761e95fa547 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2809780 Reviewed-by: Yuval Peress --- zephyr/zmake/zmake/multiproc.py | 7 +++++++ zephyr/zmake/zmake/zmake.py | 1 + 2 files changed, 8 insertions(+) diff --git a/zephyr/zmake/zmake/multiproc.py b/zephyr/zmake/zmake/multiproc.py index 68fc086e69..966d90c567 100644 --- a/zephyr/zmake/zmake/multiproc.py +++ b/zephyr/zmake/zmake/multiproc.py @@ -24,6 +24,13 @@ _logging_cv = threading.Condition() _logging_map = {} +def reset(): + """Reset this module to its starting state (useful for tests)""" + global _logging_map + + _logging_map = {} + + class LogWriter: """Contains information about a file descriptor that is producing output diff --git a/zephyr/zmake/zmake/zmake.py b/zephyr/zmake/zmake/zmake.py index 120f1aeaeb..0b1a57866c 100644 --- a/zephyr/zmake/zmake/zmake.py +++ b/zephyr/zmake/zmake/zmake.py @@ -126,6 +126,7 @@ class Zmake: """ def __init__(self, checkout=None, jobserver=None, jobs=0, modules_dir=None, zephyr_base=None): + zmake.multiproc.reset() self._checkout = checkout self._zephyr_base = zephyr_base -- cgit v1.2.1