Test Nanos6 with multiple instrumentation levels

This commit is contained in:
Rodrigo Arias 2022-09-27 15:41:43 +02:00
parent 598aea7dc9
commit 323933448a
2 changed files with 28 additions and 10 deletions

View File

@ -2,22 +2,28 @@ include(CMakeParseArguments)
function(ovni_test source) function(ovni_test source)
set(switches MP SHOULD_FAIL) set(switches MP SHOULD_FAIL)
set(single NPROC REGEX) set(single NPROC REGEX NAME)
set(multi ENV) 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( cmake_parse_arguments(
OVNI_TEST "${switches}" "${single}" "${multi}" ${ARGN}) OVNI_TEST "${switches}" "${single}" "${multi}" ${ARGN})
set(OVNI_TEST_NAME ${name} PARENT_SCOPE) if(OVNI_TEST_NAME)
set(test_name "${OVNI_TEST_NAME}")
else()
set(test_name "${source}")
endif()
# 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}/${test_name}")
string(REGEX REPLACE "\.c$" "" full_path_noext "${full_path}")
string(REPLACE "/" "-" name "${full_path_noext}")
set(OVNI_TEST_NAME ${name}) set(OVNI_TEST_NAME ${name})
set(OVNI_TEST_NAME ${OVNI_TEST_NAME} PARENT_SCOPE)
set(OVNI_TEST_SOURCE ${source}) set(OVNI_TEST_SOURCE ${source})
if(NOT OVNI_TEST_NPROC) if(NOT OVNI_TEST_NPROC)

View File

@ -2,6 +2,11 @@ find_library(nanos6 libnanos6)
find_path(NANOS6_INCLUDE_DIR nanos6.h) find_path(NANOS6_INCLUDE_DIR nanos6.h)
function(nanos6_rt_test) function(nanos6_rt_test)
set(switches "")
set(single LEVEL)
set(multi "")
cmake_parse_arguments(
NANOS6_TEST "${switches}" "${single}" "${multi}" ${ARGN})
ovni_test(${ARGN}) ovni_test(${ARGN})
target_compile_options("${OVNI_TEST_NAME}" PUBLIC "-fompss-2") target_compile_options("${OVNI_TEST_NAME}" PUBLIC "-fompss-2")
target_link_options("${OVNI_TEST_NAME}" PUBLIC "-fompss-2") target_link_options("${OVNI_TEST_NAME}" PUBLIC "-fompss-2")
@ -10,6 +15,10 @@ function(nanos6_rt_test)
PUBLIC ${NANOS6_INCLUDE_DIR}) PUBLIC ${NANOS6_INCLUDE_DIR})
set_property(TEST "${OVNI_TEST_NAME}" APPEND PROPERTY set_property(TEST "${OVNI_TEST_NAME}" APPEND PROPERTY
ENVIRONMENT "NANOS6_CONFIG=${OVNI_TEST_SOURCE_DIR}/rt/nanos6/nanos6.toml") ENVIRONMENT "NANOS6_CONFIG=${OVNI_TEST_SOURCE_DIR}/rt/nanos6/nanos6.toml")
if(NANOS6_TEST_LEVEL)
set_property(TEST "${OVNI_TEST_NAME}" APPEND PROPERTY
ENVIRONMENT "NANOS6_CONFIG_OVERRIDE=instrument.ovni.level=${NANOS6_TEST_LEVEL}")
endif()
endfunction() endfunction()
nanos6_rt_test(simple-task.c) nanos6_rt_test(simple-task.c)
@ -18,3 +27,6 @@ nanos6_rt_test(several-tasks.c)
nanos6_rt_test(sched-add.c) nanos6_rt_test(sched-add.c)
nanos6_rt_test(if0.c) nanos6_rt_test(if0.c)
nanos6_rt_test(taskfor.c) nanos6_rt_test(taskfor.c)
nanos6_rt_test(simple-task.c NAME simple-task-level-1 LEVEL 1)
nanos6_rt_test(simple-task.c NAME simple-task-level-2 LEVEL 2)
nanos6_rt_test(simple-task.c NAME simple-task-level-3 LEVEL 3)