mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-10-21 06:21:16 +00:00
* Stop Malformed Network Responses from Crashing the App Duet, MKS and UltiMaker parsed print host replies with boost read_json inside the HTTP completion callback with no try, so an HTML or truncated reply threw out of the Physical Printer Test button and terminated the app, or killed the upload queue thread. The five identical copies of the parser (ESP3D's and Flashforge's were unused) are replaced by one shared PrintHost::get_err_code_from_body that reports a non-JSON reply as an error. The upload queue now catches a failing job per job, so one bad upload no longer leaves later jobs queued forever. Flashforge read material station slots with nlohmann value(), which throws on off-type fields or non-object entries. The parsing moves into Flashforge::parse_material_slots, which reads fields leniently with the existing try_parse_json_int and skips bad entries. UserManager::parse_json parsed the payload before its try block; the parse now happens inside it. * Keep UploadFinished Paired with UploadStarted When an Upload Throws The exception from a throwing upload was caught around perform_job, so the UploadFinished lifecycle event was skipped and plugins saw an upload start that never finished. The catch now sits around the upload call. The error is reported through the job's error callback and UploadFinished is fired with an error code, as for any other failed upload. The worker keeps running for the next job. The started, upload and finished sequence moved to PrintHostJobQueue::upload_job so it can be tested without the dialog.
103 lines
4.2 KiB
CMake
103 lines
4.2 KiB
CMake
get_filename_component(_TEST_NAME ${CMAKE_CURRENT_LIST_DIR} NAME)
|
|
add_executable(${_TEST_NAME}_tests
|
|
${_TEST_NAME}_tests_main.cpp
|
|
test_bambu_filament_ids.cpp
|
|
test_creality_cfs_match.cpp
|
|
test_dev_mapping.cpp
|
|
test_filament_bitmap_utils.cpp
|
|
test_scene_raycaster.cpp
|
|
test_lazy.cpp
|
|
test_prebuild_queue.cpp
|
|
test_staged_build.cpp
|
|
test_network_versions.cpp
|
|
test_action_source.cpp
|
|
test_plugin_host_api.cpp
|
|
# Exercise seam enums and predicates through the embedded Python host API.
|
|
test_precise_seam_plugin.cpp
|
|
test_plugin_capability_config.cpp
|
|
test_plugin_config.cpp
|
|
test_plugin_capabilities_in_use.cpp
|
|
test_plugin_install.cpp
|
|
test_plugin_lifecycle.cpp
|
|
test_plugin_printer_agent.cpp
|
|
test_printhost.cpp
|
|
test_slicing_pipeline_bindings.cpp
|
|
test_slicing_pipeline_config.cpp
|
|
test_plugin_sort.cpp
|
|
test_plugin_cloud_metadata.cpp
|
|
test_plugin_audit.cpp
|
|
test_shortcuts.cpp
|
|
test_file_url.cpp
|
|
test_user_manager.cpp
|
|
../fff_print/test_helpers.cpp
|
|
)
|
|
|
|
if (MSVC)
|
|
target_link_libraries(${_TEST_NAME}_tests Setupapi.lib)
|
|
endif ()
|
|
|
|
target_link_libraries(${_TEST_NAME}_tests test_common libslic3r_gui libslic3r pybind11::embed Catch2::Catch2WithMain)
|
|
set_property(TARGET ${_TEST_NAME}_tests PROPERTY FOLDER "tests")
|
|
|
|
orcaslicer_copy_test_dlls()
|
|
|
|
if (WIN32)
|
|
add_custom_command(TARGET ${_TEST_NAME}_tests POST_BUILD
|
|
COMMAND ${CMAKE_COMMAND} -E make_directory "$<TARGET_FILE_DIR:${_TEST_NAME}_tests>/python"
|
|
COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_PREFIX_PATH}/libpython" "$<TARGET_FILE_DIR:${_TEST_NAME}_tests>/python"
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
|
"${CMAKE_PREFIX_PATH}/libpython/python${_bundled_python_abi}.dll"
|
|
"${CMAKE_PREFIX_PATH}/libpython/vcruntime140.dll"
|
|
"${CMAKE_PREFIX_PATH}/libpython/vcruntime140_1.dll"
|
|
"$<TARGET_FILE_DIR:${_TEST_NAME}_tests>"
|
|
COMMENT "Copying Python runtime for slic3rutils plugin host API tests"
|
|
VERBATIM
|
|
)
|
|
elseif (NOT FLATPAK)
|
|
# The CI unit-test runner only receives the build/tests tree, so both the
|
|
# interpreter and the libpython the test binary links have to travel next to
|
|
# the executable; find_bundled_python_home() picks the copy up from there.
|
|
if (APPLE)
|
|
target_link_options(${_TEST_NAME}_tests PRIVATE
|
|
"LINKER:-rpath,@executable_path/python/lib")
|
|
else ()
|
|
set_property(TARGET ${_TEST_NAME}_tests APPEND PROPERTY BUILD_RPATH "$ORIGIN/python/lib")
|
|
endif ()
|
|
|
|
add_custom_command(TARGET ${_TEST_NAME}_tests POST_BUILD
|
|
COMMAND ${CMAKE_COMMAND} -E rm -rf
|
|
"$<TARGET_FILE_DIR:${_TEST_NAME}_tests>/python"
|
|
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
|
"${CMAKE_PREFIX_PATH}/libpython"
|
|
"$<TARGET_FILE_DIR:${_TEST_NAME}_tests>/python"
|
|
COMMENT "Copying Python runtime for the plugin host API tests"
|
|
VERBATIM
|
|
)
|
|
elseif (FLATPAK)
|
|
# Same <testdir>/python home as WIN32/APPLE; symlink since /app/libpython
|
|
# already ships in the flatpak (the test exe links libpython3.12.so from it).
|
|
add_custom_command(TARGET ${_TEST_NAME}_tests POST_BUILD
|
|
COMMAND ${CMAKE_COMMAND} -E rm -rf
|
|
"$<TARGET_FILE_DIR:${_TEST_NAME}_tests>/python"
|
|
COMMAND ${CMAKE_COMMAND} -E create_symlink
|
|
"${CMAKE_PREFIX_PATH}/libpython"
|
|
"$<TARGET_FILE_DIR:${_TEST_NAME}_tests>/python"
|
|
COMMENT "Linking Python runtime for flatpak plugin host API tests"
|
|
VERBATIM
|
|
)
|
|
endif()
|
|
|
|
# scripts/run_unit_tests.sh installs the tests' numpy into that runtime with this uv,
|
|
# staged where the app build tree keeps it (<exe dir>/tools/uv, see src/CMakeLists.txt).
|
|
if (ORCA_BUNDLED_UV_EXECUTABLE)
|
|
add_custom_command(TARGET ${_TEST_NAME}_tests POST_BUILD
|
|
COMMAND ${CMAKE_COMMAND} -E make_directory "$<TARGET_FILE_DIR:${_TEST_NAME}_tests>/tools/uv"
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${ORCA_BUNDLED_UV_EXECUTABLE}"
|
|
"$<TARGET_FILE_DIR:${_TEST_NAME}_tests>/tools/uv/${ORCA_BUNDLED_UV_FILENAME}"
|
|
COMMENT "Copying uv for the plugin host API tests"
|
|
VERBATIM
|
|
)
|
|
endif()
|
|
|
|
orcaslicer_discover_tests(${_TEST_NAME}_tests)
|