Skip to content

Commit

Permalink
kunit: Clarify kunit_skip() argument name
Browse files Browse the repository at this point in the history
kunit_skip() and kunit_mark_skipped() can only be passed a pointer
to a struct kunit, not struct kunit_suite (only kunit_log() actually
supports both). Rename their first argument accordingly.

Link: https://lore.kernel.org/r/20250217140008.1941287-1-kevin.brodsky@arm.com
Signed-off-by: Kevin Brodsky <kevin.brodsky@arm.com>
Reviewed-by: David Gow <davidgow@google.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
  • Loading branch information
Kevin Brodsky authored and Shuah Khan committed Feb 18, 2025
1 parent 43ebec9 commit 0619a48
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions include/kunit/test.h
Original file line number Diff line number Diff line change
Expand Up @@ -553,39 +553,39 @@ void kunit_cleanup(struct kunit *test);
void __printf(2, 3) kunit_log_append(struct string_stream *log, const char *fmt, ...);

/**
* kunit_mark_skipped() - Marks @test_or_suite as skipped
* kunit_mark_skipped() - Marks @test as skipped
*
* @test_or_suite: The test context object.
* @test: The test context object.
* @fmt: A printk() style format string.
*
* Marks the test as skipped. @fmt is given output as the test status
* comment, typically the reason the test was skipped.
*
* Test execution continues after kunit_mark_skipped() is called.
*/
#define kunit_mark_skipped(test_or_suite, fmt, ...) \
#define kunit_mark_skipped(test, fmt, ...) \
do { \
WRITE_ONCE((test_or_suite)->status, KUNIT_SKIPPED); \
scnprintf((test_or_suite)->status_comment, \
WRITE_ONCE((test)->status, KUNIT_SKIPPED); \
scnprintf((test)->status_comment, \
KUNIT_STATUS_COMMENT_SIZE, \
fmt, ##__VA_ARGS__); \
} while (0)

/**
* kunit_skip() - Marks @test_or_suite as skipped
* kunit_skip() - Marks @test as skipped
*
* @test_or_suite: The test context object.
* @test: The test context object.
* @fmt: A printk() style format string.
*
* Skips the test. @fmt is given output as the test status
* comment, typically the reason the test was skipped.
*
* Test execution is halted after kunit_skip() is called.
*/
#define kunit_skip(test_or_suite, fmt, ...) \
#define kunit_skip(test, fmt, ...) \
do { \
kunit_mark_skipped((test_or_suite), fmt, ##__VA_ARGS__);\
kunit_try_catch_throw(&((test_or_suite)->try_catch)); \
kunit_mark_skipped((test), fmt, ##__VA_ARGS__); \
kunit_try_catch_throw(&((test)->try_catch)); \
} while (0)

/*
Expand Down

0 comments on commit 0619a48

Please sign in to comment.