Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup simulation-based testing flow #21

Merged
merged 6 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 24 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,28 @@ add_subdirectory(drivers)
################################################################################
# Testing #
################################################################################
enable_testing()
option(TEST_MODE "Set what validation target the tests should be run on" "OFF")
set(SIMULATION_BINARY "chim.bin" CACHE STRING "Path to the simulation binary")
set(PRELOAD_MODE "0" CACHE STRING "Preload mode for simulation")

add_subdirectory(tests)
if (TEST_MODE STREQUAL "simulation")
Xeratec marked this conversation as resolved.
Show resolved Hide resolved
enable_testing()

if(NOT EXISTS ${SIMULATION_BINARY})
message(FATAL_ERROR "Simulation binary ${SIMULATION_BINARY} does not exist.")
endif()

# Convert PRELOAD_MODE to integer
if ("${PRELOAD_MODE}" MATCHES "^[0-9]+$")
set(PRELOAD_MODE_INT ${PRELOAD_MODE})
else()
message(FATAL_ERROR "PRELOAD_MODE must be an integer.")
endif()

message(STATUS "[CHIMERA-SDK] Simulation Binary : ${SIMULATION_BINARY}")
Xeratec marked this conversation as resolved.
Show resolved Hide resolved
message(STATUS "[CHIMERA-SDK] Preload Mode : ${PRELOAD_MODE}")

add_subdirectory(tests)
Xeratec marked this conversation as resolved.
Show resolved Hide resolved
else()
message(STATUS "[CHIMERA-SDK] Tests are not included for TEST_MODE: ${TEST_MODE}")
Xeratec marked this conversation as resolved.
Show resolved Hide resolved
endif()
2 changes: 1 addition & 1 deletion cmake/Utils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ endmacro()
## TODO: Add vsim target or some such
macro(add_chimera_test name)
add_chimera_executable(${ARGV})
add_test(NAME ${name} COMMAND ${name})
add_test(NAME ${name} COMMAND ${SIMULATION_BINARY} +BINARY=$<TARGET_FILE:${name}> +PRELMODE=${PRELOAD_MODE_INT})
Xeratec marked this conversation as resolved.
Show resolved Hide resolved
endmacro()

macro(add_target_source name)
Expand Down
Loading