Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate catch2 v2 to v3 #683

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion scripts/install-deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ install_azure_storage_sdk=false
# ADUC Test Deps

install_catch2=false
default_catch2_ref=v2.x
#default_catch2_ref=v2.x
default_catch2_ref=v3.8.0
catch2_ref=$default_catch2_ref
install_swupdate=false
default_swupdate_ref=2021.11
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ add_executable (${PROJECT_NAME} ${sources})
target_compile_definitions (${PROJECT_NAME} PRIVATE ADUC_LOG_FOLDER="${ADUC_LOG_FOLDER}")

target_link_libraries (${PROJECT_NAME} PRIVATE diagnostic_utils::diagnostics_config_utils
Catch2::Catch2 Parson::parson)
Catch2::Catch2WithMain Parson::parson)

target_link_aziotsharedutil (${PROJECT_NAME} PRIVATE)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

#include <azure_c_shared_utility/strings.h>
#include <azure_c_shared_utility/vector.h>
#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>
#include <iostream>
#include <parson.h>
#include <sstream>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
* Licensed under the MIT License.
*/
#define CATCH_CONFIG_MAIN
#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ endif ()

target_link_libraries (
${PROJECT_NAME} PRIVATE aduc::jws_utils aduc::crypto_utils aduc::string_utils
diagnostic_utils::file_info_utils Catch2::Catch2)
diagnostic_utils::file_info_utils Catch2::Catch2WithMain)

include (CTest)
include (Catch)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#include <aduc/c_utils.h>
#include <aduc/calloc_wrapper.hpp>
#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>
#include <ctime>
#include <time.h>
#include <umock_c/umock_c.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
* Licensed under the MIT License.
*/
#define CATCH_CONFIG_MAIN
#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ find_package (Catch2 REQUIRED)

add_executable (${PROJECT_NAME} "")

target_sources (${PROJECT_NAME} PRIVATE main.cpp microsoft_delta_download_handler_utils_ut.cpp)
target_sources (${PROJECT_NAME} PRIVATE microsoft_delta_download_handler_utils_ut.cpp)

target_link_libraries (
${PROJECT_NAME}
PRIVATE aduc::adu_types
aduc::microsoft_delta_download_handler_utils
aduc::parser_utils
aduc::workflow_utils
Catch2::Catch2)
Catch2::Catch2WithMain)

include (CTest)
include (Catch)
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* Licensed under the MIT License.
*/

#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>
using Catch::Matchers::Equals;

#include "aduc/microsoft_delta_download_handler_utils.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ add_executable (${PROJECT_NAME} "")

target_include_directories (${PROJECT_NAME} PRIVATE inc ${ADUC_EXPORT_INCLUDES})

target_sources (${PROJECT_NAME} PRIVATE main.cpp source_update_cache_utils_ut.cpp)
target_sources (${PROJECT_NAME} PRIVATE source_update_cache_utils_ut.cpp)

