diff --git a/CMakeLists.txt b/CMakeLists.txt index 3aa490729a3365cf41d377cf4d6fd2e4af3349fd..abc2ea9f001d8ec067e27df41a520bd28e15dfc4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -225,3 +225,45 @@ add_custom_target(shortunittests DEPENDS tests/cta-unitTests tests/cta-unitTests-multiProcess COMMENT "Running unit tests" VERBATIM) + +add_custom_target(helgrindBase + echo ${VALGRIND} --tool=helgrind ${HELGRIND_OPTS_W_SUPPR} -q tests/cta-unitTests --gtest_filter=-OStoreDBPlusMockSchedulerTestVFS*:OStoreTestVFS*:OStoreDBPlusMockSchedulerTestVFS*:InMemory* + COMMAND ${VALGRIND} --tool=helgrind ${HELGRIND_OPTS_W_SUPPR} -q tests/cta-unitTests --gtest_filter=-OStoreDBPlusMockSchedulerTestVFS*:OStoreTestVFS*:OStoreDBPlusMockSchedulerTestVFS*:InMemory* + COMMAND echo ${VALGRIND} --tool=helgrind ${HELGRIND_OPTS_W_SUPPR} -q tests/cta-unitTests-multiProcess + COMMAND ${VALGRIND} --tool=helgrind ${HELGRIND_OPTS_W_SUPPR} -q tests/cta-unitTests-multiProcess + + DEPENDS tests/cta-unitTests tests/cta-unitTests-multiProcess tests/helgrind.suppr + COMMENT "Running unit tests with race conditions detection (except slow sections)" VERBATIM) + +add_custom_target(helgrindScheduler + echo ${VALGRIND} --tool=helgrind ${HELGRIND_OPTS_W_SUPPR} -q tests/cta-unitTests --gtest_filter=OStoreDBPlusMockSchedulerTestVFS/Scheduler* + COMMAND ${VALGRIND} --tool=helgrind ${HELGRIND_OPTS_W_SUPPR} -q tests/cta-unitTests --gtest_filter=OStoreDBPlusMockSchedulerTestVFS/Scheduler* + + DEPENDS tests/cta-unitTests tests/cta-unitTests-multiProcess tests/helgrind.suppr + COMMENT "Running unit tests with race conditions detection (Mock scheduler section)" VERBATIM) + +add_custom_target(helgrindOStoreDB + echo ${VALGRIND} --tool=helgrind ${HELGRIND_OPTS_W_SUPPR} -q tests/cta-unitTests --gtest_filter=OStoreTestVFS* + COMMAND ${VALGRIND} --tool=helgrind ${HELGRIND_OPTS_W_SUPPR} -q tests/cta-unitTests --gtest_filter=OStoreTestVFS* + + DEPENDS tests/cta-unitTests tests/cta-unitTests-multiProcess tests/helgrind.suppr + COMMENT "Running unit tests with race conditions detection (Object store DB section)" VERBATIM) + +add_custom_target(helgrindDataTransfer + echo ${VALGRIND} --tool=helgrind ${HELGRIND_OPTS_W_SUPPR} -q tests/cta-unitTests --gtest_filter=OStoreDBPlusMockSchedulerTestVFS/DataTransferSessionTest* + COMMAND ${VALGRIND} --tool=helgrind ${HELGRIND_OPTS_W_SUPPR} -q tests/cta-unitTests --gtest_filter=OStoreDBPlusMockSchedulerTestVFS/DataTransferSessionTest* + + DEPENDS tests/cta-unitTests tests/cta-unitTests-multiProcess tests/helgrind.suppr + COMMENT "Running unit tests with race conditions detection (Data transfer section)" VERBATIM) + +add_custom_target(helgrindInMemoryCatalogue + echo ${VALGRIND} --tool=helgrind ${HELGRIND_OPTS_W_SUPPR} -q tests/cta-unitTests --gtest_filter=InMemory/* + COMMAND ${VALGRIND} --tool=helgrind ${HELGRIND_OPTS_W_SUPPR} -q tests/cta-unitTests --gtest_filter=InMemory/* + + DEPENDS tests/cta-unitTests tests/cta-unitTests-multiProcess tests/helgrind.suppr + COMMENT "Running unit tests with race conditions detection (In memory catalogue section)" VERBATIM) + +add_custom_target(parallelHelgrind + echo + + DEPENDS helgrindBase helgrindMockSechduler helgrindOStoreDB helgrindDataTransfer helgrindInMemoryCatalogue) diff --git a/cta.spec.in b/cta.spec.in index aebb2a794a67437dc991ad432221d333f323cac7..fd6c6e198a3087a9455cf5ddd95bb3de2dcbe21f 100644 --- a/cta.spec.in +++ b/cta.spec.in @@ -242,6 +242,7 @@ Unit tests and system tests with virtual tape drives %{_bindir}/cta-systemTests %{_libdir}/libctadaemonunittests-multiprocess.so* %attr(0644,root,root) %{_datadir}/%{name}-%{ctaVersion}/unittest/*.suppr +%attr(0644,root,root) %{_datadir}/%{name}-%{ctaVersion}/unittest/parallelTestsMakefile %package -n cta-objectstore-tools Summary: CERN Tape Archive: object store tools diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 636959829f122c4b1817dd9b396f4bff1dc49bd9..60f6314790a5da554fd1e6b62edcb775c15f675b 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -108,6 +108,7 @@ install(TARGETS cta-catalogueUnitTests cta-unitTests cta-unitTests-multiProcess install(TARGETS systemTestHelperTests DESTINATION usr/${CMAKE_INSTALL_LIBDIR}) configure_file(cta-valgrindUnitTests.sh.in ${CMAKE_CURRENT_BINARY_DIR}/cta-valgrindUnitTests.sh) +configure_file(parallelTestsMakefile.in ${CMAKE_CURRENT_BINARY_DIR}/parallelTestsMakefile) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/cta-valgrindUnitTests.sh cta-unitPlusSystemTests.sh DESTINATION usr/bin) -install(FILES valgrind.suppr helgrind.suppr DESTINATION usr/share/cta-${CTA_VERSION}/unittest/) +install(FILES valgrind.suppr helgrind.suppr ${CMAKE_CURRENT_BINARY_DIR}/parallelTestsMakefile DESTINATION usr/share/cta-${CTA_VERSION}/unittest/) diff --git a/tests/cta-valgrindUnitTests.sh.in b/tests/cta-valgrindUnitTests.sh.in index 5464f62dc75a78cf9abb2b66bce0c0b6d9746f24..6fafb06382b16235d254fb058929fd3f10ccb555 100644 --- a/tests/cta-valgrindUnitTests.sh.in +++ b/tests/cta-valgrindUnitTests.sh.in @@ -1,20 +1,6 @@ #!/bin/bash # exit from the script on any error. set -e -/usr/bin/cta-unitTests -/usr/bin/cta-unitTests-multiProcess +make -f /usr/share/cta-@CTA_VERSION@/parallelTestsMakefile -j 4 -valgrind @VALGRIND_OPTS_STR@ --suppressions=/usr/share/cta-@CTA_VERSION@/unittest/valgrind.suppr \ - /usr/bin/cta-unitTests - -valgrind --tool=helgrind @HELGRIND_OPTS_STR@ \ - --suppressions=/usr/share/cta-@CTA_VERSION@/unittest/helgrind.suppr \ - /usr/bin/cta-unitTests - -valgrind @VALGRIND_OPTS_STR@ --suppressions=/usr/share/cta-@CTA_VERSION@/unittest/valgrind.suppr \ - --child-silent-after-fork=yes /usr/bin/cta-unitTests-multiProcess - -valgrind --tool=helgrind @HELGRIND_OPTS_STR@ \ - --suppressions=/usr/share/cta-@CTA_VERSION@/unittest/helgrind.suppr \ - /usr/bin/cta-unitTests-multiProcess diff --git a/tests/parallelTestsMakefile.in b/tests/parallelTestsMakefile.in new file mode 100644 index 0000000000000000000000000000000000000000..0cd82fa9a87cfa6db47cedc4820b9bcbe3127a5d --- /dev/null +++ b/tests/parallelTestsMakefile.in @@ -0,0 +1,49 @@ +.phony: all + +all: valgrind valgrindMultiprocess helgrindBase helgrindScheduler helgrindOStoreDB helgrindDataTransfer helgrindInMemoryCatalogue helgrindMultiprocess + + +valgrind: + valgrind -q @VALGRIND_OPTS_STR@ \ + --suppressions=/usr/share/cta-@CTA_VERSION@/unittest/valgrind.suppr \ + /usr/bin/cta-unitTests + +valgrindMultiprocess: + valgrind -q @VALGRIND_OPTS_STR@ --child-silent-after-fork=yes \ + --suppressions=/usr/share/cta-@CTA_VERSION@/unittest/valgrind.suppr \ + /usr/bin/cta-unitTests-multiProcess + +helgrindBase: + valgrind -q --tool=helgrind @HELGRIND_OPTS_STR@ \ + --suppressions=/usr/share/cta-@CTA_VERSION@/unittest/helgrind.suppr \ + /usr/bin/cta-unitTests \ + --gtest_filter=-OStoreDBPlusMockSchedulerTestVFS*:OStoreTestVFS*:OStoreDBPlusMockSchedulerTestVFS*:InMemory* + +helgrindScheduler: + valgrind -q --tool=helgrind @HELGRIND_OPTS_STR@ \ + --suppressions=/usr/share/cta-@CTA_VERSION@/unittest/helgrind.suppr \ + /usr/bin/cta-unitTests \ + --gtest_filter=OStoreDBPlusMockSchedulerTestVFS/Scheduler* + +helgrindOStoreDB: + valgrind -q --tool=helgrind @HELGRIND_OPTS_STR@ \ + --suppressions=/usr/share/cta-@CTA_VERSION@/unittest/helgrind.suppr \ + /usr/bin/cta-unitTests \ + --gtest_filter=OStoreTestVFS* + +helgrindDataTransfer: + valgrind -q --tool=helgrind @HELGRIND_OPTS_STR@ \ + --suppressions=/usr/share/cta-@CTA_VERSION@/unittest/helgrind.suppr \ + /usr/bin/cta-unitTests \ + --gtest_filter=OStoreDBPlusMockSchedulerTestVFS/DataTransferSessionTest* + +helgrindInMemoryCatalogue: + valgrind -q --tool=helgrind @HELGRIND_OPTS_STR@ \ + --suppressions=/usr/share/cta-@CTA_VERSION@/unittest/helgrind.suppr \ + /usr/bin/cta-unitTests \ + --gtest_filter=InMemory/* + +helgrindMultiprocess: + valgrind -q --tool=helgrind @HELGRIND_OPTS_STR@ \ + --suppressions=/usr/share/cta-@CTA_VERSION@/unittest/helgrind.suppr \ + /usr/bin/cta-unitTests-multiProcess \ No newline at end of file