linux-stable/include/kunit
Rae Moar cfce1e26b4 kunit: add macro to allow conditionally exposing static symbols to tests
[ Upstream commit 9c988fae6f ]

Create two macros:

VISIBLE_IF_KUNIT - A macro that sets symbols to be static if CONFIG_KUNIT
is not enabled. Otherwise if CONFIG_KUNIT is enabled there is no change to
the symbol definition.

EXPORT_SYMBOL_IF_KUNIT(symbol) - Exports symbol into
EXPORTED_FOR_KUNIT_TESTING namespace only if CONFIG_KUNIT is enabled. Must
use MODULE_IMPORT_NS(EXPORTED_FOR_KUNIT_TESTING) in test file in order to
use symbols.

Signed-off-by: Rae Moar <rmoar@google.com>
Reviewed-by: John Johansen <john.johansen@canonical.com>
Reviewed-by: David Gow <davidgow@google.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Stable-dep-of: 8884ba0778 ("apparmor: fix invalid reference on profile->disconnected")
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-11-20 11:52:08 +01:00
..
assert.h kunit: remove format func from struct kunit_assert, get it to 0 bytes 2022-10-07 10:16:38 -06:00
resource.h kunit: make kunit_kfree() only work on pointers from kunit_malloc() and friends 2022-10-07 10:15:44 -06:00
test-bug.h kunit: fix -Wunused-function warning for __kunit_fail_current_test 2021-04-06 15:22:39 -06:00
test.h kunit: fix kunit_test_init_section_suites(...) 2023-02-09 11:28:08 +01:00
try-catch.h kunit: hide unexported try-catch interface in try-catch-impl.h 2020-01-09 16:42:09 -07:00
visibility.h kunit: add macro to allow conditionally exposing static symbols to tests 2023-11-20 11:52:08 +01:00