diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 457b227..0a25e9d 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -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) diff --git a/test/manual/CMakeLists.txt b/test/emu/CMakeLists.txt similarity index 100% rename from test/manual/CMakeLists.txt rename to test/emu/CMakeLists.txt diff --git a/test/manual/instr.h b/test/emu/instr.h similarity index 100% rename from test/manual/instr.h rename to test/emu/instr.h diff --git a/test/manual/nanos6/CMakeLists.txt b/test/emu/nanos6/CMakeLists.txt similarity index 78% rename from test/manual/nanos6/CMakeLists.txt rename to test/emu/nanos6/CMakeLists.txt index 9870642..9ff6535 100644 --- a/test/manual/nanos6/CMakeLists.txt +++ b/test/emu/nanos6/CMakeLists.txt @@ -14,11 +14,11 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -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") diff --git a/test/manual/nanos6/nanos6-blocking.c b/test/emu/nanos6/blocking.c similarity index 100% rename from test/manual/nanos6/nanos6-blocking.c rename to test/emu/nanos6/blocking.c diff --git a/test/manual/nanos6/instr_nanos6.h b/test/emu/nanos6/instr_nanos6.h similarity index 100% rename from test/manual/nanos6/instr_nanos6.h rename to test/emu/nanos6/instr_nanos6.h diff --git a/test/manual/nanos6/nanos6-nested-tasks-bad.c b/test/emu/nanos6/nested-tasks-bad.c similarity index 100% rename from test/manual/nanos6/nanos6-nested-tasks-bad.c rename to test/emu/nanos6/nested-tasks-bad.c diff --git a/test/manual/nanos6/nanos6-nested-tasks.c b/test/emu/nanos6/nested-tasks.c similarity index 100% rename from test/manual/nanos6/nanos6-nested-tasks.c rename to test/emu/nanos6/nested-tasks.c diff --git a/test/manual/nanos6/nanos6-ss-mismatch.c b/test/emu/nanos6/ss-mismatch.c similarity index 100% rename from test/manual/nanos6/nanos6-ss-mismatch.c rename to test/emu/nanos6/ss-mismatch.c diff --git a/test/manual/nanos6/nanos6-subsystems.c b/test/emu/nanos6/subsystems.c similarity index 100% rename from test/manual/nanos6/nanos6-subsystems.c rename to test/emu/nanos6/subsystems.c diff --git a/test/manual/nanos6/nanos6-task-types.c b/test/emu/nanos6/task-types.c similarity index 100% rename from test/manual/nanos6/nanos6-task-types.c rename to test/emu/nanos6/task-types.c diff --git a/test/manual/nosv/CMakeLists.txt b/test/emu/nosv/CMakeLists.txt similarity index 83% rename from test/manual/nosv/CMakeLists.txt rename to test/emu/nosv/CMakeLists.txt index abbf47d..930b59a 100644 --- a/test/manual/nosv/CMakeLists.txt +++ b/test/emu/nosv/CMakeLists.txt @@ -14,8 +14,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -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) diff --git a/test/manual/nosv/instr_nosv.h b/test/emu/nosv/instr_nosv.h similarity index 100% rename from test/manual/nosv/instr_nosv.h rename to test/emu/nosv/instr_nosv.h diff --git a/test/manual/nosv/nosv-nested-tasks-bad.c b/test/emu/nosv/nested-tasks-bad.c similarity index 100% rename from test/manual/nosv/nosv-nested-tasks-bad.c rename to test/emu/nosv/nested-tasks-bad.c diff --git a/test/manual/nosv/nosv-nested-tasks.c b/test/emu/nosv/nested-tasks.c similarity index 100% rename from test/manual/nosv/nosv-nested-tasks.c rename to test/emu/nosv/nested-tasks.c diff --git a/test/manual/nosv/nosv-pause.c b/test/emu/nosv/pause.c similarity index 100% rename from test/manual/nosv/nosv-pause.c rename to test/emu/nosv/pause.c diff --git a/test/manual/nosv/nosv-task-types.c b/test/emu/nosv/task-types.c similarity index 100% rename from test/manual/nosv/nosv-task-types.c rename to test/emu/nosv/task-types.c diff --git a/test/manual/ovni/CMakeLists.txt b/test/emu/ovni/CMakeLists.txt similarity index 87% rename from test/manual/ovni/CMakeLists.txt rename to test/emu/ovni/CMakeLists.txt index c03c5fb..d819064 100644 --- a/test/manual/ovni/CMakeLists.txt +++ b/test/emu/ovni/CMakeLists.txt @@ -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) diff --git a/test/manual/ovni/flush-overhead.c b/test/emu/ovni/flush-overhead.c similarity index 100% rename from test/manual/ovni/flush-overhead.c rename to test/emu/ovni/flush-overhead.c diff --git a/test/manual/ovni/flush.c b/test/emu/ovni/flush.c similarity index 100% rename from test/manual/ovni/flush.c rename to test/emu/ovni/flush.c diff --git a/test/manual/ovni/instr_ovni.h b/test/emu/ovni/instr_ovni.h similarity index 100% rename from test/manual/ovni/instr_ovni.h rename to test/emu/ovni/instr_ovni.h diff --git a/test/manual/ovni/mp-rank.c b/test/emu/ovni/mp-rank.c similarity index 100% rename from test/manual/ovni/mp-rank.c rename to test/emu/ovni/mp-rank.c diff --git a/test/manual/ovni/mp-simple.c b/test/emu/ovni/mp-simple.c similarity index 100% rename from test/manual/ovni/mp-simple.c rename to test/emu/ovni/mp-simple.c diff --git a/test/macros.cmake b/test/macros.cmake index 28ea376..04cc4f5 100644 --- a/test/macros.cmake +++ b/test/macros.cmake @@ -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) diff --git a/test/rt/CMakeLists.txt b/test/rt/CMakeLists.txt index 61af077..538f8b6 100644 --- a/test/rt/CMakeLists.txt +++ b/test/rt/CMakeLists.txt @@ -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) diff --git a/test/rt/nanos6/CMakeLists.txt b/test/rt/nanos6/CMakeLists.txt index 9f4d991..6cae6d8 100644 --- a/test/rt/nanos6/CMakeLists.txt +++ b/test/rt/nanos6/CMakeLists.txt @@ -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)