Skip to content

Commit

Permalink
Fix test_v1
Browse files Browse the repository at this point in the history
  • Loading branch information
Luis Caro Campos committed Jan 4, 2023
1 parent fa9ec0f commit 86b2905
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 44 deletions.
2 changes: 1 addition & 1 deletion recipes/boost/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ if(NOT HEADER_ONLY)
set_target_properties(hello_ext PROPERTIES SUFFIX ".pyd")
endif()
add_test(NAME boost_python COMMAND Python::Interpreter "${CMAKE_CURRENT_SOURCE_DIR}/python.py")
set_property(TEST boost_python PROPERTY ENVIRONMENT "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}")
set_property(TEST boost_python PROPERTY ENVIRONMENT "PYTHONPATH=$<TARGET_FILE_DIR:hello_ext>")

add_executable(numpy_exe numpy.cpp)
target_link_libraries(numpy_exe PRIVATE Boost::numpy Python::Python)
Expand Down
4 changes: 3 additions & 1 deletion recipes/boost/all/test_v1_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
cmake_minimum_required(VERSION 3.1)
project(test_package)
project(test_v1_package)

enable_testing()

include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup(TARGETS)
Expand Down
46 changes: 4 additions & 42 deletions recipes/boost/all/test_v1_package/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ def build(self):
cmake.definitions["WITH_PYTHON"] = not self.options["boost"].without_python
if not self.options["boost"].without_python:
pyversion = tools.Version(self.options["boost"].python_version)
cmake.definitions["Python_ADDITIONAL_VERSIONS"] = f"{pyversion.major}.{pyversion.minor}"
cmake.definitions["PYTHON_COMPONENT_SUFFIX"] = f"{pyversion.major}.{pyversion.minor}"
cmake.definitions["PYTHON_VERSION_TO_SEARCH"] = pyversion
cmake.definitions["Python_EXECUTABLE"] = self.options["boost"].python_executable
cmake.definitions["WITH_RANDOM"] = not self.options["boost"].without_random
cmake.definitions["WITH_REGEX"] = not self.options["boost"].without_regex
cmake.definitions["WITH_TEST"] = not self.options["boost"].without_test
Expand All @@ -47,43 +47,5 @@ def build(self):
def test(self):
if tools.cross_building(self):
return
self.run(os.path.join("bin", "lambda_exe"), run_environment=True)
if self.options["boost"].header_only:
return
if not self.options["boost"].without_random:
self.run(os.path.join("bin", "random_exe"), run_environment=True)
if not self.options["boost"].without_regex:
self.run(os.path.join("bin", "regex_exe"), run_environment=True)
if not self.options["boost"].without_test:
self.run(os.path.join("bin", "test_exe"), run_environment=True)
if not self.options["boost"].without_coroutine:
self.run(os.path.join("bin", "coroutine_exe"), run_environment=True)
if not self.options["boost"].without_chrono:
self.run(os.path.join("bin", "chrono_exe"), run_environment=True)
if not self.options["boost"].without_fiber:
self.run(os.path.join("bin", "fiber_exe"), run_environment=True)
if not self.options["boost"].without_locale:
self.run(os.path.join("bin", "locale_exe"), run_environment=True)
if not self._boost_option("without_nowide", True):
bin_nowide = os.path.join("bin", "nowide_exe")
conanfile = os.path.join(self.source_folder, "conanfile.py")
self.run(f"{bin_nowide} {conanfile}", run_environment=True)
if not self._boost_option("without_json", True):
self.run(os.path.join("bin", "json_exe"), run_environment=True)
if not self.options["boost"].without_python:
with tools.environment_append({"PYTHONPATH": "bin:lib"}):
python_executable = self.options["boost"].python_executable
python_script = os.path.join(self.source_folder, os.pardir, "test_package", "python.py")
self.run(f"{python_executable} {python_script}", run_environment=True)
self.run(os.path.join("bin", "numpy_exe"), run_environment=True)
if not self.options["boost"].without_stacktrace:
self.run(os.path.join("bin", "stacktrace_noop_exe"), run_environment=True)
if str(self.deps_user_info["boost"].stacktrace_addr2line_available) == "True":
self.run(os.path.join("bin", "stacktrace_addr2line_exe"), run_environment=True)
if self.settings.os == "Windows":
self.run(os.path.join("bin", "stacktrace_windbg_exe"), run_environment=True)
self.run(os.path.join("bin", "stacktrace_windbg_cached_exe"), run_environment=True)
else:
self.run(os.path.join("bin", "stacktrace_basic_exe"), run_environment=True)
if self._boost_option("with_stacktrace_backtrace", False):
self.run(os.path.join("bin", "stacktrace_backtrace_exe"), run_environment=True)
self.run("ctest --output-on-failure", run_environment=True)

0 comments on commit 86b2905

Please sign in to comment.