From 536d2623c1d8f6857b5ada1c0f1b92b641f80091 Mon Sep 17 00:00:00 2001 From: Elias Steurer Date: Fri, 30 Oct 2020 15:37:00 +0100 Subject: [PATCH] Add doctest and google benchmark --- .gitlab-ci.yml | 35 +++++++++++++++++++++++++ ScreenPlay/CMakeLists.txt | 15 ++++++++++- ScreenPlay/src/screenplaymanager.cpp | 8 +++++- Tools/install_dependencies_linux_mac.sh | 4 +-- Tools/install_dependencies_windows.bat | 2 +- 5 files changed, 59 insertions(+), 5 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 71303079..363c29b4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -91,6 +91,41 @@ build:linux_release: paths: - build-x64-linux-release/bin/ +test:windows_debug: + stage: test + tags: + - windows10 + - vs2019 + dependencies: + - build:windows_debug + needs: + - build:windows_debug + script: + - ./build-x64-window-debug/bin/ScreenPlay.exe --no-run=false --exit=true --reporters=junit --out=test-report-junit.xml + artifacts: + expire_in: '4 weeks' + when: always + reports: + junit: test-report-junit.xml + +test:windows_release: + stage: test + tags: + - windows10 + - vs2019 + dependencies: + - build:windows_release + needs: + - build:windows_release + script: + - ./build-x64-window-release/bin/ScreenPlay.exe --no-run=false --exit=true --reporters=junit --out=test-report-junit.xml + artifacts: + expire_in: '4 weeks' + when: always + reports: + junit: test-report-junit.xml + + build_docs: stage: .post diff --git a/ScreenPlay/CMakeLists.txt b/ScreenPlay/CMakeLists.txt index 485a9448..9b092b4e 100644 --- a/ScreenPlay/CMakeLists.txt +++ b/ScreenPlay/CMakeLists.txt @@ -11,6 +11,9 @@ find_package( REQUIRED) find_package(OpenSSL REQUIRED) +find_package(benchmark CONFIG REQUIRED) +find_package(doctest CONFIG REQUIRED) + if(WIN32) find_package(sentry CONFIG REQUIRED) endif() @@ -86,7 +89,17 @@ endif() target_compile_definitions(${PROJECT_NAME} PRIVATE "GIT_VERSION=${GIT_VERSION}") -target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Quick Qt5::Gui Qt5::Widgets Qt5::Core Qt5::WebEngine ScreenPlaySDK) +target_link_libraries( + ${PROJECT_NAME} + PRIVATE Qt5::Quick + Qt5::Gui + Qt5::Widgets + Qt5::Core + Qt5::WebEngine + ScreenPlaySDK + benchmark::benchmark + benchmark::benchmark_main + doctest::doctest) if(WIN32) target_link_libraries(${PROJECT_NAME} PRIVATE sentry::sentry) diff --git a/ScreenPlay/src/screenplaymanager.cpp b/ScreenPlay/src/screenplaymanager.cpp index 9b71adeb..0c245ef4 100644 --- a/ScreenPlay/src/screenplaymanager.cpp +++ b/ScreenPlay/src/screenplaymanager.cpp @@ -1,5 +1,6 @@ #include "screenplaymanager.h" #include +#include namespace ScreenPlay { @@ -18,7 +19,6 @@ namespace ScreenPlay { ScreenPlayManager::ScreenPlayManager( QObject* parent) : QObject { parent } - , m_server { std::make_unique() } { @@ -593,4 +593,10 @@ void ScreenPlayManager::loadProfiles() } } +TEST_CASE("Loads profiles.json") +{ + GlobalVariables globalVariables; + ScreenPlayManager manager; +} + } diff --git a/Tools/install_dependencies_linux_mac.sh b/Tools/install_dependencies_linux_mac.sh index 5302f7eb..9fa4650a 100644 --- a/Tools/install_dependencies_linux_mac.sh +++ b/Tools/install_dependencies_linux_mac.sh @@ -12,7 +12,7 @@ chmod +x bootstrap-vcpkg.sh chmod +x vcpkg if [[ "$OSTYPE" == "darwin"* ]]; then -./vcpkg install openssl-unix sentry-native --triplet x64-osx --recurse +./vcpkg install openssl-unix sentry-native doctest benchmark --triplet x64-osx --recurse else -./vcpkg install openssl-unix sentry-native --triplet x64-linux --recurse +./vcpkg install openssl-unix sentry-native doctest benchmark --triplet x64-linux --recurse fi \ No newline at end of file diff --git a/Tools/install_dependencies_windows.bat b/Tools/install_dependencies_windows.bat index e1aa85e6..c9483a4f 100644 --- a/Tools/install_dependencies_windows.bat +++ b/Tools/install_dependencies_windows.bat @@ -10,7 +10,7 @@ git checkout 18ab4b72a26284f0df28295ce7bf9b21c96f20f4 call bootstrap-vcpkg.bat rem Install vcpkg dependencies -vcpkg.exe install openssl sentry-native --triplet x64-windows --recurse +vcpkg.exe install openssl sentry-native doctest benchmark --triplet x64-windows --recurse cd .. cd ScreenPlay