keep test IDs the same over several cmake runs
CACHE INTRNAL was a bad choice for setting this variable as it will keep increasing whenever cmake runs. So we should use PARENT_SCOPE instead
This commit is contained in:
parent
e8af6512ec
commit
1395da9a8f
|
@ -84,12 +84,19 @@ function(add_fdb_test)
|
|||
if (NOT "${ADD_FDB_TEST_TEST_NAME}" STREQUAL "")
|
||||
set(test_name ${ADD_FDB_TEST_TEST_NAME})
|
||||
endif()
|
||||
math(EXPR test_idx "${CURRENT_TEST_INDEX} + 1")
|
||||
set(CURRENT_TEST_INDEX "${test_idx}" PARENT_SCOPE)
|
||||
# set(<var> <value> PARENT_SCOPE) doesn't set the
|
||||
# value in this scope (only in the parent scope). So
|
||||
# if the value was undefined before, it will still be
|
||||
# undefined.
|
||||
math(EXPR assigned_id "${test_idx} - 1")
|
||||
if(ADD_FDB_TEST_UNIT)
|
||||
message(STATUS
|
||||
"ADDING UNIT TEST ${test_name}")
|
||||
"ADDING UNIT TEST ${assigned_id} ${test_name}")
|
||||
else()
|
||||
message(STATUS
|
||||
"ADDING SIMULATOR TEST ${test_name}")
|
||||
"ADDING SIMULATOR TEST ${assigned_id} ${test_name}")
|
||||
endif()
|
||||
set(test_files "")
|
||||
foreach(curr_test_file ${ADD_FDB_TEST_TEST_FILES})
|
||||
|
@ -99,9 +106,6 @@ function(add_fdb_test)
|
|||
if (ENABLE_BUGGIFY)
|
||||
set(BUGGIFY_OPTION "-B")
|
||||
endif()
|
||||
math(EXPR test_idx "${CURRENT_TEST_INDEX} + 1")
|
||||
set(CURRENT_TEST_INDEX "${test_idx}" CACHE INTERNAL "The index used for the last added test" FORCE)
|
||||
message("Added ${test_name} with idx ${CURRENT_TEST_INDEX}")
|
||||
list(TRANSFORM ADD_FDB_TEST_TEST_FILES PREPEND "${CMAKE_CURRENT_SOURCE_DIR}/")
|
||||
add_test(NAME ${test_name}
|
||||
COMMAND $<TARGET_FILE:Python::Interpreter> ${TestRunner}
|
||||
|
|
Loading…
Reference in New Issue