Delete all .gcda files when integtests coverage fails (#7510)
* Delete all gcda files when integtests fail * Update ChangeLog * Test failure * Move test dir creation to main * Undo retry loop which didn't solve the issue * Use `-fprofile-update=atomic` according to gcov bug 68080
This commit is contained in:
parent
fe16ba63fd
commit
462c4c242c
8 changed files with 19 additions and 40 deletions
31
.github/actions/run-retry/action.yml
vendored
31
.github/actions/run-retry/action.yml
vendored
|
|
@ -1,31 +0,0 @@
|
|||
name: "Retry command"
|
||||
description: "Retries a specified command up to a specified number of times."
|
||||
inputs:
|
||||
run:
|
||||
description: "The command to run"
|
||||
required: true
|
||||
retries:
|
||||
description: "Number of retries"
|
||||
required: false
|
||||
default: 3
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Run Command with Retry
|
||||
shell: bash
|
||||
run: |
|
||||
command="${{ inputs.run }}"
|
||||
retries=${{ inputs.retries }}
|
||||
delay=${{ inputs.delay }}
|
||||
attempt=1
|
||||
|
||||
until $command; do
|
||||
if [ $attempt -ge $retries ]; then
|
||||
echo "Attempt $attempt failed! No more retries left."
|
||||
exit 1
|
||||
fi
|
||||
echo "Attempt $attempt failed! Retrying in $delay seconds..."
|
||||
attempt=$((attempt + 1))
|
||||
done
|
||||
|
||||
echo "Command succeeded on attempt $attempt."
|
||||
4
.github/workflows/sonarcloud-analysis.yml
vendored
4
.github/workflows/sonarcloud-analysis.yml
vendored
|
|
@ -82,9 +82,7 @@ jobs:
|
|||
- name: Integration tests coverage
|
||||
env:
|
||||
QT_QPA_PLATFORM: offscreen
|
||||
uses: ./.github/actions/run-retry
|
||||
with:
|
||||
run: cmake --build build --target coverage-integtests
|
||||
run: cmake --build build --target coverage-integtests
|
||||
|
||||
- name: Get coverage report paths
|
||||
id: coverage-paths
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ Enhancements:
|
|||
- #7506 Make `APPLE_CODESIGN_ID` env var optional for CE CI
|
||||
- #7507 Add `run-retry` action to workaround `integtest` `gcovr` issue
|
||||
- #7509 Use GitHub vars to determine custom runner names
|
||||
- #7510 Delete all `.gcda` files when integtests coverage fails
|
||||
|
||||
# 1.16.0
|
||||
|
||||
|
|
|
|||
|
|
@ -583,6 +583,11 @@ macro(configure_coverage)
|
|||
set(test_exclude subprojects/* build/* src/test/*)
|
||||
set(test_src ${PROJECT_SOURCE_DIR}/src)
|
||||
|
||||
# Apparently solves the bug in gcov where it returns negative counts and confuses gcovr.
|
||||
# > Got negative hit value in gcov line 'branch 2 taken -1' caused by a bug in gcov tool
|
||||
# Bug report: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68080
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-update=atomic")
|
||||
|
||||
setup_target_for_coverage_gcovr_xml(
|
||||
NAME
|
||||
coverage-${INTEG_TESTS_BIN}
|
||||
|
|
|
|||
|
|
@ -24,11 +24,17 @@
|
|||
#include "arch/win32/ArchMiscWindows.h"
|
||||
#endif
|
||||
|
||||
#include <filesystem>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
using synergy::test::ExitTimeout;
|
||||
|
||||
const auto testDir = "tmp/test";
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
// HACK: Unit tests should not use the filesystem.
|
||||
std::filesystem::create_directories(testDir);
|
||||
|
||||
ExitTimeout exitTimeout(1, "Integration tests");
|
||||
|
||||
#if SYSAPI_WIN32
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@
|
|||
*/
|
||||
|
||||
#include "base/Path.h"
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
|
@ -25,8 +24,6 @@ const std::string testDir = "tmp/test";
|
|||
const std::wstring testDirW = L"tmp/test";
|
||||
|
||||
TEST(PathTests, open_file_using_path) {
|
||||
std::filesystem::create_directories(testDir);
|
||||
|
||||
std::string utf8FileName = testDir + "/тіás.txt";
|
||||
#if SYSAPI_WIN32
|
||||
// Windows uses UTF-16 for file path and names
|
||||
|
|
|
|||
|
|
@ -24,11 +24,17 @@
|
|||
#include "arch/win32/ArchMiscWindows.h"
|
||||
#endif
|
||||
|
||||
#include <filesystem>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
using synergy::test::ExitTimeout;
|
||||
|
||||
const auto testDir = "tmp/test";
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
// HACK: Unit tests should not use the filesystem.
|
||||
std::filesystem::create_directories(testDir);
|
||||
|
||||
ExitTimeout exitTimeout(1, "Unit tests");
|
||||
|
||||
#if SYSAPI_WIN32
|
||||
|
|
|
|||
|
|
@ -18,15 +18,12 @@
|
|||
#if WINAPI_XWINDOWS
|
||||
#include "synergy/unix/X11LayoutsParser.h"
|
||||
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
const std::string testDir = "tmp/test";
|
||||
|
||||
void createTestFiles() {
|
||||
std::filesystem::create_directories(testDir);
|
||||
|
||||
std::ofstream correctEvdevFile(testDir + "/correctEvdev.xml");
|
||||
if (!correctEvdevFile.is_open()) {
|
||||
FAIL();
|
||||
|
|
|
|||
Loading…
Reference in a new issue