Boost logo

Boost-Commit :

From: dgregor_at_[hidden]
Date: 2007-06-06 22:25:19


Author: dgregor
Date: 2007-06-06 22:25:18 EDT (Wed, 06 Jun 2007)
New Revision: 4479
URL: http://svn.boost.org/trac/boost/changeset/4479

Log:
Finish Boost.Python testing

Added:
   sandbox-branches/boost-cmake/boost_1_34_0/libs/python/test/pyrun.py
Text files modified:
   sandbox-branches/boost-cmake/boost_1_34_0/TODO | 2
   sandbox-branches/boost-cmake/boost_1_34_0/libs/python/test/CMakeLists.txt | 164 ++++++++++++++++++++++++++++++++++++---
   sandbox-branches/boost-cmake/boost_1_34_0/tools/build/CMake/CompileTest/CMakeLists.txt | 6
   sandbox-branches/boost-cmake/boost_1_34_0/tools/build/CMake/boost-testing.cmake | 21 ++++
   4 files changed, 174 insertions(+), 19 deletions(-)

Modified: sandbox-branches/boost-cmake/boost_1_34_0/TODO
==============================================================================
--- sandbox-branches/boost-cmake/boost_1_34_0/TODO (original)
+++ sandbox-branches/boost-cmake/boost_1_34_0/TODO 2007-06-06 22:25:18 EDT (Wed, 06 Jun 2007)
@@ -18,7 +18,7 @@
 
 - In libs/parameter/test, fix the test that depends on Python
 
-- Python library: testing, handle Python debug library variants
+- Python library: handle Python debug library variants
 
 - Testing for the Regex library
 

Modified: sandbox-branches/boost-cmake/boost_1_34_0/libs/python/test/CMakeLists.txt
==============================================================================
--- sandbox-branches/boost-cmake/boost_1_34_0/libs/python/test/CMakeLists.txt (original)
+++ sandbox-branches/boost-cmake/boost_1_34_0/libs/python/test/CMakeLists.txt 2007-06-06 22:25:18 EDT (Wed, 06 Jun 2007)
@@ -7,9 +7,20 @@
   # Determine the Python and C++ source files for this test
   if (BPL_TEST_DEFAULT_ARGS)
     car(BPL_TEST_PYSOURCE ${BPL_TEST_DEFAULT_ARGS})
- cdr(BPL_TEST_SOURCES ${BPL_TEST_DEFAULT_ARGS})
+ set(BPL_TEST_SOURCES)
+ set(BPL_TEST_DEPENDS)
+ cdr(BPL_TEST_DEFAULT_ARGS ${BPL_TEST_DEFAULT_ARGS})
+ foreach(SRC ${BPL_TEST_DEFAULT_ARGS})
+ get_filename_component(BPL_SRC_EXT ${SRC} EXT)
+ if (BPL_SRC_EXT STREQUAL "py")
+ set (BPL_TEST_DEPENDS ${BPL_TEST_DEPENDS} "${SRC}")
+ else (BPL_SRC_EXT STREQUAL "py")
+ set(BPL_TEST_SOURCES ${BPL_TEST_SOURCES} "${SRC}")
+ endif (BPL_SRC_EXT STREQUAL "py")
+ endforeach(SRC ${BPL_TEST_DEFAULT_ARGS})
   else (BPL_TEST_DEFAULT_ARGS)
     set(BPL_TEST_PYSOURCE "${TESTNAME}.py")
+ set(BPL_TEST_DEPENDS)
     set(BPL_TEST_SOURCES "${TESTNAME}.cpp")
   endif(BPL_TEST_DEFAULT_ARGS)
   set(BPL_TEST_PYSOURCE ${CMAKE_CURRENT_SOURCE_DIR}/${BPL_TEST_PYSOURCE})
@@ -17,11 +28,27 @@
   # Build the Python extension module we need
   boost_python_extension(${TESTNAME}_ext ${BPL_TEST_SOURCES})
 
+ # Add any extra dependencies
+ if (BPL_TEST_DEPENDS)
+ add_dependencies(${TESTNAME}_ext ${BPL_TEST_DEPENDS})
+ endif (BPL_TEST_DEPENDS)
+
   # Run the test itself
+ file(TO_NATIVE_PATH ${LIBRARY_OUTPUT_PATH} PYTHONPATH)
   add_test("${PROJECT_NAME}::${TESTNAME}"
- ${PYTHON_EXECUTABLE} ${BPL_TEST_PYSOURCE} ${BPL_TEST_ARGS})
+ ${PYTHON_EXECUTABLE}
+ "${CMAKE_CURRENT_SOURCE_DIR}/pyrun.py"
+ "${PYTHONPATH}"
+ ${BPL_TEST_PYSOURCE} ${BPL_TEST_ARGS})
 endmacro(bpl_test)
 
