Lines Matching defs:test
3 * KUnit resource API for test managed resources (allocations, etc.).
10 #include <kunit/test.h>
19 int __kunit_add_resource(struct kunit *test,
39 spin_lock_irqsave(&test->lock, flags);
40 list_add_tail(&res->node, &test->resources);
42 spin_unlock_irqrestore(&test->lock, flags);
48 void kunit_remove_resource(struct kunit *test, struct kunit_resource *res)
53 spin_lock_irqsave(&test->lock, flags);
56 spin_unlock_irqrestore(&test->lock, flags);
63 int kunit_destroy_resource(struct kunit *test, kunit_resource_match_t match,
66 struct kunit_resource *res = kunit_find_resource(test, match,
72 kunit_remove_resource(test, res);
95 int kunit_add_action(struct kunit *test, void (*action)(void *), void *ctx)
99 KUNIT_ASSERT_NOT_NULL_MSG(test, action, "Tried to action a NULL function!");
110 __kunit_add_resource(test, NULL, __kunit_action_free, &action_ctx->res, action_ctx);
116 int kunit_add_action_or_reset(struct kunit *test, void (*action)(void *),
119 int res = kunit_add_action(test, action, ctx);
127 static bool __kunit_action_match(struct kunit *test,
141 void kunit_remove_action(struct kunit *test,
151 res = kunit_find_resource(test, __kunit_action_match, &match_ctx);
155 kunit_remove_resource(test, res);
161 void kunit_release_action(struct kunit *test,
171 res = kunit_find_resource(test, __kunit_action_match, &match_ctx);
173 kunit_remove_resource(test, res);