Compute test name from source file

This commit is contained in:
Rodrigo Arias 2022-08-25 19:30:44 +02:00
parent 7c6beb091a
commit 6551ba80b1
26 changed files with 32 additions and 32 deletions

View File

@ -19,7 +19,7 @@ set(OVNI_TEST_BUILD_DIR "${CMAKE_BINARY_DIR}/test")
include(macros.cmake)
add_subdirectory(manual)
add_subdirectory(emu)
if(ENABLE_TEST_RT)
add_subdirectory(rt)

View File

@ -14,11 +14,11 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
ovni_test(NAME nanos6-nested-tasks)
ovni_test(NAME nanos6-nested-tasks-bad SHOULD_FAIL
ovni_test(nested-tasks.c)
ovni_test(nested-tasks-bad.c SHOULD_FAIL
REGEX "fatal: cannot execute task 1: state is not created")
ovni_test(NAME nanos6-task-types MP)
ovni_test(NAME nanos6-blocking MP)
ovni_test(NAME nanos6-subsystems MP)
ovni_test(NAME nanos6-ss-mismatch SHOULD_FAIL
ovni_test(task-types.c MP)
ovni_test(blocking.c MP)
ovni_test(subsystems.c MP)
ovni_test(ss-mismatch.c SHOULD_FAIL
REGEX "thread [0-9]\\+ ended with 1 extra stacked nanos6 subsystems, top=ST_NANOS6_SCHED_HUNGRY")

View File

@ -14,8 +14,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
ovni_test(NAME nosv-nested-tasks)
ovni_test(NAME nosv-nested-tasks-bad SHOULD_FAIL
ovni_test(nested-tasks.c)
ovni_test(nested-tasks-bad.c SHOULD_FAIL
REGEX "fatal: cannot execute task 1: state is not created")
ovni_test(NAME nosv-task-types MP)
ovni_test(NAME nosv-pause MP)
ovni_test(task-types.c MP)
ovni_test(pause.c MP)

View File

@ -16,9 +16,9 @@
# Only run performance sensitive tests on Release builds
if(CMAKE_BUILD_TYPE STREQUAL "Release")
ovni_test(NAME flush-overhead)
ovni_test(flush-overhead.c)
endif()
ovni_test(NAME flush)
ovni_test(NAME mp-simple MP)
ovni_test(NAME mp-rank MP)
ovni_test(flush.c)
ovni_test(mp-simple.c MP)
ovni_test(mp-rank.c MP)

View File

@ -1,24 +1,24 @@
include(CMakeParseArguments)
function(ovni_test)
function(ovni_test source)
set(switches MP SHOULD_FAIL)
set(single NPROC NAME REGEX)
set(multi SOURCE ENV)
set(single NPROC REGEX)
set(multi ENV)
# Compute the test name from the source and path
cmake_path(RELATIVE_PATH CMAKE_CURRENT_SOURCE_DIR
BASE_DIRECTORY "${OVNI_TEST_SOURCE_DIR}"
OUTPUT_VARIABLE name_prefix)
set(full_path "${name_prefix}/${source}")
string(REGEX REPLACE "\.c$" "" full_path_noext "${full_path}")
string(REPLACE "/" "-" name "${full_path_noext}")
cmake_parse_arguments(
OVNI_TEST "${switches}" "${single}" "${multi}" ${ARGN})
if(NOT OVNI_TEST_NAME)
message(FATAL_ERROR "You must provide a test NAME")
endif(NOT OVNI_TEST_NAME)
set(OVNI_TEST_NAME ${OVNI_TEST_NAME} PARENT_SCOPE)
# Set default source if not given
if(NOT OVNI_TEST_SOURCE)
set(OVNI_TEST_SOURCE "${OVNI_TEST_NAME}.c")
#message("Setting default source to ${OVNI_TEST_SOURCE}")
endif()
set(OVNI_TEST_NAME ${name} PARENT_SCOPE)
set(OVNI_TEST_NAME ${name})
set(OVNI_TEST_SOURCE ${source})
if(NOT OVNI_TEST_NPROC)
if(NOT OVNI_TEST_MP)

View File

@ -27,6 +27,6 @@ function(nosv_test)
ENVIRONMENT "NOSV_CONFIG=${OVNI_TEST_SOURCE_DIR}/rt/nosv/nosv.toml")
endfunction()
nosv_test(NAME nosv-attach SOURCE nosv/attach.c)
nosv_test(nosv/attach.c)
add_subdirectory(nanos6)

View File

@ -6,5 +6,5 @@ function(nanos6_rt_test)
ENVIRONMENT "NANOS6_CONFIG=${OVNI_TEST_SOURCE_DIR}/rt/nanos6/nanos6.toml")
endfunction()
nanos6_rt_test(NAME rt-nanos6-simple-task SOURCE simple-task.c)
nanos6_rt_test(NAME rt-nanos6-nested-task SOURCE nested-task.c)
nanos6_rt_test(simple-task.c)
nanos6_rt_test(nested-task.c)