+macro(py_run TESTNAME)
+ boost_test_run(${TESTNAME}
+ SOURCES ${TESTNAME}.cpp
+ DEPENDS boost_python-static
+ LINK_LIBS ${PYTHON_LIBRARIES})
+endmacro(py_run)
+
 boost_test_run(exec
   DEPENDS boost_python-static
   ARGS "${CMAKE_CURRENT_SOURCE_DIR}/exec.py"
@@ -32,16 +59,127 @@
   DEPENDS boost_python-shared
   LINK_LIBS ${PYTHON_LIBRARIES})
 
-# Setup the paths we need to run Python tests
-file(TO_NATIVE_PATH ${LIBRARY_OUTPUT_PATH} PYTHONPATH)
-message(STATUS ${PYTHONPATH})
-set(ENV{PYTHONPATH} "${PYTHONPATH}")
-set(CTEST_ENVIRONMENT "PYTHONPATH=${PYTHONPATH}")
-
-#[
-#bpl-test crossmod_exception
-# : crossmod_exception.py crossmod_exception_a.cpp crossmod_exception_b.cpp
-#]
+bpl_test(crossmod_exception
+ crossmod_exception.py crossmod_exception_a.cpp crossmod_exception_b.cpp)
 
+bpl_test(injected)
+bpl_test(properties)
+bpl_test(return_arg)
+bpl_test(staticmethod)
+bpl_test(shared_ptr)
+bpl_test(andreas_beyer)
+bpl_test(polymorphism)
+bpl_test(polymorphism2)
+
+bpl_test(wrapper_held_type)
+bpl_test(polymorphism2_auto_ptr)
+
+bpl_test(auto_ptr)
+
+bpl_test(minimal)
+bpl_test(args)
+bpl_test(raw_ctor)
+bpl_test(numpy numpy.py printer.py numeric_tests.py numarray_tests.py numpy.cpp)
+bpl_test(enum)
+bpl_test(exception_translator)
+bpl_test(pearu1 test_cltree.py cltree.cpp)
+bpl_test(try newtest.py m1.cpp m2.cpp)
+bpl_test(const_argument)
+bpl_test(keywords keywords_test.py keywords.cpp)
+
+bpl_test(builtin_converters test_builtin_converters.py test_builtin_converters.cpp)
+
+bpl_test(test_pointer_adoption)
+bpl_test(operators)
+bpl_test(callbacks)
+bpl_test(defaults)
+
+bpl_test(object)
+bpl_test(list)
+bpl_test(long)
+bpl_test(dict)
+bpl_test(tuple)
+bpl_test(str)
+bpl_test(slice)
+
+bpl_test(virtual_functions)
+bpl_test(back_reference)
+bpl_test(implicit)
+bpl_test(data_members)
+
+bpl_test(ben_scott1)
+
+bpl_test(bienstman1)
+bpl_test(bienstman2)
+bpl_test(bienstman3)
+
+bpl_test(multi_arg_constructor)
+# TODO: A bug in the Win32 intel compilers causes compilation of one
+# of our tests to take forever when debug symbols are
+# enabled. This rule turns them off when added to the requirements
+# section
+# <toolset>intel-win:<debug-symbols>off
+
+bpl_test(iterator iterator.py iterator.cpp input_iterator.cpp)
+
+bpl_test(stl_iterator stl_iterator.py stl_iterator.cpp)
+
+bpl_test(extract)
+
+bpl_test (crossmod_opaque
+ crossmod_opaque.py crossmod_opaque_a.cpp crossmod_opaque_b.cpp)
+
+bpl_test(opaque)
+bpl_test(voidptr)
+
+bpl_test(pickle1)
+bpl_test(pickle2)
+bpl_test(pickle3)
+bpl_test(pickle4)
+
+bpl_test(nested)
+
+bpl_test(docstring)
+
+bpl_test(vector_indexing_suite)
+
+bpl_test(pointer_vector)
+# TODO: Turn off this test on HP CXX, as the test hangs when executing.
+# Whenever the cause for the failure of the polymorphism test is found
+# and fixed, this should be retested.
+# <toolset>hp_cxx:<build>no
+
+bpl_test(map_indexing_suite
+ map_indexing_suite.py map_indexing_suite.cpp int_map_indexing_suite.cpp)
+
+
+# --- unit tests of library components ---
+
+boost_test_compile(indirect_traits_test)
+boost_test_run(destroy_test)
+py_run(pointer_type_id_test)
+py_run(bases)
+boost_test_run(if_else)
+py_run(pointee)
+boost_test_run(result)
+
+boost_test_compile(string_literal)
+boost_test_compile(borrowed)
+boost_test_compile(object_manager)
+boost_test_compile(copy_ctor_mutates_rhs)
+
+py_run(upcast)
+
+boost_test_compile(select_holder)
+
+boost_test_run(select_from_python_test
+ SOURCES select_from_python_test.cpp ../src/converter/type_id.cpp
+ COMPILE_FLAGS "-DBOOST_PYTHON_STATIC_LIB"
+ LINK_LIBS ${PYTHON_LIBRARIES})
+
+boost_test_compile(select_arg_to_python_test)
 
