From 323933448ad7479de9eba580a3c9fa915263ccaa Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Date: Tue, 27 Sep 2022 15:41:43 +0200 Subject: [PATCH] Test Nanos6 with multiple instrumentation levels --- test/macros.cmake | 26 ++++++++++++++++---------- test/rt/nanos6/CMakeLists.txt | 12 ++++++++++++ 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/test/macros.cmake b/test/macros.cmake index 04cc4f5..486a150 100644 --- a/test/macros.cmake +++ b/test/macros.cmake @@ -2,22 +2,28 @@ include(CMakeParseArguments) function(ovni_test source) set(switches MP SHOULD_FAIL) - set(single NPROC REGEX) + set(single NPROC REGEX NAME) 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}) - 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 ${OVNI_TEST_NAME} PARENT_SCOPE) set(OVNI_TEST_SOURCE ${source}) if(NOT OVNI_TEST_NPROC) diff --git a/test/rt/nanos6/CMakeLists.txt b/test/rt/nanos6/CMakeLists.txt index 9cbbf14..64dde88 100644 --- a/test/rt/nanos6/CMakeLists.txt +++ b/test/rt/nanos6/CMakeLists.txt @@ -2,6 +2,11 @@ find_library(nanos6 libnanos6) find_path(NANOS6_INCLUDE_DIR nanos6.h) function(nanos6_rt_test) + set(switches "") + set(single LEVEL) + set(multi "") + cmake_parse_arguments( + NANOS6_TEST "${switches}" "${single}" "${multi}" ${ARGN}) ovni_test(${ARGN}) target_compile_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}) set_property(TEST "${OVNI_TEST_NAME}" APPEND PROPERTY 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() 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(if0.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)