1 # Copyright 2021-2022. The SimGrid Team. All rights reserved.
3 # Integrates the MBI tests into the SimGrid build chain when asked to
5 # Only the python scripts are embeeded in the archive, and the C test files are generated at config time using these scripts.
6 # These python scripts are copied over from the MBI repository with as little changes as possible.
11 CollLocalConcurrencyGenerator.py
12 CollMatchingGenerator.py
13 CollP2PMatchingGenerator.py
14 CollP2PMessageRaceGenerator.py
16 MissingWaitandStartGenerator.py
19 P2PInvalidComGenerator.py
20 P2PLocalConcurrencyGenerator.py
21 P2PMatchingANYSRCGenerator.py
22 P2PMatchingGenerator.py
26 RMAInvalidArgGenerator.py
27 RMALocalLocalConcurrencyGenerator.py
28 RMAP2PGlobalConcurrencyGenerator.py
29 RMARemoteLocalConcurrencyGenerator.py
30 RMARemoteRemoteConcurrencyGenerator.py
31 RMAReqLifecycleGenerator.py
32 RMAWinBufferGenerator.py)
34 if (enable_smpi_MBI_testsuite)
36 message(FATAL_ERROR "MBI test suite cannot be enabled without SMPI. Please change either setting.")
38 if (NOT enable_model-checking)
39 message(FATAL_ERROR "MBI test suite cannot be enabled without the Mc SimGrid model-checker. Please change either setting.")
42 message(STATUS "Generating the MBI test cases")
43 file(REMOVE_RECURSE ${CMAKE_BINARY_DIR}/MBI/tmp)
44 file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/MBI/tmp)
45 file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/generator_utils.py DESTINATION ${CMAKE_BINARY_DIR}/MBI/tmp)
46 foreach (script ${generator_scripts})
47 message(STATUS " $ ${CMAKE_CURRENT_SOURCE_DIR}/${script}")
48 execute_process(COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/${script}
49 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/MBI/tmp)
52 set(CMAKE_C_COMPILER "${CMAKE_BINARY_DIR}/smpi_script/bin/smpicc")
53 set(CMAKE_CXX_COMPILER "${CMAKE_BINARY_DIR}/smpi_script/bin/smpicxx")
54 include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi")
56 # Connect the MBI tests to the other tests
57 add_custom_target(tests-mbi COMMENT "Recompiling the MBI tests and tools.")
58 add_dependencies(tests tests-mbi)
60 file(GLOB cfiles RELATIVE ${CMAKE_BINARY_DIR}/MBI/tmp ${CMAKE_BINARY_DIR}/MBI/tmp/*.c )
61 foreach(cfile ${cfiles})
62 # Copy the generated files only if different (needs cmake ≥ 3.21)
63 if (CMAKE_VERSION VERSION_LESS 3.21)
64 file(COPY ${CMAKE_BINARY_DIR}/MBI/tmp/${cfile} DESTINATION ${CMAKE_BINARY_DIR}/MBI/)
66 file(COPY_FILE ${CMAKE_BINARY_DIR}/MBI/tmp/${cfile} ${CMAKE_BINARY_DIR}/MBI/${cfile} ONLY_IF_DIFFERENT)
68 string(REGEX REPLACE "[.]c" "" basefile ${cfile})
70 # Generate an executable for each of them
71 add_executable(mbi_${basefile} EXCLUDE_FROM_ALL ${CMAKE_BINARY_DIR}/MBI/${cfile})
72 target_link_libraries(mbi_${basefile} simgrid)
73 target_compile_options(mbi_${basefile} PRIVATE "-Wno-error")
74 set_target_properties(mbi_${basefile} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/MBI)
75 add_dependencies(tests-mbi mbi_${basefile})
77 # Generate a test case for each source file, using the MBI runner
78 ADD_TEST(NAME mbi-${basefile}
79 COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/MBI.py ${CMAKE_BINARY_DIR} ./mbi_${basefile} ${cfile}
80 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/MBI)
81 SET_TESTS_PROPERTIES(mbi-${basefile} PROPERTIES DEPENDS mbi-${basefile})
82 SET_TESTS_PROPERTIES(mbi-${basefile} PROPERTIES DEPENDS simgrid-mc)
84 file(REMOVE_RECURSE ${CMAKE_BINARY_DIR}/MBI/tmp) # Clean temp files
86 if("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_HOME_DIRECTORY}")
88 file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/MBIutils.py DESTINATION ${CMAKE_BINARY_DIR}/MBI)
91 # The following tests are known to fail because simgrid does not intercept local modifications yet
92 # An idea could be to use ASan on the verified application, along with https://github.com/google/sanitizers/wiki/AddressSanitizerManualPoisoning
93 # But currently, ASan is not usable at all, since the Checker dislikes this trick when it tries to read the memory of the app.
94 # We should change the checker to not read the app when verifying safty properties
96 LocalConcurrency_Iallgather_nok LocalConcurrency_Iallgatherv_nok LocalConcurrency_Iallreduce_nok LocalConcurrency_Ialltoall_nok
97 LocalConcurrency_Ialltoallv_nok LocalConcurrency_Ibcast_nok LocalConcurrency_Iexscan_nok LocalConcurrency_Igather_nok
98 LocalConcurrency_Irecv_Isend_nok LocalConcurrency_Irecv_Send_init_nok LocalConcurrency_Irecv_Send_nok LocalConcurrency_Ireduce_nok
99 LocalConcurrency_Iscan_nok LocalConcurrency_Iscatter_nok LocalConcurrency_Recv_Isend_nok LocalConcurrency_Recv_Send_init_nok
100 LocalConcurrency_Recv_init_Isend_nok LocalConcurrency_Recv_init_Send_nok LocalConcurrency_Recv_init_Send_init_nok
102 GlobalConcurrency_Get_Isend_Irecv_nok GlobalConcurrency_Get_Isend_Recv_nok GlobalConcurrency_Get_Send_Irecv_nok GlobalConcurrency_Get_Send_Recv_nok
103 GlobalConcurrency_Put_Isend_Irecv_nok GlobalConcurrency_Put_Isend_Recv_nok GlobalConcurrency_Put_Send_Irecv_nok GlobalConcurrency_Put_Send_Recv_nok
105 GlobalConcurrency_rl_Win_fence_Get_rload_nok GlobalConcurrency_rl_Win_fence_Get_rstore_nok
106 GlobalConcurrency_rl_Win_fence_Put_rload_nok GlobalConcurrency_rl_Win_fence_Put_rstore_nok
107 GlobalConcurrency_rl_Win_lock_all_Get_rload_nok GlobalConcurrency_rl_Win_lock_all_Get_rstore_nok
108 GlobalConcurrency_rl_Win_lock_all_Put_rload_nok GlobalConcurrency_rl_Win_lock_all_Put_rstore_nok
110 set_tests_properties(mbi-${localmodif} PROPERTIES WILL_FAIL true)
111 endforeach(localmodif )
114 # Add the needed files to the distribution
115 foreach(script ${generator_scripts})
116 set(teshsuite_src ${teshsuite_src} ${CMAKE_CURRENT_SOURCE_DIR}/${script})
119 set(teshsuite_src ${teshsuite_src}
120 ${CMAKE_CURRENT_SOURCE_DIR}/generator_utils.py
121 ${CMAKE_CURRENT_SOURCE_DIR}/MBI.py
122 ${CMAKE_CURRENT_SOURCE_DIR}/MBIutils.py
123 ${CMAKE_CURRENT_SOURCE_DIR}/simgrid.py