Commit e0192925 authored by Eric Cano's avatar Eric Cano
Browse files

Packaged the unit tests and system tests in RPMs for continuous integration.

parent 9f9de3eb
......@@ -59,3 +59,6 @@ add_library(ctatapeserverfileunittests SHARED
target_link_libraries(ctatapeserverfileunittests
File)
install(TARGETS ctatapeserverfileunittests DESTINATION usr/${CMAKE_INSTALL_LIBDIR})
......@@ -27,3 +27,6 @@ add_library (ctatapeserverutilsunittests SHARED
target_link_libraries (ctatapeserverutilsunittests
Utils)
install(TARGETS ctatapeserverutilsunittests DESTINATION usr/${CMAKE_INSTALL_LIBDIR})
......@@ -51,3 +51,5 @@ add_library (ctautilsunittests SHARED
SmartArrayPtrTest.cpp
SmartFdTest.cpp
UtilsTest.cpp)
install(TARGETS ctautilsunittests DESTINATION usr/${CMAKE_INSTALL_LIBDIR})
......@@ -17,11 +17,11 @@ cmake_minimum_required (VERSION 2.6)
find_package(gmock REQUIRED)
add_executable(unitTests
add_executable(cta-unitTests
unit_tests.cpp
${GMOCK_SRC})
target_link_libraries(unitTests
target_link_libraries(cta-unitTests
ctacatalogueunittests
ctaexceptionunittests
ctaiounittests
......@@ -57,14 +57,21 @@ target_link_libraries(systemTestHelperTests
systemTestHelper
ctacommon)
add_executable(systemTests
add_executable(cta-systemTests
system_tests.cpp
${GMOCK_SRC})
target_link_libraries(systemTests
target_link_libraries(cta-systemTests
systemTestHelper
systemTestHelperTests
gtest
pthread)
install(TARGETS cta-unitTests cta-systemTests DESTINATION usr/bin)
install(TARGETS systemTestHelperTests DESTINATION usr/${CMAKE_INSTALL_LIBDIR})
configure_file(cta-valgrindUnitTests.sh.in ${CMAKE_CURRENT_BINARY_DIR}/cta-valgrindUnitTests.sh)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/cta-valgrindUnitTests.sh DESTINATION usr/bin)
install(FILES valgrind.suppr helgrind.suppr DESTINATION usr/share/cta-${CTA_VERSION}/unittest/)
......@@ -72,7 +72,8 @@ Subprocess::Subprocess(const std::string & executable, const std::list<std::stri
}
cargv[argv.size()] = NULL;
cta::exception::Errnum::throwOnMinusOne(
execvp(executable.c_str(), cargv));
execvp(executable.c_str(), cargv),
"In Subprocess::Subprocess execv failed: ");
// We should never get here.
throw cta::exception::Exception(
"In Subprocess::Subprocess execv failed without returning -1!");
......@@ -81,7 +82,7 @@ Subprocess::Subprocess(const std::string & executable, const std::list<std::stri
exit(EXIT_FAILURE);
}
}
}
}
void Subprocess::kill(int signal) {
::kill(m_child, signal);
......@@ -128,4 +129,4 @@ Subprocess::~Subprocess() {
}
}
\ No newline at end of file
} // namespace systemTests
\ No newline at end of file
......@@ -32,5 +32,10 @@ TEST(SuprocessHelper, basicTests) {
ASSERT_EQ("", sp2.stdout());
ASSERT_NE(std::string::npos, sp2.stderr().find("/no/such/file"));
ASSERT_EQ(1, sp2.exitValue());
Subprocess sp3("/no/such/file", std::list<std::string>({"/no/such/file"}));
sp3.wait();
ASSERT_EQ("", sp3.stdout());
ASSERT_NE(std::string::npos, sp3.stderr().find("In Subprocess::Subprocess execv failed"));
ASSERT_EQ(1, sp3.exitValue());
}
}
\ No newline at end of file
#!/bin/bash
# exit from the script on any error.
set -e
/usr/bin/cta-unitTests --gtest_color=yes
valgrind --track-fds=yes --leak-check=full --demangle=yes --gen-suppressions=all --show-reachable=yes \
--error-exitcode=1 --suppressions=/usr/share/cta-@CTA_VERSION@/unittest/valgrind.suppr \
/usr/bin/cta-unitTests --gtest_color=yes
valgrind --tool=helgrind -v --demangle=yes --gen-suppressions=all --conflict-cache-size=30000000 \
--error-exitcode=1 --suppressions=/usr/share/cta-@CTA_VERSION@/unittest/helgrind.suppr \
/usr/bin/cta-unitTests --gtest_color=yes
{
liblttnq1
Helgrind:Race
fun:lttng_ust_init
obj:/usr/lib64/liblttng-ust.so.0.0.0
obj:/usr/lib64/liblttng-ust.so.0.0.0
}
{
pthread_tests1
Helgrind:Misc
fun:pthread_mutex_*
...
fun:*unitTests*castor_tape_threading*
fun:_ZN7testing4Test3RunEv
fun:_ZN7testing8internal12TestInfoImpl3RunEv
fun:_ZN7testing8TestCase3RunEv
fun:_ZN7testing8internal12UnitTestImpl11RunAllTestsEv
fun:main
}
{
pthread_tests2
Helgrind:UnlockUnlocked
fun:pthread_mutex_*
...
fun:*unitTests*castor_tape_threading*
fun:_ZN7testing4Test3RunEv
fun:_ZN7testing8internal12TestInfoImpl3RunEv
fun:_ZN7testing8TestCase3RunEv
fun:_ZN7testing8internal12UnitTestImpl11RunAllTestsEv
fun:main
}
{
pthread_tests3
Helgrind:PthAPIerror
fun:pthread_mutex_*
...
fun:*unitTests*castor_tape_threading*
fun:_ZN7testing4Test3RunEv
fun:_ZN7testing8internal12TestInfoImpl3RunEv
fun:_ZN7testing8TestCase3RunEv
fun:_ZN7testing8internal12UnitTestImpl11RunAllTestsEv
fun:main
}
{
pthread_tests4
Helgrind:Misc
fun:pthread_mutex_*
...
fun:*unitTests*castor_messages_Mutex*
fun:_ZN7testing4Test3RunEv
fun:_ZN7testing8internal12TestInfoImpl3RunEv
fun:_ZN7testing8TestCase3RunEv
fun:_ZN7testing8internal12UnitTestImpl11RunAllTestsEv
fun:main
}
{
pthread_tests5
Helgrind:PthAPIerror
fun:pthread_mutex_*
...
fun:*unitTests*castor_messages_Mutex*
fun:_ZN7testing4Test3RunEv
fun:_ZN7testing8internal12TestInfoImpl3RunEv
fun:_ZN7testing8TestCase3RunEv
fun:_ZN7testing8internal12UnitTestImpl11RunAllTestsEv
fun:main
}
{
pthread_tests6
Helgrind:UnlockUnlocked
fun:pthread_mutex_*
...
fun:*unitTests*castor_messages_Mutex*
fun:_ZN7testing4Test3RunEv
fun:_ZN7testing8internal12TestInfoImpl3RunEv
fun:_ZN7testing8TestCase3RunEv
fun:_ZN7testing8internal12UnitTestImpl11RunAllTestsEv
fun:main
}
{
pthread_test7
Helgrind:Misc
fun:pthread_cond_*
...
fun:_ZN9unitTests*castor_tape_threading_*
fun:_ZN7testing4Test3RunEv
fun:_ZN7testing8internal12TestInfoImpl3RunEv
fun:_ZN7testing8TestCase3RunEv
fun:_ZN7testing8internal12UnitTestImpl11RunAllTestsEv
fun:main
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment