diff --git a/indra/cmake/LLAddBuildTest.cmake b/indra/cmake/LLAddBuildTest.cmake --- a/indra/cmake/LLAddBuildTest.cmake +++ b/indra/cmake/LLAddBuildTest.cmake @@ -13,163 +13,160 @@ # * properties for each sourcefile passed in indicate what libs to link that file with (MAKE NO ASSUMPTIONS ASIDE FROM TUT) # # More info and examples at: https://wiki.secondlife.com/wiki/How_to_add_unit_tests_to_indra_code - # - # WARNING: do NOT modify this code without working with poppy - - # there is another branch that will conflict heavily with any changes here. -INCLUDE(GoogleMock) - - IF(LL_TEST_VERBOSE) - MESSAGE("LL_ADD_PROJECT_UNIT_TESTS UNITTEST_PROJECT_${project} sources: ${sources}") - ENDIF(LL_TEST_VERBOSE) - - # Start with the header and project-wide setup before making targets - #project(UNITTEST_PROJECT_${project}) - # Setup includes, paths, etc - SET(alltest_SOURCE_FILES - ${CMAKE_SOURCE_DIR}/test/test.cpp - ${CMAKE_SOURCE_DIR}/test/lltut.cpp - ) - SET(alltest_DEP_TARGETS - # needed by the test harness itself - ${APRUTIL_LIBRARIES} - ${APR_LIBRARIES} - llcommon - ) - IF(NOT "${project}" STREQUAL "llmath") - # add llmath as a dep unless the tested module *is* llmath! - LIST(APPEND alltest_DEP_TARGETS - llmath + IF(LL_TESTS) + IF(LL_TEST_VERBOSE) + MESSAGE("LL_ADD_PROJECT_UNIT_TESTS UNITTEST_PROJECT_${project} sources: ${sources}") + ENDIF(LL_TEST_VERBOSE) + + # Start with the header and project-wide setup before making targets + #project(UNITTEST_PROJECT_${project}) + # Setup includes, paths, etc + SET(alltest_SOURCE_FILES + ${CMAKE_SOURCE_DIR}/test/test.cpp + ${CMAKE_SOURCE_DIR}/test/lltut.cpp ) - ENDIF(NOT "${project}" STREQUAL "llmath") - SET(alltest_INCLUDE_DIRS - ${LLMATH_INCLUDE_DIRS} - ${LLCOMMON_INCLUDE_DIRS} - ${LIBS_OPEN_DIR}/test - ${GOOGLEMOCK_INCLUDE_DIRS} - ) - SET(alltest_LIBRARIES - ${GOOGLEMOCK_LIBRARIES} - ${PTHREAD_LIBRARY} - ${WINDOWS_LIBRARIES} - ) - # Headers, for convenience in targets. - SET(alltest_HEADER_FILES - ${CMAKE_SOURCE_DIR}/test/test.h - ) - - # start the source test executable definitions - SET(${project}_TEST_OUTPUT "") - FOREACH (source ${sources}) - STRING( REGEX REPLACE "(.*)\\.[^.]+$" "\\1" name ${source} ) - STRING( REGEX REPLACE ".*\\.([^.]+)$" "\\1" extension ${source} ) - IF(LL_TEST_VERBOSE) - MESSAGE("LL_ADD_PROJECT_UNIT_TESTS UNITTEST_PROJECT_${project} individual source: ${source} (${name}.${extension})") - ENDIF(LL_TEST_VERBOSE) - - # - # Per-codefile additional / external source, header, and include dir property extraction - # - # Source - GET_SOURCE_FILE_PROPERTY(${name}_test_additional_SOURCE_FILES ${source} LL_TEST_ADDITIONAL_SOURCE_FILES) - IF(${name}_test_additional_SOURCE_FILES MATCHES NOTFOUND) - SET(${name}_test_additional_SOURCE_FILES "") - ENDIF(${name}_test_additional_SOURCE_FILES MATCHES NOTFOUND) - SET(${name}_test_SOURCE_FILES ${source} tests/${name}_test.${extension} ${alltest_SOURCE_FILES} ${${name}_test_additional_SOURCE_FILES} ) - IF(LL_TEST_VERBOSE) - MESSAGE("LL_ADD_PROJECT_UNIT_TESTS ${name}_test_SOURCE_FILES ${${name}_test_SOURCE_FILES}") - ENDIF(LL_TEST_VERBOSE) - # Headers - GET_SOURCE_FILE_PROPERTY(${name}_test_additional_HEADER_FILES ${source} LL_TEST_ADDITIONAL_HEADER_FILES) - IF(${name}_test_additional_HEADER_FILES MATCHES NOTFOUND) - SET(${name}_test_additional_HEADER_FILES "") - ENDIF(${name}_test_additional_HEADER_FILES MATCHES NOTFOUND) - SET(${name}_test_HEADER_FILES ${name}.h ${${name}_test_additional_HEADER_FILES}) - set_source_files_properties(${${name}_test_HEADER_FILES} PROPERTIES HEADER_FILE_ONLY TRUE) - LIST(APPEND ${name}_test_SOURCE_FILES ${${name}_test_HEADER_FILES}) - IF(LL_TEST_VERBOSE) - MESSAGE("LL_ADD_PROJECT_UNIT_TESTS ${name}_test_HEADER_FILES ${${name}_test_HEADER_FILES}") - ENDIF(LL_TEST_VERBOSE) - # Include dirs - GET_SOURCE_FILE_PROPERTY(${name}_test_additional_INCLUDE_DIRS ${source} LL_TEST_ADDITIONAL_INCLUDE_DIRS) - IF(${name}_test_additional_INCLUDE_DIRS MATCHES NOTFOUND) - SET(${name}_test_additional_INCLUDE_DIRS "") - ENDIF(${name}_test_additional_INCLUDE_DIRS MATCHES NOTFOUND) - INCLUDE_DIRECTORIES(${alltest_INCLUDE_DIRS} ${${name}_test_additional_INCLUDE_DIRS} ) - IF(LL_TEST_VERBOSE) - MESSAGE("LL_ADD_PROJECT_UNIT_TESTS ${name}_test_additional_INCLUDE_DIRS ${${name}_test_additional_INCLUDE_DIRS}") - ENDIF(LL_TEST_VERBOSE) - - - # Setup target - ADD_EXECUTABLE(PROJECT_${project}_TEST_${name} ${${name}_test_SOURCE_FILES}) - SET_TARGET_PROPERTIES(PROJECT_${project}_TEST_${name} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${EXE_STAGING_DIR}") - - # - # Per-codefile additional / external project dep and lib dep property extraction - # - # WARNING: it's REALLY IMPORTANT to not mix these. I guarantee it will not work in the future. + poppy 2009-04-19 - # Projects - GET_SOURCE_FILE_PROPERTY(${name}_test_additional_PROJECTS ${source} LL_TEST_ADDITIONAL_PROJECTS) - IF(${name}_test_additional_PROJECTS MATCHES NOTFOUND) - SET(${name}_test_additional_PROJECTS "") - ENDIF(${name}_test_additional_PROJECTS MATCHES NOTFOUND) - # Libraries - GET_SOURCE_FILE_PROPERTY(${name}_test_additional_LIBRARIES ${source} LL_TEST_ADDITIONAL_LIBRARIES) - IF(${name}_test_additional_LIBRARIES MATCHES NOTFOUND) - SET(${name}_test_additional_LIBRARIES "") - ENDIF(${name}_test_additional_LIBRARIES MATCHES NOTFOUND) - IF(LL_TEST_VERBOSE) - MESSAGE("LL_ADD_PROJECT_UNIT_TESTS ${name}_test_additional_PROJECTS ${${name}_test_additional_PROJECTS}") - MESSAGE("LL_ADD_PROJECT_UNIT_TESTS ${name}_test_additional_LIBRARIES ${${name}_test_additional_LIBRARIES}") - ENDIF(LL_TEST_VERBOSE) - # Add to project - TARGET_LINK_LIBRARIES(PROJECT_${project}_TEST_${name} ${alltest_LIBRARIES} ${alltest_DEP_TARGETS} ${${name}_test_additional_PROJECTS} ${${name}_test_additional_LIBRARIES} ) - # Compile-time Definitions - GET_SOURCE_FILE_PROPERTY(${name}_test_additional_CFLAGS ${source} LL_TEST_ADDITIONAL_CFLAGS) - IF(NOT ${name}_test_additional_CFLAGS MATCHES NOTFOUND) - SET_TARGET_PROPERTIES(PROJECT_${project}_TEST_${name} PROPERTIES COMPILE_FLAGS ${${name}_test_additional_CFLAGS} ) - IF(LL_TEST_VERBOSE) - MESSAGE("LL_ADD_PROJECT_UNIT_TESTS ${name}_test_additional_CFLAGS ${${name}_test_additional_CFLAGS}") - ENDIF(LL_TEST_VERBOSE) - ENDIF(NOT ${name}_test_additional_CFLAGS MATCHES NOTFOUND) - - # - # Setup test targets - # - GET_TARGET_PROPERTY(TEST_EXE PROJECT_${project}_TEST_${name} LOCATION) - SET(TEST_OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/PROJECT_${project}_TEST_${name}_ok.txt) - SET(TEST_CMD ${TEST_EXE} --touch=${TEST_OUTPUT} --sourcedir=${CMAKE_CURRENT_SOURCE_DIR}) - - # daveh - what configuration does this use? Debug? it's cmake-time, not build time. + poppy 2009-04-19 - IF(LL_TEST_VERBOSE) - MESSAGE(STATUS "LL_ADD_PROJECT_UNIT_TESTS ${name} test_cmd = ${TEST_CMD}") - ENDIF(LL_TEST_VERBOSE) - - SET_TEST_PATH(LD_LIBRARY_PATH) - LL_TEST_COMMAND(TEST_SCRIPT_CMD "${LD_LIBRARY_PATH}" ${TEST_CMD}) - IF(LL_TEST_VERBOSE) - MESSAGE(STATUS "LL_ADD_PROJECT_UNIT_TESTS ${name} test_script = ${TEST_SCRIPT_CMD}") - ENDIF(LL_TEST_VERBOSE) - # Add test - ADD_CUSTOM_COMMAND( - OUTPUT ${TEST_OUTPUT} - COMMAND ${TEST_SCRIPT_CMD} - DEPENDS PROJECT_${project}_TEST_${name} - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + SET(alltest_DEP_TARGETS + # needed by the test harness itself + ${APRUTIL_LIBRARIES} + ${APR_LIBRARIES} + llcommon + ) + IF(NOT "${project}" STREQUAL "llmath") + # add llmath as a dep unless the tested module *is* llmath! + LIST(APPEND alltest_DEP_TARGETS + llmath ) - # Why not add custom target and add POST_BUILD command? - # Slightly less uncertain behavior - # (OUTPUT commands run non-deterministically AFAIK) + poppy 2009-04-19 - # > I did not use a post build step as I could not make it notify of a - # > failure after the first time you build and fail a test. - daveh 2009-04-20 - LIST(APPEND ${project}_TEST_OUTPUT ${TEST_OUTPUT}) - ENDFOREACH (source) - - # Add the test runner target per-project - # (replaces old _test_ok targets all over the place) - ADD_CUSTOM_TARGET(${project}_tests ALL DEPENDS ${${project}_TEST_OUTPUT}) - ADD_DEPENDENCIES(${project} ${project}_tests) + ENDIF(NOT "${project}" STREQUAL "llmath") + SET(alltest_INCLUDE_DIRS + ${LLMATH_INCLUDE_DIRS} + ${LLCOMMON_INCLUDE_DIRS} + ${LIBS_OPEN_DIR}/test + ${GOOGLEMOCK_INCLUDE_DIRS} + ) + SET(alltest_LIBRARIES + ${GOOGLEMOCK_LIBRARIES} + ${PTHREAD_LIBRARY} + ${WINDOWS_LIBRARIES} + ) + # Headers, for convenience in targets. + SET(alltest_HEADER_FILES + ${CMAKE_SOURCE_DIR}/test/test.h + ) + + # start the source test executable definitions + SET(${project}_TEST_OUTPUT "") + FOREACH (source ${sources}) + STRING( REGEX REPLACE "(.*)\\.[^.]+$" "\\1" name ${source} ) + STRING( REGEX REPLACE ".*\\.([^.]+)$" "\\1" extension ${source} ) + IF(LL_TEST_VERBOSE) + MESSAGE("LL_ADD_PROJECT_UNIT_TESTS UNITTEST_PROJECT_${project} individual source: ${source} (${name}.${extension})") + ENDIF(LL_TEST_VERBOSE) + + # + # Per-codefile additional / external source, header, and include dir property extraction + # + # Source + GET_SOURCE_FILE_PROPERTY(${name}_test_additional_SOURCE_FILES ${source} LL_TEST_ADDITIONAL_SOURCE_FILES) + IF(${name}_test_additional_SOURCE_FILES MATCHES NOTFOUND) + SET(${name}_test_additional_SOURCE_FILES "") + ENDIF(${name}_test_additional_SOURCE_FILES MATCHES NOTFOUND) + SET(${name}_test_SOURCE_FILES ${source} tests/${name}_test.${extension} ${alltest_SOURCE_FILES} ${${name}_test_additional_SOURCE_FILES} ) + IF(LL_TEST_VERBOSE) + MESSAGE("LL_ADD_PROJECT_UNIT_TESTS ${name}_test_SOURCE_FILES ${${name}_test_SOURCE_FILES}") + ENDIF(LL_TEST_VERBOSE) + # Headers + GET_SOURCE_FILE_PROPERTY(${name}_test_additional_HEADER_FILES ${source} LL_TEST_ADDITIONAL_HEADER_FILES) + IF(${name}_test_additional_HEADER_FILES MATCHES NOTFOUND) + SET(${name}_test_additional_HEADER_FILES "") + ENDIF(${name}_test_additional_HEADER_FILES MATCHES NOTFOUND) + SET(${name}_test_HEADER_FILES ${name}.h ${${name}_test_additional_HEADER_FILES}) + set_source_files_properties(${${name}_test_HEADER_FILES} PROPERTIES HEADER_FILE_ONLY TRUE) + LIST(APPEND ${name}_test_SOURCE_FILES ${${name}_test_HEADER_FILES}) + IF(LL_TEST_VERBOSE) + MESSAGE("LL_ADD_PROJECT_UNIT_TESTS ${name}_test_HEADER_FILES ${${name}_test_HEADER_FILES}") + ENDIF(LL_TEST_VERBOSE) + # Include dirs + GET_SOURCE_FILE_PROPERTY(${name}_test_additional_INCLUDE_DIRS ${source} LL_TEST_ADDITIONAL_INCLUDE_DIRS) + IF(${name}_test_additional_INCLUDE_DIRS MATCHES NOTFOUND) + SET(${name}_test_additional_INCLUDE_DIRS "") + ENDIF(${name}_test_additional_INCLUDE_DIRS MATCHES NOTFOUND) + INCLUDE_DIRECTORIES(${alltest_INCLUDE_DIRS} ${${name}_test_additional_INCLUDE_DIRS} ) + IF(LL_TEST_VERBOSE) + MESSAGE("LL_ADD_PROJECT_UNIT_TESTS ${name}_test_additional_INCLUDE_DIRS ${${name}_test_additional_INCLUDE_DIRS}") + ENDIF(LL_TEST_VERBOSE) + + + # Setup target + ADD_EXECUTABLE(PROJECT_${project}_TEST_${name} ${${name}_test_SOURCE_FILES}) + SET_TARGET_PROPERTIES(PROJECT_${project}_TEST_${name} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${EXE_STAGING_DIR}") + + # + # Per-codefile additional / external project dep and lib dep property extraction + # + # WARNING: it's REALLY IMPORTANT to not mix these. I guarantee it will not work in the future. + poppy 2009-04-19 + # Projects + GET_SOURCE_FILE_PROPERTY(${name}_test_additional_PROJECTS ${source} LL_TEST_ADDITIONAL_PROJECTS) + IF(${name}_test_additional_PROJECTS MATCHES NOTFOUND) + SET(${name}_test_additional_PROJECTS "") + ENDIF(${name}_test_additional_PROJECTS MATCHES NOTFOUND) + # Libraries + GET_SOURCE_FILE_PROPERTY(${name}_test_additional_LIBRARIES ${source} LL_TEST_ADDITIONAL_LIBRARIES) + IF(${name}_test_additional_LIBRARIES MATCHES NOTFOUND) + SET(${name}_test_additional_LIBRARIES "") + ENDIF(${name}_test_additional_LIBRARIES MATCHES NOTFOUND) + IF(LL_TEST_VERBOSE) + MESSAGE("LL_ADD_PROJECT_UNIT_TESTS ${name}_test_additional_PROJECTS ${${name}_test_additional_PROJECTS}") + MESSAGE("LL_ADD_PROJECT_UNIT_TESTS ${name}_test_additional_LIBRARIES ${${name}_test_additional_LIBRARIES}") + ENDIF(LL_TEST_VERBOSE) + # Add to project + TARGET_LINK_LIBRARIES(PROJECT_${project}_TEST_${name} ${alltest_LIBRARIES} ${alltest_DEP_TARGETS} ${${name}_test_additional_PROJECTS} ${${name}_test_additional_LIBRARIES} ) + # Compile-time Definitions + GET_SOURCE_FILE_PROPERTY(${name}_test_additional_CFLAGS ${source} LL_TEST_ADDITIONAL_CFLAGS) + IF(NOT ${name}_test_additional_CFLAGS MATCHES NOTFOUND) + SET_TARGET_PROPERTIES(PROJECT_${project}_TEST_${name} PROPERTIES COMPILE_FLAGS ${${name}_test_additional_CFLAGS} ) + IF(LL_TEST_VERBOSE) + MESSAGE("LL_ADD_PROJECT_UNIT_TESTS ${name}_test_additional_CFLAGS ${${name}_test_additional_CFLAGS}") + ENDIF(LL_TEST_VERBOSE) + ENDIF(NOT ${name}_test_additional_CFLAGS MATCHES NOTFOUND) + + # + # Setup test targets + # + GET_TARGET_PROPERTY(TEST_EXE PROJECT_${project}_TEST_${name} LOCATION) + SET(TEST_OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/PROJECT_${project}_TEST_${name}_ok.txt) + SET(TEST_CMD ${TEST_EXE} --touch=${TEST_OUTPUT} --sourcedir=${CMAKE_CURRENT_SOURCE_DIR}) + + # daveh - what configuration does this use? Debug? it's cmake-time, not build time. + poppy 2009-04-19 + IF(LL_TEST_VERBOSE) + MESSAGE(STATUS "LL_ADD_PROJECT_UNIT_TESTS ${name} test_cmd = ${TEST_CMD}") + ENDIF(LL_TEST_VERBOSE) + + SET_TEST_PATH(LD_LIBRARY_PATH) + LL_TEST_COMMAND(TEST_SCRIPT_CMD "${LD_LIBRARY_PATH}" ${TEST_CMD}) + IF(LL_TEST_VERBOSE) + MESSAGE(STATUS "LL_ADD_PROJECT_UNIT_TESTS ${name} test_script = ${TEST_SCRIPT_CMD}") + ENDIF(LL_TEST_VERBOSE) + # Add test + ADD_CUSTOM_COMMAND( + OUTPUT ${TEST_OUTPUT} + COMMAND ${TEST_SCRIPT_CMD} + DEPENDS PROJECT_${project}_TEST_${name} + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + ) + # Why not add custom target and add POST_BUILD command? + # Slightly less uncertain behavior + # (OUTPUT commands run non-deterministically AFAIK) + poppy 2009-04-19 + # > I did not use a post build step as I could not make it notify of a + # > failure after the first time you build and fail a test. - daveh 2009-04-20 + LIST(APPEND ${project}_TEST_OUTPUT ${TEST_OUTPUT}) + ENDFOREACH (source) + + # Add the test runner target per-project + # (replaces old _test_ok targets all over the place) + ADD_CUSTOM_TARGET(${project}_tests ALL DEPENDS ${${project}_TEST_OUTPUT}) + ADD_DEPENDENCIES(${project} ${project}_tests) + ENDIF(LL_TESTS) ENDMACRO(LL_ADD_PROJECT_UNIT_TESTS) FUNCTION(LL_ADD_INTEGRATION_TEST @@ -178,76 +175,78 @@ library_dependencies # variable args ) - if(TEST_DEBUG) - message(STATUS "Adding INTEGRATION_TEST_${testname} - debug output is on") - endif(TEST_DEBUG) + if(LL_TESTS) + if(TEST_DEBUG) + message(STATUS "Adding INTEGRATION_TEST_${testname} - debug output is on") + endif(TEST_DEBUG) + + SET(source_files + tests/${testname}_test.cpp + ${CMAKE_SOURCE_DIR}/test/test.cpp + ${CMAKE_SOURCE_DIR}/test/lltut.cpp + ${additional_source_files} + ) - SET(source_files - tests/${testname}_test.cpp - ${CMAKE_SOURCE_DIR}/test/test.cpp - ${CMAKE_SOURCE_DIR}/test/lltut.cpp - ${additional_source_files} - ) + SET(libraries + ${library_dependencies} + ${GOOGLEMOCK_LIBRARIES} + ${PTHREAD_LIBRARY} + ) + + # Add test executable build target + if(TEST_DEBUG) + message(STATUS "ADD_EXECUTABLE(INTEGRATION_TEST_${testname} ${source_files})") + endif(TEST_DEBUG) + ADD_EXECUTABLE(INTEGRATION_TEST_${testname} ${source_files}) + SET_TARGET_PROPERTIES(INTEGRATION_TEST_${testname} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${EXE_STAGING_DIR}") + if(STANDALONE) + SET_TARGET_PROPERTIES(INTEGRATION_TEST_${testname} PROPERTIES COMPILE_FLAGS -I"${TUT_INCLUDE_DIR}") + endif(STANDALONE) + + # Add link deps to the executable + if(TEST_DEBUG) + message(STATUS "TARGET_LINK_LIBRARIES(INTEGRATION_TEST_${testname} ${libraries})") + endif(TEST_DEBUG) + TARGET_LINK_LIBRARIES(INTEGRATION_TEST_${testname} ${libraries}) + + # Create the test running command + SET(test_command ${ARGN}) + GET_TARGET_PROPERTY(TEST_EXE INTEGRATION_TEST_${testname} LOCATION) + LIST(FIND test_command "{}" test_exe_pos) + IF(test_exe_pos LESS 0) + # The {} marker means "the full pathname of the test executable." + # test_exe_pos -1 means we didn't find it -- so append the test executable + # name to $ARGN, the variable part of the arg list. This is convenient + # shorthand for both straightforward execution of the test program (empty + # $ARGN) and for running a "wrapper" program of some kind accepting the + # pathname of the test program as the last of its args. You need specify + # {} only if the test program's pathname isn't the last argument in the + # desired command line. + LIST(APPEND test_command "${TEST_EXE}") + ELSE (test_exe_pos LESS 0) + # Found {} marker at test_exe_pos. Remove the {}... + LIST(REMOVE_AT test_command test_exe_pos) + # ...and replace it with the actual name of the test executable. + LIST(INSERT test_command test_exe_pos "${TEST_EXE}") + ENDIF (test_exe_pos LESS 0) + + SET_TEST_PATH(LD_LIBRARY_PATH) + LL_TEST_COMMAND(TEST_SCRIPT_CMD "${LD_LIBRARY_PATH}" ${test_command}) + + if(TEST_DEBUG) + message(STATUS "TEST_SCRIPT_CMD: ${TEST_SCRIPT_CMD}") + endif(TEST_DEBUG) + + ADD_CUSTOM_COMMAND( + TARGET INTEGRATION_TEST_${testname} + POST_BUILD + COMMAND ${TEST_SCRIPT_CMD} + ) + + # Use CTEST? Not sure how to yet... + # ADD_TEST(INTEGRATION_TEST_RUNNER_${testname} ${TEST_SCRIPT_CMD}) - SET(libraries - ${library_dependencies} - ${GOOGLEMOCK_LIBRARIES} - ${PTHREAD_LIBRARY} - ) - - # Add test executable build target - if(TEST_DEBUG) - message(STATUS "ADD_EXECUTABLE(INTEGRATION_TEST_${testname} ${source_files})") - endif(TEST_DEBUG) - ADD_EXECUTABLE(INTEGRATION_TEST_${testname} ${source_files}) - SET_TARGET_PROPERTIES(INTEGRATION_TEST_${testname} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${EXE_STAGING_DIR}") - if(STANDALONE) - SET_TARGET_PROPERTIES(INTEGRATION_TEST_${testname} PROPERTIES COMPILE_FLAGS -I"${TUT_INCLUDE_DIR}") - endif(STANDALONE) - - # Add link deps to the executable - if(TEST_DEBUG) - message(STATUS "TARGET_LINK_LIBRARIES(INTEGRATION_TEST_${testname} ${libraries})") - endif(TEST_DEBUG) - TARGET_LINK_LIBRARIES(INTEGRATION_TEST_${testname} ${libraries}) - - # Create the test running command - SET(test_command ${ARGN}) - GET_TARGET_PROPERTY(TEST_EXE INTEGRATION_TEST_${testname} LOCATION) - LIST(FIND test_command "{}" test_exe_pos) - IF(test_exe_pos LESS 0) - # The {} marker means "the full pathname of the test executable." - # test_exe_pos -1 means we didn't find it -- so append the test executable - # name to $ARGN, the variable part of the arg list. This is convenient - # shorthand for both straightforward execution of the test program (empty - # $ARGN) and for running a "wrapper" program of some kind accepting the - # pathname of the test program as the last of its args. You need specify - # {} only if the test program's pathname isn't the last argument in the - # desired command line. - LIST(APPEND test_command "${TEST_EXE}") - ELSE (test_exe_pos LESS 0) - # Found {} marker at test_exe_pos. Remove the {}... - LIST(REMOVE_AT test_command test_exe_pos) - # ...and replace it with the actual name of the test executable. - LIST(INSERT test_command test_exe_pos "${TEST_EXE}") - ENDIF (test_exe_pos LESS 0) - - SET_TEST_PATH(LD_LIBRARY_PATH) - LL_TEST_COMMAND(TEST_SCRIPT_CMD "${LD_LIBRARY_PATH}" ${test_command}) - - if(TEST_DEBUG) - message(STATUS "TEST_SCRIPT_CMD: ${TEST_SCRIPT_CMD}") - endif(TEST_DEBUG) - - ADD_CUSTOM_COMMAND( - TARGET INTEGRATION_TEST_${testname} - POST_BUILD - COMMAND ${TEST_SCRIPT_CMD} - ) - - # Use CTEST? Not sure how to yet... - # ADD_TEST(INTEGRATION_TEST_RUNNER_${testname} ${TEST_SCRIPT_CMD}) - + endif(LL_TESTS) ENDFUNCTION(LL_ADD_INTEGRATION_TEST) MACRO(SET_TEST_PATH LISTVAR) diff --git a/indra/cmake/LLTestCommand.cmake b/indra/cmake/LLTestCommand.cmake --- a/indra/cmake/LLTestCommand.cmake +++ b/indra/cmake/LLTestCommand.cmake @@ -1,3 +1,5 @@ +include(Python) + MACRO(LL_TEST_COMMAND OUTVAR LD_LIBRARY_PATH) # nat wonders how Kitware can use the term 'function' for a construct that # cannot return a value. And yet, variables you set inside a FUNCTION are diff --git a/indra/llcharacter/CMakeLists.txt b/indra/llcharacter/CMakeLists.txt --- a/indra/llcharacter/CMakeLists.txt +++ b/indra/llcharacter/CMakeLists.txt @@ -77,12 +77,10 @@ add_library (llcharacter ${llcharacter_SOURCE_FILES}) -if(LL_TESTS) - # Add tests - include(LLAddBuildTest) - # UNIT TESTS - SET(llcharacter_TEST_SOURCE_FILES - lljoint.cpp - ) - LL_ADD_PROJECT_UNIT_TESTS(llcharacter "${llcharacter_TEST_SOURCE_FILES}") -endif(LL_TESTS) +# Add tests +include(LLAddBuildTest) +# UNIT TESTS +SET(llcharacter_TEST_SOURCE_FILES + lljoint.cpp + ) +LL_ADD_PROJECT_UNIT_TESTS(llcharacter "${llcharacter_TEST_SOURCE_FILES}") diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt --- a/indra/llcommon/CMakeLists.txt +++ b/indra/llcommon/CMakeLists.txt @@ -296,36 +296,34 @@ add_dependencies(llcommon stage_third_party_libs) -if (LL_TESTS) - include(LLAddBuildTest) - SET(llcommon_TEST_SOURCE_FILES - # unit-testing llcommon is not possible right now as the test-harness *itself* depends upon llcommon, causing a circular dependency. Add your 'unit' tests as integration tests for now. - ) - LL_ADD_PROJECT_UNIT_TESTS(llcommon "${llcommon_TEST_SOURCE_FILES}") +include(LLAddBuildTest) +SET(llcommon_TEST_SOURCE_FILES + # unit-testing llcommon is not possible right now as the test-harness *itself* depends upon llcommon, causing a circular dependency. Add your 'unit' tests as integration tests for now. + ) +LL_ADD_PROJECT_UNIT_TESTS(llcommon "${llcommon_TEST_SOURCE_FILES}") - #set(TEST_DEBUG on) - set(test_libs llcommon ${LLCOMMON_LIBRARIES} ${WINDOWS_LIBRARIES} ${GOOGLEMOCK_LIBRARIES}) - LL_ADD_INTEGRATION_TEST(commonmisc "" "${test_libs}") - LL_ADD_INTEGRATION_TEST(bitpack "" "${test_libs}") - LL_ADD_INTEGRATION_TEST(llbase64 "" "${test_libs}") - LL_ADD_INTEGRATION_TEST(lldate "" "${test_libs}") - LL_ADD_INTEGRATION_TEST(lldependencies "" "${test_libs}") - LL_ADD_INTEGRATION_TEST(llerror "" "${test_libs}") - LL_ADD_INTEGRATION_TEST(llframetimer "" "${test_libs}") - LL_ADD_INTEGRATION_TEST(llinstancetracker "" "${test_libs}") - LL_ADD_INTEGRATION_TEST(lllazy "" "${test_libs}") - LL_ADD_INTEGRATION_TEST(llprocessor "" "${test_libs}") - LL_ADD_INTEGRATION_TEST(llrand "" "${test_libs}") - LL_ADD_INTEGRATION_TEST(llsdserialize "" "${test_libs}") - LL_ADD_INTEGRATION_TEST(llstring "" "${test_libs}") - LL_ADD_INTEGRATION_TEST(lltreeiterators "" "${test_libs}") - LL_ADD_INTEGRATION_TEST(lluri "" "${test_libs}") - LL_ADD_INTEGRATION_TEST(reflection "" "${test_libs}") - LL_ADD_INTEGRATION_TEST(stringize "" "${test_libs}") - LL_ADD_INTEGRATION_TEST(lleventdispatcher "" "${test_libs}") +#set(TEST_DEBUG on) +set(test_libs llcommon ${LLCOMMON_LIBRARIES} ${WINDOWS_LIBRARIES} ${GOOGLEMOCK_LIBRARIES}) +LL_ADD_INTEGRATION_TEST(commonmisc "" "${test_libs}") +LL_ADD_INTEGRATION_TEST(bitpack "" "${test_libs}") +LL_ADD_INTEGRATION_TEST(llbase64 "" "${test_libs}") +LL_ADD_INTEGRATION_TEST(lldate "" "${test_libs}") +LL_ADD_INTEGRATION_TEST(lldependencies "" "${test_libs}") +LL_ADD_INTEGRATION_TEST(llerror "" "${test_libs}") +LL_ADD_INTEGRATION_TEST(llframetimer "" "${test_libs}") +LL_ADD_INTEGRATION_TEST(llinstancetracker "" "${test_libs}") +LL_ADD_INTEGRATION_TEST(lllazy "" "${test_libs}") +LL_ADD_INTEGRATION_TEST(llprocessor "" "${test_libs}") +LL_ADD_INTEGRATION_TEST(llrand "" "${test_libs}") +LL_ADD_INTEGRATION_TEST(llsdserialize "" "${test_libs}") +LL_ADD_INTEGRATION_TEST(llstring "" "${test_libs}") +LL_ADD_INTEGRATION_TEST(lltreeiterators "" "${test_libs}") +LL_ADD_INTEGRATION_TEST(lluri "" "${test_libs}") +LL_ADD_INTEGRATION_TEST(reflection "" "${test_libs}") +LL_ADD_INTEGRATION_TEST(stringize "" "${test_libs}") +LL_ADD_INTEGRATION_TEST(lleventdispatcher "" "${test_libs}") - # *TODO - reenable these once tcmalloc libs no longer break the build. - #ADD_BUILD_TEST(llallocator llcommon) - #ADD_BUILD_TEST(llallocator_heap_profile llcommon) - #ADD_BUILD_TEST(llmemtype llcommon) -endif (LL_TESTS) +# *TODO - reenable these once tcmalloc libs no longer break the build. +#ADD_BUILD_TEST(llallocator llcommon) +#ADD_BUILD_TEST(llallocator_heap_profile llcommon) +#ADD_BUILD_TEST(llmemtype llcommon) diff --git a/indra/llimage/CMakeLists.txt b/indra/llimage/CMakeLists.txt --- a/indra/llimage/CMakeLists.txt +++ b/indra/llimage/CMakeLists.txt @@ -64,12 +64,10 @@ ) # Add tests -if (LL_TESTS) - SET(llimage_TEST_SOURCE_FILES - llimageworker.cpp - ) - LL_ADD_PROJECT_UNIT_TESTS(llimage "${llimage_TEST_SOURCE_FILES}") -endif (LL_TESTS) +SET(llimage_TEST_SOURCE_FILES + llimageworker.cpp + ) +LL_ADD_PROJECT_UNIT_TESTS(llimage "${llimage_TEST_SOURCE_FILES}") diff --git a/indra/llinventory/CMakeLists.txt b/indra/llinventory/CMakeLists.txt --- a/indra/llinventory/CMakeLists.txt +++ b/indra/llinventory/CMakeLists.txt @@ -59,16 +59,14 @@ add_library (llinventory ${llinventory_SOURCE_FILES}) -if(LL_TESTS) - #add unit tests - INCLUDE(LLAddBuildTest) - SET(llinventory_TEST_SOURCE_FILES - # no real unit tests yet! - ) - LL_ADD_PROJECT_UNIT_TESTS(llinventory "${llinventory_TEST_SOURCE_FILES}") +#add unit tests +INCLUDE(LLAddBuildTest) +SET(llinventory_TEST_SOURCE_FILES + # no real unit tests yet! + ) +LL_ADD_PROJECT_UNIT_TESTS(llinventory "${llinventory_TEST_SOURCE_FILES}") - #set(TEST_DEBUG on) - set(test_libs llinventory ${LLMESSAGE_LIBRARIES} ${LLVFS_LIBRARIES} ${LLMATH_LIBRARIES} ${LLCOMMON_LIBRARIES} ${WINDOWS_LIBRARIES}) - LL_ADD_INTEGRATION_TEST(inventorymisc "" "${test_libs}") - LL_ADD_INTEGRATION_TEST(llparcel "" "${test_libs}") -endif(LL_TESTS) +#set(TEST_DEBUG on) +set(test_libs llinventory ${LLMESSAGE_LIBRARIES} ${LLVFS_LIBRARIES} ${LLMATH_LIBRARIES} ${LLCOMMON_LIBRARIES} ${WINDOWS_LIBRARIES}) +LL_ADD_INTEGRATION_TEST(inventorymisc "" "${test_libs}") +LL_ADD_INTEGRATION_TEST(llparcel "" "${test_libs}") diff --git a/indra/llkdu/CMakeLists.txt b/indra/llkdu/CMakeLists.txt --- a/indra/llkdu/CMakeLists.txt +++ b/indra/llkdu/CMakeLists.txt @@ -44,22 +44,20 @@ add_library (${LLKDU_LIBRARIES} ${llkdu_SOURCE_FILES}) # Add tests - if (LL_TESTS) - include(LLAddBuildTest) - include(Tut) - SET(llkdu_TEST_SOURCE_FILES - llimagej2ckdu.cpp - ) - SET(llkdu_test_additional_HEADER_FILES - llimagej2ckdu.h - llkdumem.h - lltut.h - ) - SET(llkdu_test_additional_INCLUDE_DIRS - ${KDU_INCLUDE_DIR} - ${LLKDU_INCLUDE_DIRS} + include(LLAddBuildTest) + include(Tut) + SET(llkdu_TEST_SOURCE_FILES + llimagej2ckdu.cpp ) - LL_ADD_PROJECT_UNIT_TESTS(llkdu "${llkdu_TEST_SOURCE_FILES}") - endif (LL_TESTS) + SET(llkdu_test_additional_HEADER_FILES + llimagej2ckdu.h + llkdumem.h + lltut.h + ) + SET(llkdu_test_additional_INCLUDE_DIRS + ${KDU_INCLUDE_DIR} + ${LLKDU_INCLUDE_DIRS} + ) + LL_ADD_PROJECT_UNIT_TESTS(llkdu "${llkdu_TEST_SOURCE_FILES}") endif (USE_KDU) diff --git a/indra/llmath/CMakeLists.txt b/indra/llmath/CMakeLists.txt --- a/indra/llmath/CMakeLists.txt +++ b/indra/llmath/CMakeLists.txt @@ -86,29 +86,27 @@ add_library (llmath ${llmath_SOURCE_FILES}) # Add tests -if (LL_TESTS) - include(LLAddBuildTest) - # UNIT TESTS - SET(llmath_TEST_SOURCE_FILES - llbboxlocal.cpp - llmodularmath.cpp - llrect.cpp - v2math.cpp - v3color.cpp - v4color.cpp - v4coloru.cpp - ) - LL_ADD_PROJECT_UNIT_TESTS(llmath "${llmath_TEST_SOURCE_FILES}") +include(LLAddBuildTest) +# UNIT TESTS +SET(llmath_TEST_SOURCE_FILES + llbboxlocal.cpp + llmodularmath.cpp + llrect.cpp + v2math.cpp + v3color.cpp + v4color.cpp + v4coloru.cpp + ) +LL_ADD_PROJECT_UNIT_TESTS(llmath "${llmath_TEST_SOURCE_FILES}") - # INTEGRATION TESTS - set(test_libs llmath llcommon ${LLCOMMON_LIBRARIES} ${WINDOWS_LIBRARIES}) - # TODO: Some of these need refactoring to be proper Unit tests rather than Integration tests. - LL_ADD_INTEGRATION_TEST(llbbox llbbox.cpp "${test_libs}") - LL_ADD_INTEGRATION_TEST(llquaternion llquaternion.cpp "${test_libs}") - LL_ADD_INTEGRATION_TEST(mathmisc "" "${test_libs}") - LL_ADD_INTEGRATION_TEST(m3math "" "${test_libs}") - LL_ADD_INTEGRATION_TEST(v3dmath v3dmath.cpp "${test_libs}") - LL_ADD_INTEGRATION_TEST(v3math v3math.cpp "${test_libs}") - LL_ADD_INTEGRATION_TEST(v4math v4math.cpp "${test_libs}") - LL_ADD_INTEGRATION_TEST(xform xform.cpp "${test_libs}") -endif (LL_TESTS) +# INTEGRATION TESTS +set(test_libs llmath llcommon ${LLCOMMON_LIBRARIES} ${WINDOWS_LIBRARIES}) +# TODO: Some of these need refactoring to be proper Unit tests rather than Integration tests. +LL_ADD_INTEGRATION_TEST(llbbox llbbox.cpp "${test_libs}") +LL_ADD_INTEGRATION_TEST(llquaternion llquaternion.cpp "${test_libs}") +LL_ADD_INTEGRATION_TEST(mathmisc "" "${test_libs}") +LL_ADD_INTEGRATION_TEST(m3math "" "${test_libs}") +LL_ADD_INTEGRATION_TEST(v3dmath v3dmath.cpp "${test_libs}") +LL_ADD_INTEGRATION_TEST(v3math v3math.cpp "${test_libs}") +LL_ADD_INTEGRATION_TEST(v4math v4math.cpp "${test_libs}") +LL_ADD_INTEGRATION_TEST(xform xform.cpp "${test_libs}") diff --git a/indra/llmessage/CMakeLists.txt b/indra/llmessage/CMakeLists.txt --- a/indra/llmessage/CMakeLists.txt +++ b/indra/llmessage/CMakeLists.txt @@ -223,38 +223,36 @@ ) # tests -if (LL_TESTS) - SET(llmessage_TEST_SOURCE_FILES - # llhttpclientadapter.cpp - llmime.cpp - llnamevalue.cpp - lltrustedmessageservice.cpp - lltemplatemessagedispatcher.cpp - llregionpresenceverifier.cpp - ) - LL_ADD_PROJECT_UNIT_TESTS(llmessage "${llmessage_TEST_SOURCE_FILES}") +SET(llmessage_TEST_SOURCE_FILES + # llhttpclientadapter.cpp + llmime.cpp + llnamevalue.cpp + lltrustedmessageservice.cpp + lltemplatemessagedispatcher.cpp + llregionpresenceverifier.cpp + ) +LL_ADD_PROJECT_UNIT_TESTS(llmessage "${llmessage_TEST_SOURCE_FILES}") - # set(TEST_DEBUG on) - set(test_libs - ${LLMESSAGE_LIBRARIES} - ${WINDOWS_LIBRARIES} - ${LLVFS_LIBRARIES} - ${LLMATH_LIBRARIES} - ${LLCOMMON_LIBRARIES} - ${GOOGLEMOCK_LIBRARIES} - ) +# set(TEST_DEBUG on) +set(test_libs + ${LLMESSAGE_LIBRARIES} + ${WINDOWS_LIBRARIES} + ${LLVFS_LIBRARIES} + ${LLMATH_LIBRARIES} + ${LLCOMMON_LIBRARIES} + ${GOOGLEMOCK_LIBRARIES} + ) - LL_ADD_INTEGRATION_TEST( - llsdmessage - "llsdmessage.cpp" - "${test_libs}" - ${PYTHON_EXECUTABLE} - "${CMAKE_CURRENT_SOURCE_DIR}/tests/test_llsdmessage_peer.py" - ) +LL_ADD_INTEGRATION_TEST( + llsdmessage + "llsdmessage.cpp" + "${test_libs}" + ${PYTHON_EXECUTABLE} + "${CMAKE_CURRENT_SOURCE_DIR}/tests/test_llsdmessage_peer.py" + ) - LL_ADD_INTEGRATION_TEST(llavatarnamecache "" "${test_libs}") - LL_ADD_INTEGRATION_TEST(llhost "" "${test_libs}") - LL_ADD_INTEGRATION_TEST(llpartdata "" "${test_libs}") - LL_ADD_INTEGRATION_TEST(llxfer_file "" "${test_libs}") -endif (LL_TESTS) +LL_ADD_INTEGRATION_TEST(llavatarnamecache "" "${test_libs}") +LL_ADD_INTEGRATION_TEST(llhost "" "${test_libs}") +LL_ADD_INTEGRATION_TEST(llpartdata "" "${test_libs}") +LL_ADD_INTEGRATION_TEST(llxfer_file "" "${test_libs}") diff --git a/indra/llplugin/CMakeLists.txt b/indra/llplugin/CMakeLists.txt --- a/indra/llplugin/CMakeLists.txt +++ b/indra/llplugin/CMakeLists.txt @@ -66,21 +66,19 @@ add_subdirectory(slplugin) -if (LL_TESTS) - # Add tests - include(LLAddBuildTest) +# Add tests +include(LLAddBuildTest) - # UNIT TESTS - SET(llplugin_TEST_SOURCE_FILES - llplugincookiestore.cpp - ) +# UNIT TESTS +SET(llplugin_TEST_SOURCE_FILES + llplugincookiestore.cpp + ) - # llplugincookiestore has a dependency on curl, so we need to link the curl library into the test. - set_source_files_properties( - llplugincookiestore.cpp - PROPERTIES - LL_TEST_ADDITIONAL_LIBRARIES "${CURL_LIBRARIES}" - ) +# llplugincookiestore has a dependency on curl, so we need to link the curl library into the test. +set_source_files_properties( + llplugincookiestore.cpp + PROPERTIES + LL_TEST_ADDITIONAL_LIBRARIES "${CURL_LIBRARIES}" + ) - LL_ADD_PROJECT_UNIT_TESTS(llplugin "${llplugin_TEST_SOURCE_FILES}") -endif (LL_TESTS) +LL_ADD_PROJECT_UNIT_TESTS(llplugin "${llplugin_TEST_SOURCE_FILES}") diff --git a/indra/llprimitive/CMakeLists.txt b/indra/llprimitive/CMakeLists.txt --- a/indra/llprimitive/CMakeLists.txt +++ b/indra/llprimitive/CMakeLists.txt @@ -53,11 +53,9 @@ add_library (llprimitive ${llprimitive_SOURCE_FILES}) -if(LL_TESTS) - #add unit tests - INCLUDE(LLAddBuildTest) - SET(llprimitive_TEST_SOURCE_FILES - llmediaentry.cpp - ) - LL_ADD_PROJECT_UNIT_TESTS(llprimitive "${llprimitive_TEST_SOURCE_FILES}") -endif(LL_TESTS) +#add unit tests +INCLUDE(LLAddBuildTest) +SET(llprimitive_TEST_SOURCE_FILES + llmediaentry.cpp + ) +LL_ADD_PROJECT_UNIT_TESTS(llprimitive "${llprimitive_TEST_SOURCE_FILES}") diff --git a/indra/llui/CMakeLists.txt b/indra/llui/CMakeLists.txt --- a/indra/llui/CMakeLists.txt +++ b/indra/llui/CMakeLists.txt @@ -244,12 +244,10 @@ ${LLCOMMON_LIBRARIES} # must be after llimage, llwindow, llrender ) -if(LL_TESTS) - # Add tests - include(LLAddBuildTest) - SET(llui_TEST_SOURCE_FILES - llurlmatch.cpp - llurlentry.cpp - ) - LL_ADD_PROJECT_UNIT_TESTS(llui "${llui_TEST_SOURCE_FILES}") -endif(LL_TESTS) +# Add tests +include(LLAddBuildTest) +SET(llui_TEST_SOURCE_FILES + llurlmatch.cpp + llurlentry.cpp + ) +LL_ADD_PROJECT_UNIT_TESTS(llui "${llui_TEST_SOURCE_FILES}") diff --git a/indra/llvfs/CMakeLists.txt b/indra/llvfs/CMakeLists.txt --- a/indra/llvfs/CMakeLists.txt +++ b/indra/llvfs/CMakeLists.txt @@ -67,17 +67,15 @@ endif (DARWIN) -if(LL_TESTS) - # Add tests - include(LLAddBuildTest) - # UNIT TESTS - SET(llvfs_TEST_SOURCE_FILES - # none so far - ) - LL_ADD_PROJECT_UNIT_TESTS(llvfs "${llvfs_TEST_SOURCE_FILES}") +# Add tests +include(LLAddBuildTest) +# UNIT TESTS +SET(llvfs_TEST_SOURCE_FILES + # none so far + ) +LL_ADD_PROJECT_UNIT_TESTS(llvfs "${llvfs_TEST_SOURCE_FILES}") - # INTEGRATION TESTS - set(test_libs llmath llcommon llvfs ${LLCOMMON_LIBRARIES} ${WINDOWS_LIBRARIES}) - # TODO: Some of these need refactoring to be proper Unit tests rather than Integration tests. - LL_ADD_INTEGRATION_TEST(lldir "" "${test_libs}") -endif(LL_TESTS) +# INTEGRATION TESTS +set(test_libs llmath llcommon llvfs ${LLCOMMON_LIBRARIES} ${WINDOWS_LIBRARIES}) +# TODO: Some of these need refactoring to be proper Unit tests rather than Integration tests. +LL_ADD_INTEGRATION_TEST(lldir "" "${test_libs}") diff --git a/indra/llxml/CMakeLists.txt b/indra/llxml/CMakeLists.txt --- a/indra/llxml/CMakeLists.txt +++ b/indra/llxml/CMakeLists.txt @@ -46,26 +46,23 @@ ) -if(LL_TESTS) - # tests +# tests - # unit tests +# unit tests - SET(llxml_TEST_SOURCE_FILES - # none yet! - ) - LL_ADD_PROJECT_UNIT_TESTS(llxml "${llxml_TEST_SOURCE_FILES}") +SET(llxml_TEST_SOURCE_FILES + # none yet! + ) +LL_ADD_PROJECT_UNIT_TESTS(llxml "${llxml_TEST_SOURCE_FILES}") - # integration tests +# integration tests - # set(TEST_DEBUG on) - set(test_libs - ${LLXML_LIBRARIES} - ${WINDOWS_LIBRARIES} - ${LLMATH_LIBRARIES} - ${LLCOMMON_LIBRARIES} - ) +# set(TEST_DEBUG on) +set(test_libs + ${LLXML_LIBRARIES} + ${WINDOWS_LIBRARIES} + ${LLMATH_LIBRARIES} + ${LLCOMMON_LIBRARIES} + ) - LL_ADD_INTEGRATION_TEST(llcontrol "" "${test_libs}") - -endif(LL_TESTS) +LL_ADD_INTEGRATION_TEST(llcontrol "" "${test_libs}") diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -1890,112 +1890,109 @@ endif(RELEASE_CRASH_REPORTING OR NON_RELEASE_CRASH_REPORTING) endif (PACKAGE) -if (LL_TESTS) - # To add a viewer unit test, just add the test .cpp file below - # This creates a separate test project per file listed. - include(LLAddBuildTest) - SET(viewer_TEST_SOURCE_FILES - llagentaccess.cpp - lldateutil.cpp - llmediadataclient.cpp - lllogininstance.cpp - llremoteparcelrequest.cpp - llviewerhelputil.cpp - llversioninfo.cpp - llworldmap.cpp - llworldmipmap.cpp +# To add a viewer unit test, just add the test .cpp file below +# This creates a separate test project per file listed. +include(LLAddBuildTest) +SET(viewer_TEST_SOURCE_FILES + llagentaccess.cpp + lldateutil.cpp + llmediadataclient.cpp + lllogininstance.cpp + llremoteparcelrequest.cpp + llviewerhelputil.cpp + llversioninfo.cpp + llworldmap.cpp + llworldmipmap.cpp +) + +################################################## +# DISABLING PRECOMPILED HEADERS USAGE FOR TESTS +################################################## +# if(USE_PRECOMPILED_HEADERS) +# set_source_files_properties( +# ${viewer_TEST_SOURCE_FILES} +# PROPERTIES +# LL_TEST_ADDITIONAL_SOURCE_FILES llviewerprecompiledheaders.cpp +# ) +# endif(USE_PRECOMPILED_HEADERS) +LL_ADD_PROJECT_UNIT_TESTS(${VIEWER_BINARY_NAME} "${viewer_TEST_SOURCE_FILES}") + +#set(TEST_DEBUG on) +set(test_sources llcapabilitylistener.cpp) +################################################## +# DISABLING PRECOMPILED HEADERS USAGE FOR TESTS +################################################## +# if(USE_PRECOMPILED_HEADERS) +# set(test_sources "${test_sources}" llviewerprecompiledheaders.cpp) +# endif(USE_PRECOMPILED_HEADERS) +set(test_libs + ${LLMESSAGE_LIBRARIES} + ${WINDOWS_LIBRARIES} + ${LLVFS_LIBRARIES} + ${LLMATH_LIBRARIES} + ${LLCOMMON_LIBRARIES} + ${GOOGLEMOCK_LIBRARIES} ) - ################################################## - # DISABLING PRECOMPILED HEADERS USAGE FOR TESTS - ################################################## - # if(USE_PRECOMPILED_HEADERS) - # set_source_files_properties( - # ${viewer_TEST_SOURCE_FILES} - # PROPERTIES - # LL_TEST_ADDITIONAL_SOURCE_FILES llviewerprecompiledheaders.cpp - # ) - # endif(USE_PRECOMPILED_HEADERS) - LL_ADD_PROJECT_UNIT_TESTS(${VIEWER_BINARY_NAME} "${viewer_TEST_SOURCE_FILES}") - - #set(TEST_DEBUG on) - set(test_sources llcapabilitylistener.cpp) - ################################################## - # DISABLING PRECOMPILED HEADERS USAGE FOR TESTS - ################################################## - # if(USE_PRECOMPILED_HEADERS) - # set(test_sources "${test_sources}" llviewerprecompiledheaders.cpp) - # endif(USE_PRECOMPILED_HEADERS) - set(test_libs - ${LLMESSAGE_LIBRARIES} - ${WINDOWS_LIBRARIES} - ${LLVFS_LIBRARIES} - ${LLMATH_LIBRARIES} - ${LLCOMMON_LIBRARIES} - ${GOOGLEMOCK_LIBRARIES} - ) - - LL_ADD_INTEGRATION_TEST(llcapabilitylistener - "${test_sources}" - "${test_libs}" - ${PYTHON_EXECUTABLE} - "${CMAKE_SOURCE_DIR}/llmessage/tests/test_llsdmessage_peer.py" - ) - - set(test_libs - ${LLMESSAGE_LIBRARIES} - ${WINDOWS_LIBRARIES} - ${LLVFS_LIBRARIES} - ${LLMATH_LIBRARIES} - ${LLCOMMON_LIBRARIES} - ${GOOGLEMOCK_LIBRARIES} - ${OPENSSL_LIBRARIES} - ${CRYPTO_LIBRARIES} +LL_ADD_INTEGRATION_TEST(llcapabilitylistener + "${test_sources}" + "${test_libs}" + ${PYTHON_EXECUTABLE} + "${CMAKE_SOURCE_DIR}/llmessage/tests/test_llsdmessage_peer.py" ) - LL_ADD_INTEGRATION_TEST(llsechandler_basic - llsechandler_basic.cpp - "${test_libs}" - ) +set(test_libs + ${LLMESSAGE_LIBRARIES} + ${WINDOWS_LIBRARIES} + ${LLVFS_LIBRARIES} + ${LLMATH_LIBRARIES} + ${LLCOMMON_LIBRARIES} + ${GOOGLEMOCK_LIBRARIES} + ${OPENSSL_LIBRARIES} + ${CRYPTO_LIBRARIES} +) - LL_ADD_INTEGRATION_TEST(llsecapi - llsecapi.cpp - "${test_libs}" - ) - - set(llslurl_test_sources - llslurl.cpp - llviewernetwork.cpp + LL_ADD_INTEGRATION_TEST(llsechandler_basic + llsechandler_basic.cpp + "${test_libs}" ) +LL_ADD_INTEGRATION_TEST(llsecapi + llsecapi.cpp + "${test_libs}" + ) - LL_ADD_INTEGRATION_TEST(llslurl - "${llslurl_test_sources}" - "${test_libs}" - ) +set(llslurl_test_sources + llslurl.cpp + llviewernetwork.cpp +) - LL_ADD_INTEGRATION_TEST(llviewernetwork - llviewernetwork.cpp - "${test_libs}" - ) - LL_ADD_INTEGRATION_TEST(llsimplestat - "" - "${test_libs}" - ) +LL_ADD_INTEGRATION_TEST(llslurl + "${llslurl_test_sources}" + "${test_libs}" + ) - LL_ADD_INTEGRATION_TEST(llviewerassetstats - llviewerassetstats.cpp - "${test_libs}" - ) +LL_ADD_INTEGRATION_TEST(llviewernetwork + llviewernetwork.cpp + "${test_libs}" + ) - #ADD_VIEWER_BUILD_TEST(llmemoryview viewer) - #ADD_VIEWER_BUILD_TEST(llagentaccess viewer) - #ADD_VIEWER_BUILD_TEST(lltextureinfo viewer) - #ADD_VIEWER_BUILD_TEST(lltextureinfodetails viewer) - #ADD_VIEWER_BUILD_TEST(lltexturestatsuploader viewer) +LL_ADD_INTEGRATION_TEST(llsimplestat + "" + "${test_libs}" + ) -endif (LL_TESTS) +LL_ADD_INTEGRATION_TEST(llviewerassetstats + llviewerassetstats.cpp + "${test_libs}" + ) + +#ADD_VIEWER_BUILD_TEST(llmemoryview viewer) +#ADD_VIEWER_BUILD_TEST(llagentaccess viewer) +#ADD_VIEWER_BUILD_TEST(lltextureinfo viewer) +#ADD_VIEWER_BUILD_TEST(lltextureinfodetails viewer) +#ADD_VIEWER_BUILD_TEST(lltexturestatsuploader viewer) check_message_template(${VIEWER_BINARY_NAME}) diff --git a/indra/viewer_components/login/CMakeLists.txt b/indra/viewer_components/login/CMakeLists.txt --- a/indra/viewer_components/login/CMakeLists.txt +++ b/indra/viewer_components/login/CMakeLists.txt @@ -3,9 +3,7 @@ project(login) include(00-Common) -if(LL_TESTS) - include(LLAddBuildTest) -endif(LL_TESTS) +include(LLAddBuildTest) include(LLCommon) include(LLMath) include(LLXML) @@ -42,10 +40,8 @@ ${LLXML_LIBRARIES} ) -if(LL_TESTS) - SET(lllogin_TEST_SOURCE_FILES - lllogin.cpp - ) +SET(lllogin_TEST_SOURCE_FILES + lllogin.cpp + ) - LL_ADD_PROJECT_UNIT_TESTS(lllogin "${lllogin_TEST_SOURCE_FILES}") -endif(LL_TESTS) +LL_ADD_PROJECT_UNIT_TESTS(lllogin "${lllogin_TEST_SOURCE_FILES}") diff --git a/indra/viewer_components/updater/CMakeLists.txt b/indra/viewer_components/updater/CMakeLists.txt --- a/indra/viewer_components/updater/CMakeLists.txt +++ b/indra/viewer_components/updater/CMakeLists.txt @@ -3,11 +3,9 @@ project(updater_service) include(00-Common) -if(LL_TESTS) - include(LLAddBuildTest) -endif(LL_TESTS) include(CMakeCopyIfDifferent) include(CURL) +include(LLAddBuildTest) include(LLCommon) include(LLMessage) include(LLPlugin) @@ -54,10 +52,9 @@ ${LLVFS_LIBRARIES} ) -if(LL_TESTS) - SET(llupdater_service_TEST_SOURCE_FILES - llupdaterservice.cpp - ) +SET(llupdater_service_TEST_SOURCE_FILES + llupdaterservice.cpp + ) # *NOTE:Mani - I was trying to use the preprocessor seam to mock out # llifstream (and other) llcommon classes. I didn't work @@ -68,8 +65,7 @@ # LL_TEST_ADDITIONAL_CFLAGS "-Dllifstream=llus_mock_llifstream" # ) - LL_ADD_PROJECT_UNIT_TESTS(llupdaterservice "${llupdater_service_TEST_SOURCE_FILES}") -endif(LL_TESTS) +LL_ADD_PROJECT_UNIT_TESTS(llupdaterservice "${llupdater_service_TEST_SOURCE_FILES}") set(UPDATER_INCLUDE_DIRS ${LIBS_OPEN_DIR}/viewer_components/updater