summaryrefslogtreecommitdiff
path: root/indra/test
diff options
context:
space:
mode:
authorSteve Bennetts <steve@lindenlab.com>2009-10-12 13:22:58 -0700
committerSteve Bennetts <steve@lindenlab.com>2009-10-12 13:22:58 -0700
commit4a1ef20c317897e7e509c7f599e97fcc90ffaefc (patch)
treec496bd8785b94bb60bca33ea59758c5929341451 /indra/test
parent895e8ad446ab383e1211f759e8b55aa0fff2efc1 (diff)
parentd4b2897700c66354413af42ab055bd1aaa47f91c (diff)
merge
Diffstat (limited to 'indra/test')
-rw-r--r--indra/test/CMakeLists.txt17
-rw-r--r--indra/test/test.cpp10
2 files changed, 23 insertions, 4 deletions
diff --git a/indra/test/CMakeLists.txt b/indra/test/CMakeLists.txt
index 463eedb4fd..98ad8af02d 100644
--- a/indra/test/CMakeLists.txt
+++ b/indra/test/CMakeLists.txt
@@ -14,6 +14,7 @@ include(LScript)
include(Linking)
include(Tut)
include(Boost)
+include(GoogleMock)
include_directories(
${LLCOMMON_INCLUDE_DIRS}
@@ -24,6 +25,7 @@ include_directories(
${LLVFS_INCLUDE_DIRS}
${LLXML_INCLUDE_DIRS}
${LSCRIPT_INCLUDE_DIRS}
+ ${GOOGLEMOCK_INCLUDE_DIRS}
)
set(test_SOURCE_FILES
@@ -126,6 +128,7 @@ target_link_libraries(test
${LLXML_LIBRARIES}
${LSCRIPT_LIBRARIES}
${LLCOMMON_LIBRARIES}
+ ${GOOGLEMOCK_LIBRARIES}
${APRICONV_LIBRARIES}
${PTHREAD_LIBRARY}
${WINDOWS_LIBRARIES}
@@ -145,12 +148,18 @@ endif (WINDOWS)
get_target_property(TEST_EXE test LOCATION)
+SET(TEST_CMD ${TEST_EXE} --touch=${TEST_OUTPUT} --sourcedir=${CMAKE_CURRENT_SOURCE_DIR})
+
+SET(TEST_LD_CMD
+ ${CMAKE_COMMAND}
+ -DLD_LIBRARY_PATH=${ARCH_PREBUILT_DIRS}:/usr/lib
+ -DTEST_CMD:STRING="${TEST_CMD}"
+ -P ${CMAKE_SOURCE_DIR}/cmake/RunBuildTest.cmake
+ )
+
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/cpp_tests_ok.txt
- COMMAND ${TEST_EXE}
- ARGS
- --output=${CMAKE_CURRENT_BINARY_DIR}/cpp_test_results.txt
- --touch=${CMAKE_CURRENT_BINARY_DIR}/cpp_tests_ok.txt
+ COMMAND ${TEST_LD_CMD}
DEPENDS test
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "C++ unit tests"
diff --git a/indra/test/test.cpp b/indra/test/test.cpp
index 2f50d872ee..721e9da917 100644
--- a/indra/test/test.cpp
+++ b/indra/test/test.cpp
@@ -54,6 +54,11 @@
# include "ctype_workaround.h"
#endif
+#ifndef LL_WINDOWS
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+#endif
+
namespace tut
{
std::string sSourceDir;
@@ -235,6 +240,11 @@ void wouldHaveCrashed(const std::string& message)
int main(int argc, char **argv)
{
+ // The following line must be executed to initialize Google Mock
+ // (and Google Test) before running the tests.
+#ifndef LL_WINDOWS
+ ::testing::InitGoogleMock(&argc, argv);
+#endif
LLError::initForApplication(".");
LLError::setFatalFunction(wouldHaveCrashed);
LLError::setDefaultLevel(LLError::LEVEL_ERROR);