Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Drop unused functions: xbt_str_varsubst(), xbt_strbuff_varsubst()
[simgrid.git] / tools / cmake / UnitTesting.cmake
1 # This file is in charge of the unit testing in SimGrid.
2 # See http://simgrid.gforge.inria.fr/simgrid/3.13/doc/inside_tests.html#inside_tests_add_units
3
4 # To register a file containing unit tests, simply add it to
5 # FILES_CONTAINING_UNITTESTS and have a pleasant day.
6
7 set(FILES_CONTAINING_UNITTESTS
8   src/xbt/cunit.cpp
9   src/xbt/ex.cpp
10   src/xbt/dynar.cpp
11   src/xbt/dict.cpp
12   src/xbt/swag.c
13   src/xbt/xbt_str.cpp
14   src/xbt/config.cpp
15 )
16
17 if(SIMGRID_HAVE_MC)
18   set(FILES_CONTAINING_UNITTESTS ${FILES_CONTAINING_UNITTESTS}
19       src/mc/PageStore.cpp
20       src/mc/mc_snapshot.cpp
21   )
22 endif()
23
24 ####  Nothing to change below this line to add a new tested file
25 ################################################################
26
27 foreach(file ${FILES_CONTAINING_UNITTESTS})
28   get_filename_component(basename ${file} NAME_WE)
29   get_filename_component(ext ${file} EXT)
30   set(EXTRACTED_TEST_SOURCE_FILES ${EXTRACTED_TEST_SOURCE_FILES} ${CMAKE_CURRENT_BINARY_DIR}/src/${basename}_unit${ext})
31 endforeach()
32   
33 set(EXTRACTED_TEST_SOURCE_FILES ${EXTRACTED_TEST_SOURCE_FILES} ${CMAKE_CURRENT_BINARY_DIR}/src/simgrid_units_main.c)
34
35 set_source_files_properties(${EXTRACTED_TEST_SOURCE_FILES} PROPERTIES GENERATED true)
36
37 ADD_CUSTOM_COMMAND(
38   OUTPUT  ${EXTRACTED_TEST_SOURCE_FILES}
39   DEPENDS ${CMAKE_HOME_DIRECTORY}/tools/sg_unit_extractor.pl ${FILES_CONTAINING_UNITTESTS}
40   COMMENT "Generating *_units files for testall..."
41
42   WORKING_DIRECTORY ${CMAKE_HOME_DIRECTORY}
43   COMMAND           ${CMAKE_COMMAND} -E remove -f ${EXTRACTED_TEST_SOURCE_FILES}
44   COMMAND           chmod +x ${CMAKE_HOME_DIRECTORY}/tools/sg_unit_extractor.pl
45   COMMAND           ${CMAKE_HOME_DIRECTORY}/tools/sg_unit_extractor.pl --root=src/ --outdir=${CMAKE_CURRENT_BINARY_DIR}/src/ ${FILES_CONTAINING_UNITTESTS}
46 )
47
48 add_executable       (testall ${EXTRACTED_TEST_SOURCE_FILES})
49 target_link_libraries(testall simgrid)
50