|
Boost-Commit : |
From: troy_at_[hidden]
Date: 2008-06-02 16:59:08
Author: troy
Date: 2008-06-02 16:59:08 EDT (Mon, 02 Jun 2008)
New Revision: 46057
URL: http://svn.boost.org/trac/boost/changeset/46057
Log:
Testing without CTest: works on linux. Python scripts in tools/build/CMake and
rules in tools/build/CMake/BoostBuildSlave.cmake need updating.
Added:
branches/CMake/release/tools/build/CMake/BoostBuildSlave.cmake (contents, props changed)
branches/CMake/release/tools/build/CMake/passthru.py.in (contents, props changed)
branches/CMake/release/tools/build/CMake/post.py.in (contents, props changed)
branches/CMake/release/tools/build/CMake/xmlize.py.in (contents, props changed)
Removed:
branches/CMake/release/tools/build/CMake/CompileTest/
Text files modified:
branches/CMake/release/CMakeLists.txt | 1
branches/CMake/release/tools/build/CMake/BoostCore.cmake | 150 +++++++++++--------
branches/CMake/release/tools/build/CMake/BoostTesting.cmake | 297 ++++++++++++++++++++-------------------
3 files changed, 236 insertions(+), 212 deletions(-)
Modified: branches/CMake/release/CMakeLists.txt
==============================================================================
--- branches/CMake/release/CMakeLists.txt (original)
+++ branches/CMake/release/CMakeLists.txt 2008-06-02 16:59:08 EDT (Mon, 02 Jun 2008)
@@ -40,6 +40,7 @@
# Boost CMake modules #
##########################################################################
list(APPEND CMAKE_MODULE_PATH ${Boost_SOURCE_DIR}/tools/build/CMake)
+include(BoostBuildSlave)
include(BoostUtils)
include(BoostConfig)
include(BoostCore)
Added: branches/CMake/release/tools/build/CMake/BoostBuildSlave.cmake
==============================================================================
--- (empty file)
+++ branches/CMake/release/tools/build/CMake/BoostBuildSlave.cmake 2008-06-02 16:59:08 EDT (Mon, 02 Jun 2008)
@@ -0,0 +1,67 @@
+##########################################################################
+# Boost Build Slave Support #
+##########################################################################
+# Copyright (C) 2008 Troy D. Straszheim #
+# #
+# Distributed under the Boost Software License, Version 1.0. #
+# See accompanying file LICENSE_1_0.txt or copy at #
+# http://www.boost.org/LICENSE_1_0.txt #
+##########################################################################
+option(BOOST_BUILD_SLAVE "Be a build slave, report build/testing" OFF)
+
+message(STATUS "Configuring test/compile drivers")
+
+if(CMAKE_VERBOSE_MAKEFILE)
+ set(BOOST_DRIVER_VERBOSE True)
+else(CMAKE_VERBOSE_MAKEFILE)
+ set(BOOST_DRIVER_VERBOSE False)
+endif(CMAKE_VERBOSE_MAKEFILE)
+
+# the program that does the posting when BOOST_BUILD_SLAVE is on
+configure_file(tools/build/CMake/post.py.in ${CMAKE_BINARY_DIR}/post.py @ONLY)
+
+# the programs that sit between 'make' and the test binaries, one does xmlization
+# the other doesn't. T
+configure_file(tools/build/CMake/passthru.py.in ${CMAKE_BINARY_DIR}/passthru.py @ONLY)
+configure_file(tools/build/CMake/xmlize.py.in ${CMAKE_BINARY_DIR}/xmlize.py @ONLY)
+
+#
+# the test driver is either
+#
+if(BOOST_BUILD_SLAVE)
+ set(BOOST_TEST_DRIVER ${CMAKE_BINARY_DIR}/xmlize.py)
+else(BOOST_BUILD_SLAVE)
+ set(BOOST_TEST_DRIVER ${CMAKE_BINARY_DIR}/passthru.py)
+endif(BOOST_BUILD_SLAVE)
+
+if(BOOST_BUILD_SLAVE)
+
+ #
+ # Redirect various build steps
+ #
+ set(CMAKE_CXX_COMPILE_OBJECT
+ "${BOOST_TEST_DRIVER} <CMAKE_CURRENT_BINARY_DIR> cxx_compile_object <OBJECT> ${CMAKE_CXX_COMPILE_OBJECT}")
+
+ set(CMAKE_CXX_CREATE_SHARED_LIBRARY
+ "${BOOST_TEST_DRIVER} <CMAKE_CURRENT_BINARY_DIR> create_shared_library <TARGET> ${CMAKE_CXX_CREATE_SHARED_LIBRARY}")
+
+ set(CMAKE_CXX_CREATE_STATIC_LIBRARY
+ "${BOOST_TEST_DRIVER} <CMAKE_CURRENT_BINARY_DIR> create_static_library <TARGET> ${CMAKE_CXX_CREATE_STATIC_LIBRARY}")
+
+ set(CMAKE_CXX_LINK_EXECUTABLE
+ "${BOOST_TEST_DRIVER} <CMAKE_CURRENT_BINARY_DIR> link_executable <TARGET> ${CMAKE_CXX_LINK_EXECUTABLE}")
+
+endif(BOOST_BUILD_SLAVE)
+
+macro(boost_post_results PROJECT_NAME_ LIBRARY_TARGET WHAT LOGDIR)
+
+ if(BOOST_BUILD_SLAVE)
+ add_custom_command(TARGET ${LIBRARY_TARGET}
+ POST_BUILD
+ COMMAND ${CMAKE_BINARY_DIR}/post.py ${PROJECT_NAME_} ${WHAT} ${LOGDIR}
+ COMMENT "${PROJECT_NAME_}: posting build results for ${WHAT} from ${LOGDIR}"
+ )
+ set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES ${LOGDIR}/Log.xml)
+
+ endif(BOOST_BUILD_SLAVE)
+endmacro(boost_post_results LIBRARY_TARGET)
Modified: branches/CMake/release/tools/build/CMake/BoostCore.cmake
==============================================================================
--- branches/CMake/release/tools/build/CMake/BoostCore.cmake (original)
+++ branches/CMake/release/tools/build/CMake/BoostCore.cmake 2008-06-02 16:59:08 EDT (Mon, 02 Jun 2008)
@@ -277,12 +277,26 @@
"Enable testing of Boost.${LIBNAME}"
ON)
- # Only include the test directories when testing is enabled for
- # this project.
+ # Only create test target and include the test directories
+ # when testing is enabled for this project.
if(${BOOST_TEST_LIB_OPTION})
+ add_custom_target(${PROJECT_NAME}-test)
+
+ add_dependencies(test
+ ${PROJECT_NAME}-test
+ )
+
+ # the last argument here, the binary directory that the
+ # logs are in, has to match the binary directory
+ # passed to 'add_subdirectory', in the foreach() just below
+ boost_post_results(${PROJECT_NAME} ${PROJECT_NAME}-test
+ test
+ ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-test)
+
foreach(SUBDIR ${THIS_PROJECT_TESTDIRS})
- add_subdirectory(${SUBDIR})
- endforeach(SUBDIR ${THIS_PROJECT_TESTDIRS})
+ add_subdirectory(${SUBDIR} ${PROJECT_NAME}-test)
+ endforeach()
+
endif(${BOOST_TEST_LIB_OPTION})
endif(BUILD_TESTING AND THIS_PROJECT_TESTDIRS)
@@ -705,73 +719,77 @@
# The basic LIBNAME target depends on each of the variants
add_dependencies(${LIBNAME} ${VARIANT_LIBNAME})
+ boost_post_results(${PROJECT_NAME} ${VARIANT_LIBNAME} build ${CMAKE_CURRENT_BINARY_DIR})
+
# Link against whatever libraries this library depends on
target_link_libraries(${VARIANT_LIBNAME} ${THIS_VARIANT_LINK_LIBS})
foreach(dependency ${THIS_LIB_DEPENDS})
target_link_libraries(${VARIANT_LIBNAME} "${dependency}${VARIANT_TARGET_NAME}")
endforeach(dependency)
- # Setup installation properties
- string(TOUPPER "${PROJECT_NAME}${VARIANT_TARGET_NAME}" LIB_COMPONENT)
- string(REPLACE "-" "_" LIB_COMPONENT ${LIB_COMPONENT})
- get_property(LIB_COMPONENT_EXISTS
- GLOBAL PROPERTY CPACK_COMPONENT_${LIB_COMPONENT}_DISPLAY_NAME SET)
- if (LIB_COMPONENT_EXISTS)
- # There is more than one library binary associated with this
- # installation component (e.g., both boost_serialization and
- # boost_wserialization library binaries), so update the
- # display name of the installation component to the plural
- # "libraries".
- set_property(GLOBAL
- PROPERTY CPACK_COMPONENT_${LIB_COMPONENT}_DISPLAY_NAME
- "${VARIANT_DISPLAY_NAME} libraries")
- else()
- set_property(GLOBAL APPEND
- PROPERTY CPACK_COMPONENTS_ALL
- ${LIB_COMPONENT})
- boost_set_cpack_variable(
- CPACK_COMPONENT_${LIB_COMPONENT}_DISPLAY_NAME
- "${VARIANT_DISPLAY_NAME} library")
- boost_set_cpack_variable(
- CPACK_COMPONENT_${LIB_COMPONENT}_GROUP
- ${ULIBNAME})
- endif()
-
- # Installation of this library variant
- string(TOUPPER ${PROJECT_NAME} ULIBNAME)
- install(TARGETS ${VARIANT_LIBNAME} DESTINATION lib
- EXPORT boost-targets
- COMPONENT ${LIB_COMPONENT})
- set_property(
- TARGET ${VARIANT_LIBNAME}
- PROPERTY BOOST_CPACK_COMPONENT
- ${LIB_COMPONENT})
+ if(NOT THIS_LIB_NO_INSTALL)
+ # Setup installation properties
+ string(TOUPPER "${PROJECT_NAME}${VARIANT_TARGET_NAME}" LIB_COMPONENT)
+ string(REPLACE "-" "_" LIB_COMPONENT ${LIB_COMPONENT})
+ get_property(LIB_COMPONENT_EXISTS
+ GLOBAL PROPERTY CPACK_COMPONENT_${LIB_COMPONENT}_DISPLAY_NAME SET)
+ if (LIB_COMPONENT_EXISTS)
+ # There is more than one library binary associated with this
+ # installation component (e.g., both boost_serialization and
+ # boost_wserialization library binaries), so update the
+ # display name of the installation component to the plural
+ # "libraries".
+ set_property(GLOBAL
+ PROPERTY CPACK_COMPONENT_${LIB_COMPONENT}_DISPLAY_NAME
+ "${VARIANT_DISPLAY_NAME} libraries")
+ else()
+ set_property(GLOBAL APPEND
+ PROPERTY CPACK_COMPONENTS_ALL
+ ${LIB_COMPONENT})
+ boost_set_cpack_variable(
+ CPACK_COMPONENT_${LIB_COMPONENT}_DISPLAY_NAME
+ "${VARIANT_DISPLAY_NAME} library")
+ boost_set_cpack_variable(
+ CPACK_COMPONENT_${LIB_COMPONENT}_GROUP
+ ${ULIBNAME})
+ endif()
+
+ # Installation of this library variant
+ string(TOUPPER ${PROJECT_NAME} ULIBNAME)
+ install(TARGETS ${VARIANT_LIBNAME} DESTINATION lib
+ EXPORT boost-targets
+ COMPONENT ${LIB_COMPONENT})
+ set_property(
+ TARGET ${VARIANT_LIBNAME}
+ PROPERTY BOOST_CPACK_COMPONENT
+ ${LIB_COMPONENT})
- # Make the library installation component dependent on the library
- # installation components of dependent libraries.
- foreach(DEP ${THIS_LIB_DEPENDS})
- # We ask the library variant that this library depends on to tell us
- # what it's associated installation component is. We depend on that
- # installation component.
- get_property(DEP_COMPONENT
- TARGET "${DEP}${VARIANT_TARGET_NAME}"
- PROPERTY BOOST_CPACK_COMPONENT)
+ # Make the library installation component dependent on the library
+ # installation components of dependent libraries.
+ foreach(DEP ${THIS_LIB_DEPENDS})
+ # We ask the library variant that this library depends on to tell us
+ # what it's associated installation component is. We depend on that
+ # installation component.
+ get_property(DEP_COMPONENT
+ TARGET "${DEP}${VARIANT_TARGET_NAME}"
+ PROPERTY BOOST_CPACK_COMPONENT)
- if (DEP_COMPONENT)
- if (DEP_COMPONENT STREQUAL LIB_COMPONENT)
- # Do nothing: we have library dependencies within one
- # Boost library
- else()
- set_property(GLOBAL APPEND
- PROPERTY CPACK_COMPONENT_${LIB_COMPONENT}_DEPENDS ${DEP_COMPONENT})
- endif()
- endif()
- endforeach(DEP)
- if (THIS_LIB_DEPENDS)
- set_property(GLOBAL APPEND
- PROPERTY BOOST_CPACK_EXPORTS
- CPACK_COMPONENT_${LIB_COMPONENT}_DEPENDS)
- endif ()
+ if (DEP_COMPONENT)
+ if (DEP_COMPONENT STREQUAL LIB_COMPONENT)
+ # Do nothing: we have library dependencies within one
+ # Boost library
+ else()
+ set_property(GLOBAL APPEND
+ PROPERTY CPACK_COMPONENT_${LIB_COMPONENT}_DEPENDS ${DEP_COMPONENT})
+ endif()
+ endif()
+ endforeach(DEP)
+ if (THIS_LIB_DEPENDS)
+ set_property(GLOBAL APPEND
+ PROPERTY BOOST_CPACK_EXPORTS
+ CPACK_COMPONENT_${LIB_COMPONENT}_DEPENDS)
+ endif ()
+ endif(NOT THIS_LIB_NO_INSTALL)
endif (THIS_VARIANT_OKAY)
endmacro(boost_library_variant)
@@ -1043,7 +1061,7 @@
macro(boost_add_library LIBNAME)
parse_arguments(THIS_LIB
"DEPENDS;COMPILE_FLAGS;LINK_FLAGS;LINK_LIBS;EXTRA_VARIANTS;${BOOST_ADD_ARG_NAMES}"
- "STATIC_TAG;MODULE;${BOOST_ADDLIB_OPTION_NAMES}"
+ "STATIC_TAG;MODULE;NO_INSTALL;${BOOST_ADDLIB_OPTION_NAMES}"
${ARGN}
)
set(THIS_LIB_SOURCES ${THIS_LIB_DEFAULT_ARGS})
@@ -1052,7 +1070,7 @@
# A top-level target that refers to all of the variants of the
# library, collectively.
add_custom_target(${LIBNAME})
-
+
if (THIS_LIB_EXTRA_VARIANTS)
# Build the set of variants that we will generate for this library
set(THIS_LIB_VARIANTS)
@@ -1330,7 +1348,7 @@
if (THIS_PROJECT_IS_TOOL)
set(THIS_EXE_NAME ${EXENAME})
else()
- set(THIS_EXE_NAME ${PROJECT_NAME}/${EXENAME})
+ set(THIS_EXE_NAME ${PROJECT_NAME}-${EXENAME})
endif()
add_executable(${THIS_EXE_NAME} ${THIS_EXE_SOURCES})
Modified: branches/CMake/release/tools/build/CMake/BoostTesting.cmake
==============================================================================
--- branches/CMake/release/tools/build/CMake/BoostTesting.cmake (original)
+++ branches/CMake/release/tools/build/CMake/BoostTesting.cmake 2008-06-02 16:59:08 EDT (Mon, 02 Jun 2008)
@@ -1,8 +1,8 @@
##########################################################################
# Regression Testing Support for Boost #
##########################################################################
-# Copyright (C) 2007 Douglas Gregor <doug.gregor_at_[hidden]> #
-# Copyright (C) 2007 Troy Straszheim #
+# Copyright (C) 2007-8 Douglas Gregor <doug.gregor_at_[hidden]> #
+# Copyright (C) 2007-8 Troy D. Straszheim #
# #
# Distributed under the Boost Software License, Version 1.0. #
# See accompanying file LICENSE_1_0.txt or copy at #
@@ -35,9 +35,10 @@
# is significantly faster when we aren't also building regression
# tests.
option(BUILD_TESTING "Enable testing" OFF)
-include(CTest)
if (BUILD_TESTING)
+ add_custom_target(test COMMENT "Running all tests")
+
option(TEST_INSTALLED_TREE "Enable testing of an already-installed tree" OFF)
if (TEST_INSTALLED_TREE)
@@ -55,7 +56,8 @@
# [COMPILE_FLAGS compileflags]
# [LINK_FLAGS linkflags]
# [LINK_LIBS linklibs]
-# [DEPENDS libdepend1 libdepend2 ...])
+# [DEPENDS libdepend1 libdepend2 ...]
+# [COMPILE] [RUN] [FAIL])
#
# testname is the name of the test. The remaining arguments passed to
# this macro will be parsed and categorized for the developer-level
@@ -71,15 +73,24 @@
# source files, BOOST_TEST_SOURCES will contain those; otherwise,
# BOOST_TEST_SOURCES will only contain "testname.cpp".
#
+# BOOST_TEST_TAG: compile, compile_fail, run, or run_fail.
+# Used in test-reporting systems.
+#
+# BOOST_TEST_TESTNAME: A (hopefully) globally unique target name
+# for the test, constructed from PROJECT-testname-TAG
+#
# BOOST_TEST_arg: Will be populated with the arguments provided for
# the arguemnt "arg", where "arg" can be any of the extra arguments
# specified above.
+#
+#
macro(boost_test_parse_args testname)
+ #message("boost_test_parse_args ${testname} ${ARGN}")
set(BOOST_TEST_OKAY TRUE)
set(BOOST_TEST_COMPILE_FLAGS "")
parse_arguments(BOOST_TEST
"LINK_LIBS;LINK_FLAGS;DEPENDS;COMPILE_FLAGS;ARGS"
- ""
+ "COMPILE;RUN;LINK;FAIL"
${ARGN}
)
@@ -109,10 +120,26 @@
set(BOOST_TEST_SOURCES "${testname}.cpp")
endif (BOOST_TEST_DEFAULT_ARGS)
+ #message("Sources: ${BOOST_TEST_SOURCES}")
+ if (BOOST_TEST_RUN)
+ set(BOOST_TEST_TAG "run")
+ elseif(BOOST_TEST_COMPILE)
+ set(BOOST_TEST_TAG "compile")
+ elseif(BOOST_TEST_LINK)
+ set(BOOST_TEST_TAG "link")
+ endif(BOOST_TEST_RUN)
+
+ if (BOOST_TEST_FAIL)
+ set(BOOST_TEST_TAG ${BOOST_TEST_TAG}-fail)
+ endif(BOOST_TEST_FAIL)
+
+ set(BOOST_TEST_TESTNAME "${PROJECT_NAME}-${testname}-${BOOST_TEST_TAG}")
+ #message("testname: ${BOOST_TEST_TESTNAME}")
# If testing is turned off, this test is not okay
if (NOT BUILD_TESTING)
set(BOOST_TEST_OKAY FALSE)
endif(NOT BUILD_TESTING)
+
endmacro(boost_test_parse_args)
# This macro creates a Boost regression test that will be executed. If
@@ -169,102 +196,52 @@
# best library variant available to meet those features and the
# current build variant (Debug or Release).
macro(boost_test_run testname)
- if (BUILD_TESTING)
- boost_add_executable(${testname} ${ARGN}
+ boost_test_parse_args(${testname} ${ARGN} RUN)
+ if (BOOST_TEST_OKAY)
+ boost_add_executable(${testname} ${BOOST_TEST_SOURCES}
OUTPUT_NAME tests/${PROJECT_NAME}/${testname}
+ DEPENDS "${BOOST_TEST_DEPENDS}"
NO_INSTALL)
+
if (THIS_EXE_OKAY)
- add_test("${PROJECT_NAME}::${testname}"
- ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/tests/${PROJECT_NAME}/${testname}
- ${THIS_EXE_ARGS})
- endif (THIS_EXE_OKAY)
- endif(BUILD_TESTING)
+
+ # This target builds and runs the test
+ add_custom_target(${BOOST_TEST_TESTNAME})
+
+ set(THIS_TEST_PREFIX_ARGS
+ ${BOOST_TEST_DRIVER} ${CMAKE_CURRENT_BINARY_DIR} ${BOOST_TEST_TAG} ${testname}
+ )
+
+ add_custom_command(TARGET ${BOOST_TEST_TESTNAME}
+ POST_BUILD
+ COMMAND
+ ${THIS_TEST_PREFIX_ARGS}
+ ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/tests/${PROJECT_NAME}/${testname}
+ ${THIS_EXE_ARGS}
+ COMMENT "Running ${testname} in project ${PROJECT_NAME}"
+ )
+
+ add_dependencies(${BOOST_TEST_TESTNAME}
+ ${PROJECT_NAME}-${testname}
+ )
+
+ add_dependencies(${PROJECT_NAME}-test
+ ${BOOST_TEST_TESTNAME}
+ )
+
+ endif(THIS_EXE_OKAY)
+ endif (BOOST_TEST_OKAY)
endmacro(boost_test_run)
-# This macro creates a Boost regression test that will be executed. If
-# the test can be built, executed, and exits with a return code that
-# is not zero, it will be considered to have passed.
-#
-# boost_test_run_fail(testname
-# [source1 source2 ...]
-# [ARGS arg1 arg2... ]
-# [COMPILE_FLAGS compileflags]
-# [LINK_FLAGS linkflags]
-# [LINK_LIBS linklibs]
-# [DEPENDS libdepend1 libdepend2 ...])
-#
-# testname is the name of the test. source1, source2, etc. are the
-# source files that will be built and linked into the test
-# executable. If no source files are provided, the file "testname.cpp"
-# will be used instead.
-#
-# There are several optional arguments to control how the regression
-# test is built and executed:
-#
-# ARGS: Provides additional arguments that will be passed to the
-# test executable when it is run.
-#
-# COMPILE_FLAGS: Provides additional compilation flags that will be
-# used when building this test. For example, one might want to add
-# "-DBOOST_SIGNALS_ASSERT=1" to turn on assertions within the library.
-#
-# LINK_FLAGS: Provides additional flags that will be passed to the
-# linker when linking the test excecutable. This option should not
-# be used to link in additional libraries; see LINK_LIBS and
-# DEPENDS.
-#
-# LINK_LIBS: Provides additional libraries against which the test
-# executable will be linked. For example, one might provide "expat"
-# as options to LINK_LIBS, to state that this executable should be
-# linked against the external "expat" library. Use LINK_LIBS for
-# libraries external to Boost; for Boost libraries, use DEPENDS.
-#
-# DEPENDS: States that this test executable depends on and links
-# against another Boost library. The argument to DEPENDS should be
-# the name of a particular variant of a Boost library, e.g.,
-# boost_signals-static.
-#
-# Example:
-# boost_test_run_fail(prg_exec_fail1 DEPENDS boost_prg_exec_monitor-static)
-#
-# TODO:
-# - Improve handling of DEPENDS, so that we can specify just the
-# library's abstract target (e.g., "boost_signals"), and possibly
-# some features required for building the test (e.g.,
-# MULTI_THREADED, STATIC). The test macros should then pick the
-# best library variant available to meet those features and the
-# current build variant (Debug or Release).
+#
+# This macro creates a boost regression test that will be run but is
+# expected to fail (exit with nonzero return code).
+# See boost_test_run()
+#
macro(boost_test_run_fail testname)
- if (BUILD_TESTING)
- boost_add_executable(${testname} ${ARGN}
- OUTPUT_NAME tests/${PROJECT_NAME}/${testname}
- NO_INSTALL)
- if (THIS_EXE_OKAY)
- add_test("${PROJECT_NAME}::${testname}"
- ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/tests/${PROJECT_NAME}/${testname}
- ${THIS_EXE_ARGS})
- set_tests_properties("${PROJECT_NAME}::${testname}"
- PROPERTIES WILL_FAIL TRUE)
- endif (THIS_EXE_OKAY)
- endif(BUILD_TESTING)
+ boost_test_run(${testname} ${ARGN} FAIL)
endmacro(boost_test_run_fail)
-# Under construction...
-
-macro(boost_test_link testname)
- boost_test_parse_args(${testname} ${ARGN})
- if(BOOST_TEST_OKAY)
- add_test("${PROJECT_NAME}::${testname}"
- ${CMAKE_CTEST_COMMAND}
- --build-and-test
- ${Boost_SOURCE_DIR}/tools/build/CMake/LinkTest
- ${Boost_BINARY_DIR}/tools/build/CMake/LinkTest
- --build-generator {CMAKE_GENERATOR}
- --build-makeprogram ${MAKEPROGRAM}
- --build-project LinkTest
- --build-options -DSOURCE=${CMAKE_CURRENT_SOURCE_DIR}/${BOOST_TEST_SOURCES} -DINCLUDES=${Boost_SOURCE_DIR} -DCOMPILE_FLAGS="${BOOST_TEST_COMPILE_FLAGS}")
- endif(BOOST_TEST_OKAY)
-endmacro(boost_test_link)
# This macro creates a Boost regression test that will be compiled,
# but not linked or executed. If the test can be compiled with no
@@ -284,67 +261,95 @@
# Example:
# boost_test_compile(advance)
macro(boost_test_compile testname)
- boost_test_parse_args(${testname} ${ARGN})
+ boost_test_parse_args(${testname} ${ARGN} COMPILE)
- # Determine the include directories to pass along to the underlying
- # project.
- get_directory_property(BOOST_TEST_INCLUDE_DIRS INCLUDE_DIRECTORIES)
- set(BOOST_TEST_INCLUDES "")
- foreach(DIR ${BOOST_TEST_INCLUDE_DIRS})
- set(BOOST_TEST_INCLUDES "${BOOST_TEST_INCLUDES}:${DIR}")
- endforeach(DIR ${BOOST_TEST_INCLUDE_DIRS})
- if(BOOST_TEST_OKAY)
- add_test("${PROJECT_NAME}::${testname}"
- ${CMAKE_CTEST_COMMAND}
- --build-and-test
- ${Boost_SOURCE_DIR}/tools/build/CMake/CompileTest
- ${Boost_BINARY_DIR}/tools/build/CMake/CompileTest
- --build-generator ${CMAKE_GENERATOR}
- --build-makeprogram ${MAKEPROGRAM}
- --build-project CompileTest
- --build-options -DSOURCE=${CMAKE_CURRENT_SOURCE_DIR}/${BOOST_TEST_SOURCES} -DINCLUDES=${BOOST_TEST_INCLUDES} -DCOMPILE_FLAGS=${BOOST_TEST_COMPILE_FLAGS})
+ if (BOOST_TEST_OKAY)
+ # Determine the include directories to pass along to the underlying
+ # project.
+ # works but not great
+ get_directory_property(BOOST_TEST_INCLUDE_DIRS INCLUDE_DIRECTORIES)
+ set(BOOST_TEST_INCLUDES "")
+ foreach(DIR ${BOOST_TEST_INCLUDE_DIRS})
+ set(BOOST_TEST_INCLUDES "${BOOST_TEST_INCLUDES};-I${DIR}")
+ endforeach(DIR ${BOOST_TEST_INCLUDE_DIRS})
+
+ set(THIS_TEST_PREFIX_ARGS
+ ${BOOST_TEST_DRIVER} ${CMAKE_CURRENT_BINARY_DIR} ${BOOST_TEST_TAG} ${testname}
+ )
+
+ add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${testname}-${BOOST_TEST_TAG}.o
+ COMMAND
+ ${THIS_TEST_PREFIX_ARGS}
+ ${CMAKE_CXX_COMPILER}
+ ${BOOST_TEST_COMPILE_FLAGS}
+ ${BOOST_TEST_INCLUDES}
+ -c ${BOOST_TEST_SOURCES}
+ -o ${testname}-compile-test.o
+ COMMENT "Running ${testname} in project ${PROJECT_NAME}"
+ )
+
+ add_custom_target(${BOOST_TEST_TESTNAME}
+ DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${testname}-${BOOST_TEST_TAG}.o
+ )
+
+ add_dependencies(${PROJECT_NAME}-test
+ ${BOOST_TEST_TESTNAME}
+ )
+
endif(BOOST_TEST_OKAY)
endmacro(boost_test_compile)
-# This macro creates a Boost regression test that will be compiled,
-# but compilation should fail. It is used to test, e.g., that certain
-# disallowed syntax does in fact cause a compilation failure.
#
-# boost_test_compile_fail(testname
-# [source1]
-# [COMPILE_FLAGS compileflags])
+# This macro creates a Boost regression test that is expected to
+# *fail* to compile. See boost_test_compile()
#
-# testname is the name of the test. source1 is the name of the source
-# file that will be built. If no source file is provided, the file
-# "testname.cpp" will be used instead.
-#
-# The COMPILE_FLAGS argument provides additional arguments that will
-# be passed to the compiler when building this test.
-
-# Example:
-# boost_test_compile_fail(function_test_fail1)
macro(boost_test_compile_fail testname)
- boost_test_parse_args(${testname} ${ARGN})
+ boost_test_compile(${testname} ${ARGN} FAIL)
+endmacro(boost_test_compile_fail)
- # Determine the include directories to pass along to the underlying
- # project.
- get_directory_property(BOOST_TEST_INCLUDE_DIRS INCLUDE_DIRECTORIES)
- set(BOOST_TEST_INCLUDES "")
- foreach(DIR ${BOOST_TEST_INCLUDE_DIRS})
- set(BOOST_TEST_INCLUDES "${BOOST_TEST_INCLUDES}:${DIR}")
- endforeach(DIR ${BOOST_TEST_INCLUDE_DIRS})
-
+
+
+
+#
+# boost_test_link:
+#
+# Under construction.
+#
+macro(boost_test_link testname)
+ boost_test_parse_args(${testname} ${ARGN} LINK)
if(BOOST_TEST_OKAY)
- add_test("${PROJECT_NAME}::${testname}"
- ${CMAKE_CTEST_COMMAND}
- --build-and-test
- ${Boost_SOURCE_DIR}/tools/build/CMake/CompileTest
- ${Boost_BINARY_DIR}/tools/build/CMake/CompileTest
- --build-generator ${CMAKE_GENERATOR}
- --build-makeprogram ${MAKEPROGRAM}
- --build-project CompileTest
- --build-options -DSOURCE=${CMAKE_CURRENT_SOURCE_DIR}/${BOOST_TEST_SOURCES} -DINCLUDES=${BOOST_TEST_INCLUDES} -DCOMPILE_FLAGS=${BOOST_TEST_COMPILE_FLAGS})
- set_tests_properties("${PROJECT_NAME}::${testname}" PROPERTIES WILL_FAIL ON)
+
+ set(THIS_TEST_PREFIX_ARGS
+ ${BOOST_TEST_DRIVER} ${CMAKE_CURRENT_BINARY_DIR} test_link ${testname}
+ )
+
+ #
+ # FIXME: no ctest.
+ #
+ add_custom_target(TARGET ${BOOST_TEST_TESTNAME}
+ COMMAND /link/tests/are/failing/at/the/moment
+ COMMENT "Link test ${testname} in ${PROJECT_NAME} is failing."
+ )
+
+ # POST_BUILD
+ # COMMAND
+ # ${THIS_TEST_PREFIX_ARGS}
+ # ${CMAKE_CTEST_COMMAND}
+ # --build-and-test
+ # ${Boost_SOURCE_DIR}/tools/build/CMake/LinkTest
+ # ${Boost_BINARY_DIR}/tools/build/CMake/LinkTest
+ # --build-generator \\"${CMAKE_GENERATOR}\\"
+ # --build-makeprogram \\"${MAKEPROGRAM}\\"
+ # --build-project LinkTest
+ # --build-options -DSOURCE=${CMAKE_CURRENT_SOURCE_DIR}/${BOOST_TEST_SOURCES} -DINCLUDES=${Boost_SOURCE_DIR} -DCOMPILE_FLAGS=\\"${BOOST_TEST_COMPILE_FLAGS}\\"
+ # COMMENT "Running ${testname} (link) in project ${PROJECT_NAME}"
+ # )
+
+ add_dependencies(${PROJECT_NAME}-test
+ ${BOOST_TEST_TESTNAME}
+ )
+
endif(BOOST_TEST_OKAY)
-endmacro(boost_test_compile_fail)
+endmacro(boost_test_link)
+
Added: branches/CMake/release/tools/build/CMake/passthru.py.in
==============================================================================
--- (empty file)
+++ branches/CMake/release/tools/build/CMake/passthru.py.in 2008-06-02 16:59:08 EDT (Mon, 02 Jun 2008)
@@ -0,0 +1,67 @@
+#!/usr/bin/python
+#
+# copyright (C) 2008 troy d. straszheim <troy_at_[hidden]>
+#
+# Distributed under the Boost Software License, Version 1.0.
+# See accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt
+#
+
+#
+# "Passthru" driver, only responsible for 'flipping' exit status of
+# tests that are expected to fail. See driver.py for the version
+# that is run when BOOST_BUILD_SLAVE is on, which does xmlizaton
+# and the like
+#
+import sys, os, os.path
+from subprocess import Popen, PIPE
+
+def verbose(what):
+ if @BOOST_DRIVER_VERBOSE@:
+ print what
+
+# ignored
+# log = os.path.join(sys.argv[1], "Log.xml")
+op = sys.argv[2]
+# target = sys.argv[3]
+argv = sys.argv[4:]
+expect_fail = op.endswith("fail")
+
+#
+# execute subprocess
+#
+subproc = None
+returncode = None
+ex = None
+try:
+ subproc = Popen(argv, stdout=PIPE, stderr=PIPE)
+ returncode = subproc.wait()
+except EnvironmentError, e:
+ ex = e
+
+print subproc.stdout.read()
+print subproc.stderr.read()
+
+if not ex:
+ # possibly flip the return code
+ if not expect_fail:
+ if not returncode:
+ verbose("ok.")
+ else:
+ verbose("error.")
+ sys.exit(returncode)
+ else:
+ if returncode != 0:
+ verbose("ok.")
+ sys.exit(0)
+ else:
+ verbose("*** UNEXPECTED SUCCESS ***")
+ sys.exit(1) # we need an exit status for 'unexpected success'
+else:
+ # if there is an os error 'above' the actual exit status of the subprocess,
+ # use the errno
+ print "Error in build system: " + str(ex.strerror)
+ sys.exit(ex.errno)
+
+
+
Added: branches/CMake/release/tools/build/CMake/post.py.in
==============================================================================
--- (empty file)
+++ branches/CMake/release/tools/build/CMake/post.py.in 2008-06-02 16:59:08 EDT (Mon, 02 Jun 2008)
@@ -0,0 +1,36 @@
+#!/usr/bin/python
+#
+# copyright (C) 2008 troy d. straszheim <troy_at_[hidden]>
+#
+# Distributed under the Boost Software License, Version 1.0.
+# See accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt
+#
+
+#
+# HTTP POST the build log
+#
+
+import sys, os, os.path
+from subprocess import Popen, PIPE
+import xml.etree.ElementTree as ET
+
+project_name = sys.argv[1]
+library_target = sys.argv[2]
+logdir = sys.argv[3]
+
+print "\n>>>\n>>> Project " + project_name \
+ + "\n>>> POST build log for " + library_target \
+ + "\n>>> from log dir" + logdir \
+ + "\n>>>\n"
+
+#
+# Here you would actually do an http post. Just print for now.
+#
+p = os.path.join(logdir, "Log.xml")
+
+f = open(p)
+print f.read() + "\n"
+f.close()
+os.remove(p)
+
Added: branches/CMake/release/tools/build/CMake/xmlize.py.in
==============================================================================
--- (empty file)
+++ branches/CMake/release/tools/build/CMake/xmlize.py.in 2008-06-02 16:59:08 EDT (Mon, 02 Jun 2008)
@@ -0,0 +1,89 @@
+#!/usr/bin/python
+#
+# copyright (C) 2008 troy d. straszheim <troy_at_[hidden]>
+#
+# Distributed under the Boost Software License, Version 1.0.
+# See accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt
+#
+
+#
+# Compiler driver. Takes a few arguments describing what is to be done
+# (used to mark up the output) and executes compiler in a subshell, checking
+# for errors and xmlizing any output.
+#
+import sys, os.path
+from subprocess import Popen, PIPE
+import xml.etree.ElementTree as ET
+
+log = os.path.join(sys.argv[1], "Log.xml")
+op = sys.argv[2]
+target = sys.argv[3]
+argv = sys.argv[4:]
+expect_fail = op.endswith("fail")
+passthru = op.startswith("passthru")
+
+if not passthru:
+ print "***\n*** Executing op:" + op + "\n*** " + str(argv) + "\n*** log=" + log + "\n***"
+
+#
+# execute subprocess
+#
+subproc = None
+returncode = None
+ex = None
+try:
+ subproc = Popen(argv, stdout=PIPE, stderr=PIPE)
+ returncode = subproc.wait()
+except EnvironmentError, e:
+ ex = e
+
+#
+# Collect, possibly xmlize, and print subprocess return info
+#
+
+if not passthru:
+ root = ET.Element(op)
+ ET.SubElement(root, "target").text = target
+
+ ET.SubElement(root, "commandline").text = " ".join(argv)
+
+ if not ex:
+ ET.SubElement(root, "returncode").text = str(returncode)
+ stdout = subproc.stdout.read()
+ stderr = subproc.stderr.read()
+ if returncode != 0 and not expect_fail:
+ print "*** stdout:" + stdout
+ print "*** stderr:" + stderr
+ else:
+ print "*** OK"
+ ET.SubElement(root, "stdout").text = stdout
+ ET.SubElement(root, "stderr").text = stderr
+
+ else:
+ ET.SubElement(root, "errno").text = str(ex.errno)
+ ET.SubElement(root, "filename").text = ex.filename
+ ET.SubElement(root, "message").text = ex.message
+ ET.SubElement(root, "strerror").text = ex.strerror
+ print "Errno:" + str(ex.errno) + ": " + ex.strerror
+
+ f = open(log, "a")
+ f.write(ET.tostring(root) + "\n")
+else:
+ print subproc.stdout.read(),
+ print subproc.stderr.read(),
+
+if ex:
+ sys.exit(ex.errno)
+else:
+ if expect_fail:
+ if returncode != 0:
+ sys.exit(0)
+ else:
+ print "UNEXPECTED SUCCESS"
+ sys.exit(1) # we need an exit status for 'unexpected success'
+ else:
+ sys.exit(returncode)
+
+
+
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk