summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--autobuild.xml40
-rwxr-xr-xbuild.sh4
-rw-r--r--indra/CMakeLists.txt26
-rw-r--r--indra/cmake/LLAddBuildTest.cmake41
-rw-r--r--indra/cmake/Variables.cmake5
-rwxr-xr-xindra/cmake/run_build_test.py2
-rw-r--r--indra/integration_tests/llimage_libtest/CMakeLists.txt13
-rw-r--r--indra/integration_tests/llui_libtest/CMakeLists.txt14
-rw-r--r--indra/llcorehttp/CMakeLists.txt7
-rw-r--r--indra/test/CMakeLists.txt75
10 files changed, 151 insertions, 76 deletions
diff --git a/autobuild.xml b/autobuild.xml
index 85b3ea4e63..4dcb2e7d3a 100644
--- a/autobuild.xml
+++ b/autobuild.xml
@@ -3018,7 +3018,7 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors</string>
<key>options</key>
<array>
<string>-G</string>
- <string>Unix Makefiles</string>
+ <string>Ninja</string>
</array>
</map>
<key>build</key>
@@ -3076,7 +3076,7 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors</string>
<key>options</key>
<array>
<string>-G</string>
- <string>Unix Makefiles</string>
+ <string>Ninja</string>
</array>
</map>
<key>build</key>
@@ -3163,19 +3163,15 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors</string>
<key>build</key>
<map>
<key>command</key>
- <string>msbuild.exe</string>
+ <string>cmake</string>
<key>options</key>
<array>
- <string>/p:Configuration=RelWithDebInfo</string>
- <string>/p:Platform=${AUTOBUILD_WIN_VSPLATFORM|NOTWIN}</string>
- <string>/t:Build</string>
- <string>/p:useenv=true</string>
- <string>/verbosity:minimal</string>
- <string>/p:VCBuildAdditionalOptions= /incremental</string>
- </array>
- <key>arguments</key>
- <array>
- <string>SecondLife.sln</string>
+ <string>--build</string>
+ <string>.</string>
+ <string>--config</string>
+ <string>RelWithDebInfo</string>
+ <string>--parallel</string>
+ <string>$AUTOBUILD_CPU_COUNT</string>
</array>
</map>
<key>name</key>
@@ -3237,19 +3233,15 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors</string>
<key>build</key>
<map>
<key>command</key>
- <string>msbuild.exe</string>
+ <string>cmake</string>
<key>options</key>
<array>
- <string>/p:Configuration=Release</string>
- <string>/p:Platform=${AUTOBUILD_WIN_VSPLATFORM|NOTWIN}</string>
- <string>/t:Build</string>
- <string>/p:useenv=true</string>
- <string>/verbosity:minimal</string>
- <string>/p:VCBuildAdditionalOptions= /incremental</string>
- </array>
- <key>arguments</key>
- <array>
- <string>SecondLife.sln</string>
+ <string>--build</string>
+ <string>.</string>
+ <string>--config</string>
+ <string>Release</string>
+ <string>--parallel</string>
+ <string>$AUTOBUILD_CPU_COUNT</string>
</array>
</map>
<key>name</key>
diff --git a/build.sh b/build.sh
index c9f366d64c..31604663f1 100755
--- a/build.sh
+++ b/build.sh
@@ -254,6 +254,10 @@ build()
"$autobuild" build --no-configure -c $variant \
$eval_autobuild_build_parameters \
|| fatal "failed building $variant"
+
+ ctest -C Release --test-dir "${build_dir}" --output-on-failure -j $(nproc --all) \
+ || fatal "failed testing $variant"
+
echo true >"$build_dir"/build_ok
end_section "autobuild $variant"
diff --git a/indra/CMakeLists.txt b/indra/CMakeLists.txt
index a7f0ab0486..fb5cceb9ce 100644
--- a/indra/CMakeLists.txt
+++ b/indra/CMakeLists.txt
@@ -56,6 +56,32 @@ if (NOT CMAKE_BUILD_TYPE)
"Build type. One of: Debug Release RelWithDebInfo" FORCE)
endif (NOT CMAKE_BUILD_TYPE)
+if (LL_TESTS)
+ set(CMAKE_SKIP_TEST_ALL_DEPENDENCY FALSE)
+ include(ProcessorCount)
+ ProcessorCount(NUM_CORES)
+
+ # Set parallel level to decrease test runtime
+ set(CMAKE_CTEST_ARGUMENTS -j${NUM_CORES} --output-on-failure)
+
+ # Set up our test targets
+ set(CTEST_TEST_TARGET_ALIAS BUILD_AND_RUN_TESTS)
+ include(CTest)
+
+ set_target_properties(BUILD_AND_RUN_TESTS
+ PROPERTIES
+ FOLDER "CMakePredefinedTargets"
+ )
+
+ add_custom_target(BUILD_TESTS)
+ add_dependencies(BUILD_AND_RUN_TESTS BUILD_TESTS)
+
+ set_target_properties(BUILD_TESTS
+ PROPERTIES
+ FOLDER "CMakePredefinedTargets"
+ )
+endif ()
+
add_subdirectory(cmake)
if (USE_PRECOMPILED_HEADERS)
diff --git a/indra/cmake/LLAddBuildTest.cmake b/indra/cmake/LLAddBuildTest.cmake
index 4959051617..bd2f894c97 100644
--- a/indra/cmake/LLAddBuildTest.cmake
+++ b/indra/cmake/LLAddBuildTest.cmake
@@ -1,4 +1,11 @@
# -*- cmake -*-
+
+include_guard()
+
+if( NOT LL_TESTS )
+ return()
+endif()
+
include(00-Common)
include(LLTestCommand)
include(bugsplat)
@@ -26,8 +33,6 @@ MACRO(LL_ADD_PROJECT_UNIT_TESTS project sources)
#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
@@ -35,6 +40,7 @@ MACRO(LL_ADD_PROJECT_UNIT_TESTS project sources)
)
set(alltest_LIBRARIES
+ lltut_runner_lib
llcommon
)
if(NOT "${project}" STREQUAL "llmath")
@@ -137,6 +143,7 @@ MACRO(LL_ADD_PROJECT_UNIT_TESTS project sources)
# test binaries always need to be signed for local development
set_target_properties(PROJECT_${project}_TEST_${name}
PROPERTIES
+ OSX_ARCHITECTURES ${LL_MACOS_TEST_ARCHITECTURE}
XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "-")
endif ()
@@ -159,24 +166,15 @@ MACRO(LL_ADD_PROJECT_UNIT_TESTS project sources)
endif()
# Add test
- add_custom_command(
- OUTPUT ${TEST_OUTPUT}
+ add_test(
+ NAME PROJECT_${project}_TEST_${name}
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
+
+ add_dependencies(BUILD_TESTS PROJECT_${project}_TEST_${name})
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)
ENDMACRO(LL_ADD_PROJECT_UNIT_TESTS)
#*****************************************************************************
@@ -204,12 +202,11 @@ FUNCTION(LL_ADD_INTEGRATION_TEST
set(source_files
tests/${testname}_test.cpp
- ${CMAKE_SOURCE_DIR}/test/test.cpp
- ${CMAKE_SOURCE_DIR}/test/lltut.cpp
${additional_source_files}
)
set(libraries
+ lltut_runner_lib
${library_dependencies}
)
@@ -239,6 +236,7 @@ FUNCTION(LL_ADD_INTEGRATION_TEST
# test binaries always need to be signed for local development
set_target_properties(INTEGRATION_TEST_${testname}
PROPERTIES
+ OSX_ARCHITECTURES ${LL_MACOS_TEST_ARCHITECTURE}
XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "-"
BUILD_WITH_INSTALL_RPATH 1
INSTALL_RPATH "@executable_path/Resources"
@@ -286,14 +284,9 @@ FUNCTION(LL_ADD_INTEGRATION_TEST
message(STATUS "TEST_SCRIPT_CMD: ${TEST_SCRIPT_CMD}")
endif()
- add_custom_command(
- TARGET INTEGRATION_TEST_${testname}
- POST_BUILD
- COMMAND ${TEST_SCRIPT_CMD}
- )
+ add_test(NAME INTEGRATION_TEST_RUNNER_${testname} COMMAND ${TEST_SCRIPT_CMD})
- # Use CTEST? Not sure how to yet...
- # ADD_TEST(INTEGRATION_TEST_RUNNER_${testname} ${TEST_SCRIPT_CMD})
+ add_dependencies(BUILD_TESTS INTEGRATION_TEST_${testname})
ENDFUNCTION(LL_ADD_INTEGRATION_TEST)
diff --git a/indra/cmake/Variables.cmake b/indra/cmake/Variables.cmake
index 2341d15a85..81a8f87cd3 100644
--- a/indra/cmake/Variables.cmake
+++ b/indra/cmake/Variables.cmake
@@ -198,6 +198,11 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(CMAKE_XCODE_ATTRIBUTE_DISABLE_MANUAL_TARGET_ORDER_BUILD_WARNING YES)
set(CMAKE_XCODE_ATTRIBUTE_GCC_WARN_64_TO_32_BIT_CONVERSION NO)
set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64" CACHE STRING "macOS Build Arch" FORCE)
+ if(CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64")
+ set(LL_MACOS_TEST_ARCHITECTURE "arm64")
+ else()
+ set(LL_MACOS_TEST_ARCHITECTURE "x86_64")
+ endif()
endif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
# Default deploy grid
diff --git a/indra/cmake/run_build_test.py b/indra/cmake/run_build_test.py
index 940a130a50..85689b361a 100755
--- a/indra/cmake/run_build_test.py
+++ b/indra/cmake/run_build_test.py
@@ -133,7 +133,7 @@ def main(command, arguments=[], libpath=[], vars={}):
raise
# In practice, the pathnames into CMake's build tree are so long as to
# obscure the name of the test program. Just log its basename.
- log.warn("No such program %s; check for preceding build errors" % \
+ log.warning("No such program %s; check for preceding build errors" % \
os.path.basename(command[0]))
# What rc should we simulate for missing executable? Windows produces
# 9009.
diff --git a/indra/integration_tests/llimage_libtest/CMakeLists.txt b/indra/integration_tests/llimage_libtest/CMakeLists.txt
index e6ff142626..40837c8abb 100644
--- a/indra/integration_tests/llimage_libtest/CMakeLists.txt
+++ b/indra/integration_tests/llimage_libtest/CMakeLists.txt
@@ -9,7 +9,6 @@ include(00-Common)
include(LLCommon)
include(LLImage)
include(LLMath)
-include(LLKDU)
set(llimage_libtest_SOURCE_FILES
llimage_libtest.cpp
@@ -26,6 +25,18 @@ add_executable(llimage_libtest
${llimage_libtest_SOURCE_FILES}
)
+set_target_properties(llimage_libtest
+ PROPERTIES
+ FOLDER "Tests"
+ )
+
+if(DARWIN)
+ set_target_properties(llimage_libtest
+ PROPERTIES
+ OSX_ARCHITECTURES ${LL_MACOS_TEST_ARCHITECTURE}
+ )
+endif()
+
# Libraries on which this application depends on
# Sort by high-level to low-level
target_link_libraries(llimage_libtest
diff --git a/indra/integration_tests/llui_libtest/CMakeLists.txt b/indra/integration_tests/llui_libtest/CMakeLists.txt
index a6ce657f4f..19ae1ae215 100644
--- a/indra/integration_tests/llui_libtest/CMakeLists.txt
+++ b/indra/integration_tests/llui_libtest/CMakeLists.txt
@@ -49,9 +49,14 @@ target_link_libraries(llui_libtest
llimagej2coj
)
+set_target_properties(llui_libtest
+ PROPERTIES
+ FOLDER "Tests"
+ )
+
if (WINDOWS)
set_target_properties(llui_libtest
- PROPERTIES
+ PROPERTIES
LINK_FLAGS "/NODEFAULTLIB:LIBCMT"
)
@@ -66,6 +71,13 @@ if (WINDOWS)
)
endif (WINDOWS)
+if(DARWIN)
+ set_target_properties(llui_libtest
+ PROPERTIES
+ OSX_ARCHITECTURES ${LL_MACOS_TEST_ARCHITECTURE}
+ )
+endif()
+
# Ensure people working on the viewer don't break this library
# *NOTE: This could be removed, or only built by Parabuild, if the build
# and link times become too long. JC
diff --git a/indra/llcorehttp/CMakeLists.txt b/indra/llcorehttp/CMakeLists.txt
index 46503a8a4b..58bbdb2d9a 100644
--- a/indra/llcorehttp/CMakeLists.txt
+++ b/indra/llcorehttp/CMakeLists.txt
@@ -169,6 +169,13 @@ if (LL_TESTS AND LLCOREHTTP_TESTS)
)
endif (WINDOWS)
+ if(DARWIN)
+ set_target_properties(http_texture_load
+ PROPERTIES
+ OSX_ARCHITECTURES ${LL_MACOS_TEST_ARCHITECTURE}
+ )
+ endif()
+
target_link_libraries(http_texture_load ${example_libs})
endif (LL_TESTS AND LLCOREHTTP_TESTS)
diff --git a/indra/test/CMakeLists.txt b/indra/test/CMakeLists.txt
index f80286a630..a3cf762f90 100644
--- a/indra/test/CMakeLists.txt
+++ b/indra/test/CMakeLists.txt
@@ -10,6 +10,27 @@ include(Tut)
include(LLAddBuildTest)
include(bugsplat)
+set(test_lib_SOURCE_FILES
+ lltut.cpp
+ test.cpp
+ )
+
+set(test_lib_HEADER_FILES
+ CMakeLists.txt
+ lltut.h
+ )
+
+list(APPEND test_lib_SOURCE_FILES ${test_lib_HEADER_FILES})
+
+add_library(lltut_runner_lib ${test_lib_SOURCE_FILES})
+
+target_link_libraries(lltut_runner_lib PRIVATE llcommon)
+
+set_target_properties(lltut_runner_lib
+ PROPERTIES
+ FOLDER "Tests"
+ )
+
set(test_SOURCE_FILES
io.cpp
llapp_tut.cpp
@@ -31,9 +52,7 @@ set(test_SOURCE_FILES
llservicebuilder_tut.cpp
llstreamtools_tut.cpp
lltemplatemessagebuilder_tut.cpp
- lltut.cpp
message_tut.cpp
- test.cpp
)
set(test_HEADER_FILES
@@ -57,6 +76,7 @@ list(APPEND test_SOURCE_FILES ${test_HEADER_FILES})
add_executable(lltest ${test_SOURCE_FILES})
target_link_libraries(lltest
+ lltut_runner_lib
llinventory
llmessage
llmath
@@ -66,14 +86,27 @@ target_link_libraries(lltest
llcorehttp
)
+set_target_properties(lltest
+ PROPERTIES
+ FOLDER "Tests"
+ )
+
if (WINDOWS)
set_target_properties(lltest
- PROPERTIES
+ PROPERTIES
LINK_FLAGS "/NODEFAULTLIB:LIBCMT"
LINK_FLAGS_DEBUG "/NODEFAULTLIB:\"LIBCMT;LIBCMTD;MSVCRT\""
RUNTIME_OUTPUT_DIRECTORY "${EXE_STAGING_DIR}"
)
elseif (DARWIN)
+ set_target_properties(lltut_runner_lib
+ PROPERTIES
+ OSX_ARCHITECTURES ${LL_MACOS_TEST_ARCHITECTURE}
+ )
+ set_target_properties(lltest
+ PROPERTIES
+ OSX_ARCHITECTURES ${LL_MACOS_TEST_ARCHITECTURE}
+ )
# Support our "@executable_path/../Resources" load path for our test
# executable. This SHOULD properly be "$<TARGET_FILE_DIR:lltest>/Resources",
# but the CMake $<TARGET_FILE_DIR> generator expression isn't evaluated by
@@ -82,32 +115,24 @@ elseif (DARWIN)
SYMBOLIC)
endif (WINDOWS)
-set(TEST_EXE $<TARGET_FILE:lltest>)
-
-SET_TEST_PATH(LD_LIBRARY_PATH)
+# This should cause the test executable to be built, but not
+# run if LL_TESTS is disabled. This will hopefully keep the
+# tests up to date with any code changes changes even if
+# developers choose to disable LL_TESTS.
+if (LL_TESTS)
+ set(TEST_EXE $<TARGET_FILE:lltest>)
-LL_TEST_COMMAND(command
- "${LD_LIBRARY_PATH}"
- "${TEST_EXE}"
- "--output=${CMAKE_CURRENT_BINARY_DIR}/cpp_test_results.txt"
- "--touch=${CMAKE_CURRENT_BINARY_DIR}/cpp_tests_ok.txt")
+ SET_TEST_PATH(LD_LIBRARY_PATH)
-ADD_CUSTOM_COMMAND(
- OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/cpp_tests_ok.txt
- COMMAND ${command}
- DEPENDS lltest
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
- COMMENT "C++ unit tests"
- )
+ LL_TEST_COMMAND(command
+ "${LD_LIBRARY_PATH}"
+ "${TEST_EXE}"
+ "--output=${CMAKE_CURRENT_BINARY_DIR}/cpp_test_results.txt"
+ "--touch=${CMAKE_CURRENT_BINARY_DIR}/cpp_tests_ok.txt")
-set(test_results ${CMAKE_CURRENT_BINARY_DIR}/cpp_tests_ok.txt)
+ add_test(NAME "C++ unit tests" COMMAND ${command} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
-# This should cause the test executable to be built, but not
-# run if LL_TESTS is disabled. This will hopefully keep the
-# tests up to date with any code changes changes even if
-# developers choose to disable LL_TESTS.
-if (LL_TESTS)
- add_custom_target(tests_ok ALL DEPENDS ${test_results})
+ add_dependencies(BUILD_TESTS lltest)
if(DARWIN)
# Support our "@executable_path/../Resources" load path for our test
# executable. This SHOULD properly be "$<TARGET_FILE_DIR:lltest>/Resources",