diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 9215da07..3f848dc9 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -34,7 +34,7 @@ jobs: run: cmake --build . --target cov_data - name: Report code coverage - uses: zgosalvez/github-actions-report-lcov@v3 + uses: zgosalvez/github-actions-report-lcov@v4 with: coverage-files: build/cov.info.cleaned minimum-coverage: 30 diff --git a/CMakeLists.txt b/CMakeLists.txt index b5d0e0f5..3627bdd8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -273,9 +273,7 @@ if (ENABLE_COVERAGE) ) target_link_libraries( - GameAnalytics - PRIVATE - --coverage + GameAnalytics PRIVATE -fprofile-arcs -ftest-coverage ) set(covname cov) @@ -289,13 +287,22 @@ if (ENABLE_COVERAGE) COMMAND GameAnalyticsUnitTests # Capturing lcov counters and generating report - COMMAND ${LCOV_PATH} --directory . --capture --output-file ${covname}.info + + COMMAND echo "Processing code coverage counters and generating report." + + COMMAND ${LCOV_PATH} --directory . --capture --output-file ${covname}.info --branch-coverage --rc geninfo_unexecuted_blocks=1 --rc no_exception_branch=1 + + COMMAND echo "Removing unwanted files from coverage report." + COMMAND ${LCOV_PATH} --remove ${covname}.info '${CMAKE_SOURCE_DIR}/source/dependencies/*' '${CMAKE_SOURCE_DIR}/test/*' '/usr/*' '/Applications/Xcode.app/*' --output-file ${covname}.info.cleaned + --ignore-errors unused + + COMMAND echo "Finished processing code coverage counters and generating report." ) if (GENHTML_PATH) diff --git a/source/dependencies/crossguid/guid.h b/source/dependencies/crossguid/guid.h index 7304aeef..ed5c74ef 100644 --- a/source/dependencies/crossguid/guid.h +++ b/source/dependencies/crossguid/guid.h @@ -36,6 +36,7 @@ THE SOFTWARE. #include #include #include +#include #define BEGIN_XG_NAMESPACE namespace xg { #define END_XG_NAMESPACE } diff --git a/source/gameanalytics/GameAnalytics.cpp b/source/gameanalytics/GameAnalytics.cpp index 06f06d69..3c33a4ee 100644 --- a/source/gameanalytics/GameAnalytics.cpp +++ b/source/gameanalytics/GameAnalytics.cpp @@ -517,7 +517,7 @@ namespace gameanalytics try { json fieldsJson = utilities::parseFields(fields); - events::GAEvents::addDesignEvent(eventId, value, false, fieldsJson, mergeFields); + events::GAEvents::addDesignEvent(eventId, value, true, fieldsJson, mergeFields); } catch(json::exception const& e) { @@ -739,11 +739,6 @@ namespace gameanalytics }); } - std::string GameAnalytics::getRemoteConfigsValueAsString(std::string const& key) - { - return getRemoteConfigsValueAsString(key, ""); - } - std::string GameAnalytics::getRemoteConfigsValueAsString(std::string const& key, std::string const& defaultValue) { return state::GAState::getRemoteConfigsStringValue(key, defaultValue); diff --git a/source/gameanalytics/Platform/GAMacOS.cpp b/source/gameanalytics/Platform/GAMacOS.cpp index 31509e2e..1fba913b 100644 --- a/source/gameanalytics/Platform/GAMacOS.cpp +++ b/source/gameanalytics/Platform/GAMacOS.cpp @@ -259,8 +259,9 @@ int64_t gameanalytics::GAPlatformMacOS::getBootTime() const struct timeval currentTime = {}; gettimeofday(¤tTime, NULL); - - return currentTime.tv_sec - startTime.tv_sec; + + int64_t remainingMs = static_cast(currentTime.tv_usec - startTime.tv_usec) * 1e-3; + return (currentTime.tv_sec - startTime.tv_sec) * 1000 + remainingMs; } #endif diff --git a/source/gameanalytics/Platform/GAWin32.cpp b/source/gameanalytics/Platform/GAWin32.cpp index f0f43ef1..f63d8320 100644 --- a/source/gameanalytics/Platform/GAWin32.cpp +++ b/source/gameanalytics/Platform/GAWin32.cpp @@ -332,7 +332,7 @@ int64_t GAPlatformWin32::getBootTime() const // filetime is expressed in 100s of nanoseconds std::chrono::nanoseconds timeInNs = std::chrono::nanoseconds(value * 100); - return std::chrono::duration_cast(timeInNs).count(); + return std::chrono::duration_cast(timeInNs).count(); } return 0ll;