summaryrefslogtreecommitdiff
path: root/rust/kernel
diff options
context:
space:
mode:
authorMarie Zhussupova <marievic@google.com>2025-08-26 17:13:31 +0800
committerShuah Khan <skhan@linuxfoundation.org>2025-08-26 23:36:03 -0600
commit4b59300ba4d2362b02c2a9077047bbabceea67d7 (patch)
treeb268c071b5b25b37f084e0583ed797fd07c1a8cc /rust/kernel
parent922d1dde441ad1060bc1ec005fd792774a274999 (diff)
kunit: Add parent kunit for parameterized test context
Currently, KUnit parameterized tests lack a mechanism to share resources across parameter runs because the same `struct kunit` instance is cleaned up and reused for each run. This patch introduces parameterized test context, enabling test users to share resources between parameter runs. It also allows setting up resources that need to be available for all parameter runs only once, which is helpful in cases where setup is expensive. To establish a parameterized test context, this patch adds a parent pointer field to `struct kunit`. This allows resources added to the parent `struct kunit` to be shared and accessible across all parameter runs. In kunit_run_tests(), the default `struct kunit` created is now designated to act as the parameterized test context whenever a test is parameterized. Subsequently, a new `struct kunit` is made for each parameter run, and its parent pointer is set to the `struct kunit` that holds the parameterized test context. Link: https://lore.kernel.org/r/20250826091341.1427123-2-davidgow@google.com Reviewed-by: David Gow <davidgow@google.com> Reviewed-by: Rae Moar <rmoar@google.com> Signed-off-by: Marie Zhussupova <marievic@google.com> Signed-off-by: David Gow <davidgow@google.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Diffstat (limited to 'rust/kernel')
0 files changed, 0 insertions, 0 deletions