blob: e812708ab8f498a6a5df2346eaef56b712524593 [file] [log] [blame]
# Copyright lowRISC contributors.
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
# All tests added to this dictionary will result in build targets that have
# names starting `sw/device/tests/<test_name>`. They will not contain the
# subdirectory name, because the build targets are really declared at the bottom
# of this file, rather than in the subdirectories.
sw_tests = {
# 'test_name': test_lib,
}
subdir('dif')
subdir('sim_dv')
aes_test_lib = declare_dependency(
link_with: static_library(
'aes_test_lib',
sources: ['aes_test.c'],
dependencies: [
sw_lib_aes,
sw_lib_base_log,
],
),
)
flash_ctrl_test_lib = declare_dependency(
link_with: static_library(
'flash_ctrl_test_lib',
sources: ['flash_ctrl_test.c'],
dependencies: [
sw_lib_mem,
sw_lib_mmio,
sw_lib_flash_ctrl,
sw_lib_base_log,
],
),
)
sha256_test_lib = declare_dependency(
link_with: static_library(
'sha256_test_lib',
sources: ['sha256_test.c'],
dependencies: [
sw_lib_hmac,
sw_lib_flash_ctrl,
sw_lib_base_log,
],
),
)
usbdev_test_lib = declare_dependency(
link_with: static_library(
'usbdev_test_lib',
sources: ['usbdev_test.c'],
dependencies: [
sw_lib_usb,
sw_lib_base_log,
],
),
)
sw_tests += {
'aes_test': aes_test_lib,
'flash_ctrl_test': flash_ctrl_test_lib,
'sha256_test': sha256_test_lib,
'usbdev_test': usbdev_test_lib,
}
foreach sw_test_name, sw_test_lib : sw_tests
foreach device_name, device_lib : sw_lib_arch_core_devices
sw_test_elf = executable(
sw_test_name + '_' + device_name,
name_suffix: 'elf',
dependencies: [
riscv_crt,
device_lib,
sw_test_lib,
sw_lib_irq_handlers,
sw_lib_testing_test_main,
],
)
sw_test_embedded = custom_target(
sw_test_name + '_' + device_name,
command: make_embedded_target,
input: sw_test_elf,
output: make_embedded_target_outputs,
build_by_default: true,
)
custom_target(
sw_test_name + '_export_' + device_name,
command: export_embedded_target,
input: [sw_test_elf, sw_test_embedded],
output: sw_test_name + '_export_' + device_name,
build_always_stale: true,
build_by_default: true,
)
endforeach
endforeach
foreach device_name, device_lib : sw_lib_arch_core_devices
crt_test_elf = executable(
'crt_test_' + device_name,
name_suffix: 'elf',
sources: ['crt_test.c'],
dependencies: [
riscv_crt,
device_lib,
sw_lib_irq_handlers,
sw_lib_testing_test_status,
# Explicitly do not pull in the test main; we need to run right after
# the CRT is done executing.
# sw_lib_testing_test_main,
],
)
crt_test_embedded = custom_target(
'crt_test_' + device_name,
command: make_embedded_target,
input: crt_test_elf,
output: make_embedded_target_outputs,
build_by_default: true,
)
custom_target(
'crt_test_export_' + device_name,
command: export_embedded_target,
input: [crt_test_elf, crt_test_embedded],
output: 'crt_test_export_' + device_name,
build_always_stale: true,
build_by_default: true,
)
endforeach