-bpl_test(injected)
\ No newline at end of file
+boost_test_compile_fail(raw_pyobject_fail1)
+boost_test_compile_fail(raw_pyobject_fail2)
+boost_test_compile_fail(as_to_python_function)
+boost_test_compile_fail(object_fail1)

Added: sandbox-branches/boost-cmake/boost_1_34_0/libs/python/test/pyrun.py
==============================================================================
--- (empty file)
+++ sandbox-branches/boost-cmake/boost_1_34_0/libs/python/test/pyrun.py 2007-06-06 22:25:18 EDT (Wed, 06 Jun 2007)
@@ -0,0 +1,11 @@
+# Simple Python script that acts as a bridge to any other Python
+# script. It first sets sys.path to the first argument, then runs the
+# script specified by the second argument. All remaining arguments are
+# passed to the script.
+import sys
+sys.argv[0] = sys.argv[2]
+sys.path.insert(0, sys.argv[1])
+script_file = open(sys.argv[2], "r")
+sys.argv.pop(1)
+sys.argv.pop(1)
+exec(script_file)

Modified: sandbox-branches/boost-cmake/boost_1_34_0/tools/build/CMake/CompileTest/CMakeLists.txt
==============================================================================
--- sandbox-branches/boost-cmake/boost_1_34_0/tools/build/CMake/CompileTest/CMakeLists.txt (original)
+++ sandbox-branches/boost-cmake/boost_1_34_0/tools/build/CMake/CompileTest/CMakeLists.txt 2007-06-06 22:25:18 EDT (Wed, 06 Jun 2007)
@@ -1,5 +1,5 @@
 project(CompileTest)
-message("Includes are ${INCLUDES}")
-message("Sources is ${SOURCE}")
-include_directories (${INCLUDES})
+string(REPLACE ":" ";" INCLUDE_PATHS ${INCLUDES})
+separate_arguments(INCLUDE_PATHS)
+include_directories (${INCLUDE_PATHS})
 add_library(compile STATIC "${SOURCE}")

Modified: sandbox-branches/boost-cmake/boost_1_34_0/tools/build/CMake/boost-testing.cmake
==============================================================================
--- sandbox-branches/boost-cmake/boost_1_34_0/tools/build/CMake/boost-testing.cmake (original)
+++ sandbox-branches/boost-cmake/boost_1_34_0/tools/build/CMake/boost-testing.cmake 2007-06-06 22:25:18 EDT (Wed, 06 Jun 2007)
@@ -122,6 +122,15 @@
 
 macro(boost_test_compile testname)
   boost_test_parse_args(${testname} ${ARGN})
+
+ # 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}
@@ -131,12 +140,20 @@
              --build-generator "${CMAKE_GENERATOR}"
              --build-makeprogram "${MAKEPROGRAM}"
              --build-project CompileTest
- --build-options -DSOURCE=${CMAKE_CURRENT_SOURCE_DIR}/${BOOST_TEST_SOURCES} -DINCLUDES=${Boost_SOURCE_DIR} -DCOMPILE_FLAGS="${BOOST_TEST_COMPILE_FLAGS}")
+ --build-options -DSOURCE=${CMAKE_CURRENT_SOURCE_DIR}/${BOOST_TEST_SOURCES} -DINCLUDES=${BOOST_TEST_INCLUDES} -DCOMPILE_FLAGS=${BOOST_TEST_COMPILE_FLAGS})
   endif(BOOST_TEST_OKAY)
 endmacro(boost_test_compile)
 
 macro(boost_test_compile_fail testname)
   boost_test_parse_args(${testname} ${ARGN})
+
+ # 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}"
@@ -147,7 +164,7 @@
              --build-generator "${CMAKE_GENERATOR}"
              --build-makeprogram "${MAKEPROGRAM}"
              --build-project CompileTest
- --build-options -DSOURCE=${CMAKE_CURRENT_SOURCE_DIR}/${BOOST_TEST_SOURCES} -DINCLUDES=${Boost_SOURCE_DIR})
+ --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)
   endif(BOOST_TEST_OKAY)
 endmacro(boost_test_compile_fail)


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