[Lldb-commits] [lldb] [lldb][test] Don't overwrite existing decorators in _skipForVariant (PR #197409)
Raphael Isemann via lldb-commits
lldb-commits at lists.llvm.org
Thu May 14 00:25:22 PDT 2026
https://github.com/Teemperor updated https://github.com/llvm/llvm-project/pull/197409
>From 1bb067fb439e38ab2ce4150022617b00d1fe199f Mon Sep 17 00:00:00 2001
From: Raphael Isemann <rise at apple.com>
Date: Wed, 13 May 2026 10:40:06 +0100
Subject: [PATCH] [lldb][test] Don't overwrite existing decorators in
_skipForVariant
_skipForVariant uses a dictionary to save the decorator functions
for specific variants. However, if the dictionary already contains
a decorator function, then that decorator is overwritten in the current
implementation.
This means that if we have two decorators that skip a variant in
combination with another check, then the second decorator overwrites
the first one and is effectively ignored.
Downstream we are hit by this because we have an embedded Swift variant.
If we skip this variant for both Linux and Windows, then depending
on the decorator order we still run the test on one of those two
platforms (as one decorator is overwritten by the other).
---
lldb/packages/Python/lldbsuite/test/decorators.py | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/lldb/packages/Python/lldbsuite/test/decorators.py b/lldb/packages/Python/lldbsuite/test/decorators.py
index f94ef736fdc01..e0567e99e16b7 100644
--- a/lldb/packages/Python/lldbsuite/test/decorators.py
+++ b/lldb/packages/Python/lldbsuite/test/decorators.py
@@ -222,7 +222,18 @@ def skipImpl(func):
if isinstance(func, type) and issubclass(func, unittest.TestCase):
raise Exception("Decorator can only be used to decorate a test method")
skip_dict = getattr(func, "__variant_skip__", {})
- skip_dict[variant_name] = expected_fn
+ existing_fn = skip_dict.get(variant_name)
+ if existing_fn:
+ # Chain the decorator with the existing one.
+ def chained_fn(**kwargs):
+ reason = expected_fn(**kwargs)
+ if reason:
+ return reason
+ return existing_fn(**kwargs)
+
+ skip_dict[variant_name] = chained_fn
+ else:
+ skip_dict[variant_name] = expected_fn
func.__variant_skip__ = skip_dict
return func
More information about the lldb-commits
mailing list