Skip to content

Commit d055c6a

Browse files
rmr167shuahkh
authored andcommitted
kunit: memcpy: Mark tests as slow using test attributes
Mark slow memcpy KUnit tests using test attributes. Tests marked as slow are as follows: memcpy_large_test, memmove_test, memmove_large_test, and memmove_overlap_test. These tests were the slowest of the memcpy tests and relatively slower to most other KUnit tests. Most of these tests are already skipped when CONFIG_MEMCPY_SLOW_KUNIT_TEST is not enabled. These tests can now be filtered using the KUnit test attribute filtering feature. Example: --filter "speed>slow". This will run only the tests that have speeds faster than slow. The slow attribute will also be outputted in KTAP. Note: This patch is intended to replace the use of CONFIG_MEMCPY_SLOW_KUNIT_TEST and to potentially deprecate this feature. This patch does not remove the config option but does add a note to the config definition commenting on this future shift. Reviewed-by: David Gow <[email protected]> Acked-by: Kees Cook <[email protected]> Signed-off-by: Rae Moar <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
1 parent 723c825 commit d055c6a

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

lib/Kconfig.debug

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2701,6 +2701,9 @@ config MEMCPY_SLOW_KUNIT_TEST
27012701
and bit ranges. These can be very slow, so they are split out
27022702
as a separate config, in case they need to be disabled.
27032703

2704+
Note this config option will be replaced by the use of KUnit test
2705+
attributes.
2706+
27042707
config IS_SIGNED_TYPE_KUNIT_TEST
27052708
tristate "Test is_signed_type() macro" if !KUNIT_ALL_TESTS
27062709
depends on KUNIT

lib/memcpy_kunit.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -551,10 +551,10 @@ static void strtomem_test(struct kunit *test)
551551
static struct kunit_case memcpy_test_cases[] = {
552552
KUNIT_CASE(memset_test),
553553
KUNIT_CASE(memcpy_test),
554-
KUNIT_CASE(memcpy_large_test),
555-
KUNIT_CASE(memmove_test),
556-
KUNIT_CASE(memmove_large_test),
557-
KUNIT_CASE(memmove_overlap_test),
554+
KUNIT_CASE_SLOW(memcpy_large_test),
555+
KUNIT_CASE_SLOW(memmove_test),
556+
KUNIT_CASE_SLOW(memmove_large_test),
557+
KUNIT_CASE_SLOW(memmove_overlap_test),
558558
KUNIT_CASE(strtomem_test),
559559
{}
560560
};

0 commit comments

Comments
 (0)