From e516608c5eab250498f77852643e464872df6c09 Mon Sep 17 00:00:00 2001 From: Cosmin Stejerean Date: Wed, 18 Oct 2023 16:06:10 -0700 Subject: [PATCH] feat: copy packager_test.py in CMake (#1284) This is used to run a fairly large number of integrations tests (which are exposing some failures on the CMake branch). Let's copy these over first to enable the integration tests workflow. Actually running integration tests in CTest is off by default (gated by `SKIP_INTEGRATION_TESTS` while we fix the tests). --- CMakeLists.txt | 2 ++ packager/CMakeLists.txt | 31 ++++++++++++++++++++++++++++++- packager/app/CMakeLists.txt | 14 -------------- 3 files changed, 32 insertions(+), 15 deletions(-) delete mode 100644 packager/app/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index b267dd359b..daf2d5d0da 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,6 +22,8 @@ option(LIBPACKAGER_SHARED "Build libpackager as a shared library" OFF) # Enable CMake's test infrastructure. enable_testing() +option(SKIP_INTEGRATION_TESTS "Skip the packager integration tests" ON) + # Subdirectories with their own CMakeLists.txt add_subdirectory(packager) add_subdirectory(link-test) diff --git a/packager/CMakeLists.txt b/packager/CMakeLists.txt index a81b2f1c13..daa3c404dc 100644 --- a/packager/CMakeLists.txt +++ b/packager/CMakeLists.txt @@ -191,8 +191,37 @@ target_link_libraries(packager_test gtest gtest_main) -configure_file(packager.pc.in packager.pc @ONLY) +list(APPEND packager_test_py_sources + "${CMAKE_CURRENT_SOURCE_DIR}/app/test/packager_app.py" + "${CMAKE_CURRENT_SOURCE_DIR}/app/test/packager_test.py" + "${CMAKE_CURRENT_SOURCE_DIR}/app/test/test_env.py") +list(APPEND packager_test_py_output + "${CMAKE_CURRENT_BINARY_DIR}/packager_app.py" + "${CMAKE_CURRENT_BINARY_DIR}/packager_test.py" + "${CMAKE_CURRENT_BINARY_DIR}/test_env.py") + +add_custom_command( + OUTPUT ${packager_test_py_output} + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/app/test/packager_app.py ${CMAKE_CURRENT_BINARY_DIR}/packager_app.py + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/app/test/packager_test.py ${CMAKE_CURRENT_BINARY_DIR}/packager_test.py + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/app/test/test_env.py ${CMAKE_CURRENT_BINARY_DIR}/test_env.py + DEPENDS ${packager_test_py_sources} +) + +add_custom_target(packager_test_py_copy ALL + DEPENDS ${packager_test_py_output} packager + SOURCES ${packager_test_py_sources} +) + +if(NOT SKIP_INTEGRATION_TESTS) + add_test (NAME packager_test_py + COMMAND ${PYTHON_EXECUTABLE} packager_test.py + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + ) +endif() + +configure_file(packager.pc.in packager.pc @ONLY) install(DIRECTORY ../include/packager DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) diff --git a/packager/app/CMakeLists.txt b/packager/app/CMakeLists.txt deleted file mode 100644 index 2c14a65a78..0000000000 --- a/packager/app/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright 2023 Google LLC. All rights reserved. -# -# Use of this source code is governed by a BSD-style -# license that can be found in the LICENSE file or at -# https://developers.google.com/open-source/licenses/bsd - -add_library(libpackager STATIC - job_manager.cc - single_thread_job_manager.cc) -target_link_libraries(libpackager - absl::synchronization - media_chunking - media_origin - status)