target_link_libraries (
${PROJECT_NAME}
Expand All @@ -21,7 +21,7 @@ target_link_libraries (
aduc::test_utils
aduc::system_utils
aduc::workflow_utils
Catch2::Catch2
Catch2::Catch2WithMain
Parson::parson)

target_link_libraries (${PROJECT_NAME} PRIVATE libaducpal)
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#include "aduc/source_update_cache_utils.h"

#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>
using Catch::Matchers::Equals;
#include <aduc/aduc_inode.h> // ADUC_INODE_SENTINEL_VALUE
#include <aduc/auto_dir.hpp> // aduc::AutoDir
Expand Down
4 changes: 2 additions & 2 deletions src/extensions/extension_manager/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ find_package (Parson REQUIRED)

add_executable (${target_name})

target_sources (${target_name} PRIVATE src/main.cpp src/extension_manager_ut.cpp
target_sources (${target_name} PRIVATE src/extension_manager_ut.cpp
src/extension_manager_download_test_case.cpp)

target_include_directories (${target_name} PUBLIC inc ${ADUC_EXPORT_INCLUDES}
Expand All @@ -24,7 +24,7 @@ target_link_libraries (
aduc::system_utils
aduc::test_utils
aduc::workflow_utils
Catch2::Catch2
Catch2::Catch2WithMain
Parson::parson)

# Windows needs all EXEs to have links to all potential libraries so this is included here
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include <aduc/workflow_utils.h>
#include <aducpal/stdio.h> // remove
#include <aducpal/unistd.h> // UNREFERENCED_PARAMETER
#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>
#include <fstream>
#include <memory>
#include <parson.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Licensed under the MIT License.
*/
#include <aduc/result.h>
#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>
#include <extension_manager_download_test_case.hpp>

bool operator==(ADUC_Result a, ADUC_Result b)
Expand Down
9 changes: 0 additions & 9 deletions src/extensions/extension_manager/tests/src/main.cpp

This file was deleted.

4 changes: 2 additions & 2 deletions src/extensions/step_handlers/apt_handler/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ include (agentRules)
compileasc99 ()
disablertti ()

set (sources main.cpp apt_parser_ut.cpp ../src/apt_handler.cpp ../src/apt_parser.cpp)
set (sources apt_parser_ut.cpp ../src/apt_handler.cpp ../src/apt_parser.cpp)

find_package (Catch2 REQUIRED)

Expand Down Expand Up @@ -41,7 +41,7 @@ target_link_libraries (
aduc::system_utils
aduc::workflow_data_utils
aduc::workflow_utils
Catch2::Catch2)
Catch2::Catch2WithMain)

target_link_libraries (${PROJECT_NAME} PRIVATE libaducpal)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#include "aduc/apt_parser.hpp"

#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>
using Catch::Matchers::Equals;

#include <sstream>
Expand Down
2 changes: 1 addition & 1 deletion src/extensions/step_handlers/apt_handler/tests/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
*/

#define CATCH_CONFIG_MAIN
#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ include (agentRules)
compileasc99 ()
disablertti ()

set (sources main.cpp script_handler_ut.cpp ../src/script_handler.cpp
set (sources script_handler_ut.cpp ../src/script_handler.cpp
../../../update_manifest_handlers/steps_handler/src/steps_handler.cpp)

add_executable (${PROJECT_NAME} ${sources})
Expand Down Expand Up @@ -45,7 +45,7 @@ target_link_libraries (
aduc::system_utils
aduc::workflow_data_utils
aduc::workflow_utils
Catch2::Catch2)
Catch2::Catch2WithMain)

target_link_libraries (${PROJECT_NAME} PRIVATE libaducpal)

Expand Down
9 changes: 0 additions & 9 deletions src/extensions/step_handlers/script_handler/tests/main.cpp

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include "aduc/workflow_utils.h"
#include "aducpal/stdlib.h" // setenv

#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>
using Catch::Matchers::Equals;

#include <sstream>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ include (agentRules)
compileasc99 ()
disablertti ()

set (sources main.cpp simulator_handler_unit_tests.cpp ../src/simulator_handler.cpp)
set (sources simulator_handler_unit_tests.cpp ../src/simulator_handler.cpp)

find_package (Catch2 REQUIRED)
find_package (IotHubClient REQUIRED)
Expand All @@ -33,7 +33,8 @@ target_link_libraries (
aduc::system_utils
aduc::workflow_data_utils
aduc::workflow_utils
Parson::parson)
Parson::parson
Catch2::Catch2WithMain)

# Windows needs all EXEs to have links to all potential libraries so this is included here
if (WIN32)
Expand Down
10 changes: 0 additions & 10 deletions src/extensions/step_handlers/simulator_handler/tests/main.cpp

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include "aduc/simulator_handler.hpp"
#include "aduc/workflow_utils.h"

#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>
using Catch::Matchers::Equals;

#include <fstream>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ compileasc99 ()
disablertti ()

set (sources
main.cpp swupdate_handler_v2_ut.cpp ../src/handler_create.cpp ../src/swupdate_handler_v2.cpp
swupdate_handler_v2_ut.cpp ../src/handler_create.cpp ../src/swupdate_handler_v2.cpp
../../../update_manifest_handlers/steps_handler/src/steps_handler.cpp)

find_package (Catch2 REQUIRED)
Expand Down Expand Up @@ -43,7 +43,7 @@ target_link_libraries (
aduc::system_utils
aduc::workflow_data_utils
aduc::workflow_utils
Catch2::Catch2)
Catch2::Catch2WithMain)

target_link_libraries (${PROJECT_NAME} PRIVATE libaducpal)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
*/

#define CATCH_CONFIG_MAIN
#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "aduc/system_utils.h"
#include "aduc/workflow_utils.h"

#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>
using Catch::Matchers::Equals;

#include <sstream>
Expand Down Expand Up @@ -418,7 +418,7 @@ TEST_CASE("SWUpdate sample script --action-download")
ADUC_ConfigInfo_ReleaseInstance(config);
}

TEST_CASE("SWUpdate sample script --action-install", "[!hide][functional_test]")
TEST_CASE("SWUpdate sample script --action-install", "[.][functional_test]")
{
set_test_config_folder();
const ADUC_ConfigInfo* config = ADUC_ConfigInfo_GetInstance();
Expand Down
4 changes: 2 additions & 2 deletions src/platform_layers/linux_platform_layer/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ include (agentRules)
compileasc99 ()
disablertti ()

set (sources main.cpp download_ut.cpp mock_do_download.cpp)
set (sources download_ut.cpp mock_do_download.cpp)

add_executable (${PROJECT_NAME} ${sources})

Expand All @@ -33,7 +33,7 @@ target_link_libraries (
aduc::exception_utils
aduc::c_utils
atomic
Catch2::Catch2
Catch2::Catch2WithMain
libaducpal)

include (CTest)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @copyright Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*/
#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>
#include <cstring>
#include <pthread.h>

Expand Down
9 changes: 0 additions & 9 deletions src/platform_layers/linux_platform_layer/tests/main.cpp

This file was deleted.

4 changes: 2 additions & 2 deletions src/rootkey_workflow/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ disablertti ()
find_package (Catch2 REQUIRED)

add_executable (${target_name})
target_sources (${target_name} PRIVATE main.cpp rootkey_workflow_ut.cpp)
target_sources (${target_name} PRIVATE rootkey_workflow_ut.cpp)

target_link_libraries (
${target_name}
PRIVATE Catch2::Catch2
PRIVATE Catch2::Catch2WithMain
aduc::c_utils
aduc::rootkey_workflow
aduc::root_key_utils)
Expand Down
2 changes: 1 addition & 1 deletion src/rootkey_workflow/tests/rootkey_workflow_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include "aduc/rootkey_workflow.h" // RootKeyWorkflow_UpdateRootKeys
#include <aduc/c_utils.h>
#include <aduc/result.h>
#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>
#include <root_key_util.h> // RootKeyUtility_GetReportingErc

using Catch::Matchers::Equals;
Expand Down
Loading