Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Generate tests for memcheck.
[simgrid.git] / buildtools / Cmake / AddTests.cmake
index 70c5336..5436bb5 100644 (file)
@@ -6,18 +6,20 @@ if(enable_smpi)
 endif(enable_smpi)
 
 if(enable_memcheck)
+       include(FindPerl)
        exec_program("valgrind --version " OUTPUT_VARIABLE "VALGRIND_VERSION")
-       if(VALGRIND_VERSION)
+       if(VALGRIND_VERSION AND PERL_EXECUTABLE)
                string(REGEX MATCH "[0-9].[0-9].[0-9]" NEW_VALGRIND_VERSION "${VALGRIND_VERSION}")
                if(NEW_VALGRIND_VERSION)
+                       exec_program("${PROJECT_DIRECTORY}/buildtools/Cmake/generate_memcheck_tests.pl ${PROJECT_DIRECTORY} ${PROJECT_DIRECTORY}/buildtools/Cmake/AddTests.cmake > ${PROJECT_DIRECTORY}/buildtools/Cmake/memcheck_tests.cmake")
                else(NEW_VALGRIND_VERSION)
                        set(enable_memcheck false)
                        message("Command valgrind not found --> enable_memcheck autoset to false.")
                endif(NEW_VALGRIND_VERSION)
-       else(VALGRIND_VERSION)
+       else(VALGRIND_VERSION AND PERL_EXECUTABLE)
                set(enable_memcheck false)
-               message("Command valgrind not found --> enable_memcheck autoset to false.")
-       endif(VALGRIND_VERSION)
+               message("Command valgrind or perl not found --> enable_memcheck autoset to false.")
+       endif(VALGRIND_VERSION AND PERL_EXECUTABLE)
 endif(enable_memcheck)
 
 ### For code coverage
@@ -29,10 +31,7 @@ SET(DROP_LOCATION "/submit.php?project=${PROJECT_NAME}")
 SET(DROP_SITE_CDASH TRUE)
 SET(TRIGGER_SITE "http://cdash.inria.fr/CDash/cgi-bin/Submit-Random-TestingResults.cgi")
 SET(COVERAGE_COMMAND "${GCOV_PATH}/gcov")
-#SET(VALGRIND_COMMAND "${VALGRIND_PATH}/valgrind")
-#SET(MEMORYCHECK_COMMAND "${VALGRIND_PATH}/valgrind")
-#set(MEMORYCHECK_COMMAND_OPTIONS "--trace-children=yes --leak-check=full --show-reachable=yes --track-origins=yes --read-var-info=no")
-set(MEMORYCHECK_COMMAND_OPTIONS "--trace-children=yes --leak-check=full --show-reachable=yes --track-origins=yes --read-var-info=no --valgrind ${VALGRIND_PATH}")
+set(MEMORYCHECK_COMMAND_OPTIONS "--trace-children=yes --leak-check=full --show-reachable=yes --track-origins=yes --read-var-info=no")
 SET(VALGRIND_COMMAND "${PROJECT_DIRECTORY}/buildtools/Cmake/my_valgrind.pl")
 SET(MEMORYCHECK_COMMAND "${PROJECT_DIRECTORY}/buildtools/Cmake/my_valgrind.pl")
 #If you use the --read-var-info option Memcheck will run more slowly but may give a more detailed description of any illegal address.