mirror of
https://github.com/hardkernel/linux.git
synced 2026-03-26 12:30:23 +09:00
ANDROID: Add kunit targets.
The kunit targets build in-tree kunit modules with a pre-set defconfig fragment. This is the defconfig fragment to be applied to enable kunit tests as modules. Because we apply defconfig fragments after running make defconfig, the individual tests must be enabled instead of a global CONFIG_KUNIT_ALL_TESTS flag. Note: Comparing to the change on android-mainline, this change deletes the following tests because they do not present in android14-5.15: CONFIG_NETDEV_ADDR_LIST_TEST CONFIG_REGMAP_KUNIT CONFIG_INPUT_KUNIT_TEST CONFIG_SND_SOC_UTILS_KUNIT_TEST CONFIG_HID_KUNIT_TEST CONFIG_IIO_FORMAT_KUNIT_TEST CONFIG_CLK_KUNIT_TEST CONFIG_CLK_GATE_KUNIT_TEST Comparing to the change on android-mainline, this change adds a symbol list for kunit tests. To update this symbol list: bazel run //common:kunit_aarch64_abi_update_symbol_list Comparing to the change on android-mainline, this change does not contain a target for riscv64. Test: manually build with bazel run //common:kunit_aarch64_dist bazel run //common:kunit_x86_64_dist bazel run //common:kunit_riscv64_dist Bug: 296116800 Bug: 304616548 Bug: 305290382 Change-Id: If3b94f495aa64b657508781b12e3e0716c725f3f Signed-off-by: Yifan Hong <elsk@google.com>
This commit is contained in:
65
BUILD.bazel
65
BUILD.bazel
@@ -96,6 +96,7 @@ filegroup(
|
||||
"android/abi_gki_aarch64_db845c",
|
||||
"android/abi_gki_aarch64_exynos",
|
||||
"android/abi_gki_aarch64_fips140",
|
||||
"android/abi_gki_aarch64_kunit",
|
||||
"android/abi_gki_aarch64_lenovo",
|
||||
"android/abi_gki_aarch64_mtkott",
|
||||
"android/abi_gki_aarch64_mtktv",
|
||||
@@ -614,6 +615,70 @@ kernel_build(
|
||||
visibility = ["//visibility:private"],
|
||||
)
|
||||
|
||||
# KUnit test targets
|
||||
|
||||
# Modules defined by tools/testing/kunit/configs/android/kunit_defconfig
|
||||
_KUNIT_COMMON_MODULES = [
|
||||
# keep sorted
|
||||
"drivers/rtc/lib_test.ko",
|
||||
"fs/ext4/ext4-inode-test.ko",
|
||||
"fs/fat/fat_test.ko",
|
||||
"kernel/time/time_test.ko",
|
||||
"lib/kunit/kunit-example-test.ko",
|
||||
"lib/kunit/kunit-test.ko",
|
||||
"mm/kfence/kfence_test.ko",
|
||||
"sound/soc/soc-topology-test.ko",
|
||||
]
|
||||
|
||||
kernel_build(
|
||||
name = "kunit_aarch64",
|
||||
outs = [],
|
||||
arch = "arm64",
|
||||
base_kernel = ":kernel_aarch64",
|
||||
build_config = "build.config.kunit.aarch64",
|
||||
defconfig_fragments = [
|
||||
"tools/testing/kunit/configs/android/kunit_defconfig",
|
||||
],
|
||||
kmi_symbol_list = "android/abi_gki_aarch64_kunit",
|
||||
make_goals = ["modules"],
|
||||
module_outs = _KUNIT_COMMON_MODULES,
|
||||
)
|
||||
|
||||
copy_to_dist_dir(
|
||||
name = "kunit_aarch64_dist",
|
||||
data = [":kunit_aarch64"],
|
||||
dist_dir = "out/kunit_aarch64/dist",
|
||||
flat = True,
|
||||
log = "info",
|
||||
)
|
||||
|
||||
kernel_abi(
|
||||
name = "kunit_aarch64_abi",
|
||||
kernel_build = ":kunit_aarch64",
|
||||
kmi_symbol_list_add_only = True,
|
||||
)
|
||||
|
||||
kernel_build(
|
||||
name = "kunit_x86_64",
|
||||
outs = [],
|
||||
arch = "x86_64",
|
||||
base_kernel = ":kernel_x86_64",
|
||||
build_config = "build.config.kunit.x86_64",
|
||||
defconfig_fragments = [
|
||||
"tools/testing/kunit/configs/android/kunit_defconfig",
|
||||
],
|
||||
make_goals = ["modules"],
|
||||
module_outs = _KUNIT_COMMON_MODULES,
|
||||
)
|
||||
|
||||
copy_to_dist_dir(
|
||||
name = "kunit_x86_64_dist",
|
||||
data = [":kunit_x86_64"],
|
||||
dist_dir = "out/kunit_x86_64/dist",
|
||||
flat = True,
|
||||
log = "info",
|
||||
)
|
||||
|
||||
# DDK Headers
|
||||
# All headers. These are the public targets for DDK modules to use.
|
||||
alias(
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
94
android/abi_gki_aarch64_kunit
Normal file
94
android/abi_gki_aarch64_kunit
Normal file
@@ -0,0 +1,94 @@
|
||||
[abi_symbol_list]
|
||||
# commonly used symbols
|
||||
kfree
|
||||
kmalloc_caches
|
||||
kunit_binary_assert_format
|
||||
kunit_do_assertion
|
||||
kunit_fail_assert_format
|
||||
kunit_kmalloc_array
|
||||
kunit_log_append
|
||||
kunit_ptr_not_err_assert_format
|
||||
__kunit_test_suites_exit
|
||||
__kunit_test_suites_init
|
||||
kunit_try_catch_throw
|
||||
kunit_unary_assert_format
|
||||
memset
|
||||
module_layout
|
||||
_printk
|
||||
__put_task_struct
|
||||
_raw_spin_lock_irqsave
|
||||
_raw_spin_unlock_irqrestore
|
||||
scnprintf
|
||||
__stack_chk_fail
|
||||
strcmp
|
||||
strscpy
|
||||
__ubsan_handle_cfi_check_fail_abort
|
||||
|
||||
# required by fat_test.ko
|
||||
fat_time_fat2unix
|
||||
fat_time_unix2fat
|
||||
|
||||
# required by kfence_test.ko
|
||||
for_each_kernel_tracepoint
|
||||
jiffies
|
||||
kasan_flag_enabled
|
||||
__kfence_pool
|
||||
__kmalloc
|
||||
kmem_cache_alloc
|
||||
kmem_cache_alloc_bulk
|
||||
kmem_cache_create
|
||||
kmem_cache_destroy
|
||||
kmem_cache_free
|
||||
kmem_cache_free_bulk
|
||||
kmem_cache_shrink
|
||||
krealloc
|
||||
ksize
|
||||
prandom_u32
|
||||
rcu_barrier
|
||||
__rcu_read_lock
|
||||
__rcu_read_unlock
|
||||
strchr
|
||||
strnstr
|
||||
strstr
|
||||
synchronize_rcu
|
||||
synchronize_srcu
|
||||
tracepoint_probe_register
|
||||
tracepoint_probe_unregister
|
||||
tracepoint_srcu
|
||||
|
||||
# required by kunit-test.ko
|
||||
arm64_const_caps_ready
|
||||
__cfi_slowpath_diag
|
||||
cpu_hwcap_keys
|
||||
kmem_cache_alloc_trace
|
||||
kunit_add_named_resource
|
||||
kunit_add_resource
|
||||
kunit_alloc_and_get_resource
|
||||
kunit_binary_ptr_assert_format
|
||||
kunit_binary_str_assert_format
|
||||
kunit_cleanup
|
||||
kunit_destroy_resource
|
||||
kunit_init_test
|
||||
kunit_try_catch_run
|
||||
refcount_warn_saturate
|
||||
|
||||
# required by lib_test.ko
|
||||
rtc_month_days
|
||||
rtc_time64_to_tm
|
||||
|
||||
# required by soc-topology-test.ko
|
||||
get_device
|
||||
memcpy
|
||||
put_device
|
||||
__root_device_register
|
||||
root_device_unregister
|
||||
snd_soc_add_component
|
||||
snd_soc_component_initialize
|
||||
snd_soc_register_card
|
||||
snd_soc_tplg_component_load
|
||||
snd_soc_tplg_component_remove
|
||||
snd_soc_unregister_card
|
||||
snd_soc_unregister_component
|
||||
|
||||
# required by time_test.ko
|
||||
time64_to_tm
|
||||
4
build.config.kunit.aarch64
Normal file
4
build.config.kunit.aarch64
Normal file
@@ -0,0 +1,4 @@
|
||||
. ${ROOT_DIR}/${KERNEL_DIR}/build.config.common
|
||||
. ${ROOT_DIR}/${KERNEL_DIR}/build.config.aarch64
|
||||
|
||||
DEFCONFIG=gki_defconfig
|
||||
4
build.config.kunit.x86_64
Normal file
4
build.config.kunit.x86_64
Normal file
@@ -0,0 +1,4 @@
|
||||
. ${ROOT_DIR}/${KERNEL_DIR}/build.config.common
|
||||
. ${ROOT_DIR}/${KERNEL_DIR}/build.config.x86_64
|
||||
|
||||
DEFCONFIG=gki_defconfig
|
||||
31
tools/testing/kunit/configs/android/kunit_defconfig
Normal file
31
tools/testing/kunit/configs/android/kunit_defconfig
Normal file
@@ -0,0 +1,31 @@
|
||||
# Defconfig fragment for Android Kunit targets
|
||||
#
|
||||
# Instead of setting CONFIG_KUNIT_ALL_TESTS=m, we enable individual tests
|
||||
# because:
|
||||
# - The defconfig fragment is applied after make defconfig
|
||||
# - If additional tests are added to CONFIG_KUNIT_ALL_TESTS in the future,
|
||||
# //common:kunit_* module_outs needs to be updated.
|
||||
|
||||
# CONFIG_MODULE_SIG_ALL is not set
|
||||
|
||||
# Corresponds to BUILD.bazel, _KUNIT_COMMON_MODULES
|
||||
CONFIG_TIME_KUNIT_TEST=m
|
||||
CONFIG_SND_SOC_TOPOLOGY_KUNIT_TEST=m
|
||||
CONFIG_RTC_LIB_KUNIT_TEST=m
|
||||
CONFIG_EXT4_KUNIT_TESTS=m
|
||||
CONFIG_FAT_KUNIT_TEST=m
|
||||
CONFIG_KFENCE_KUNIT_TEST=m
|
||||
CONFIG_KUNIT_TEST=m
|
||||
CONFIG_KUNIT_EXAMPLE_TEST=m
|
||||
|
||||
# CONFIG_NET_HANDSHAKE is not enabled in gki_defconfig.
|
||||
# CONFIG_NET_HANDSHAKE_KUNIT_TEST=m
|
||||
|
||||
# TODO(b/296116800): Enable these tests
|
||||
# CONFIG_DRM_KUNIT_TEST=m
|
||||
# CONFIG_KASAN_KUNIT_TEST=m
|
||||
|
||||
# TODO(b/296116800): These are booleans, not tristates.
|
||||
# CONFIG_BINFMT_ELF_KUNIT_TEST=y
|
||||
# CONFIG_PM_QOS_KUNIT_TEST=y
|
||||
# CONFIG_DRIVER_PE_KUNIT_TEST=y
|
||||
Reference in New Issue
Block a user