Skip to content

Commit 56737b9

Browse files
committed
Fix CI coverage: remove ASan conflict, fix lcov directory, add coverage flush
- Remove -fsanitize=address from coverage build (conflicts with --coverage) - Fix lcov directory from .pio/build/coverage/src to .pio/build/coverage - Add --ignore-errors empty to handle empty coverage gracefully - Add flushCoverageAndExit() utility for proper coverage data flush
1 parent 858161c commit 56737b9

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

.github/workflows/test_native.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
permissions: {}
88

99
env:
10-
LCOV_CAPTURE_FLAGS: --quiet --capture --include "${PWD}/src/*" --exclude '*/src/mesh/generated/*' --directory .pio/build/coverage/src --base-directory "${PWD}"
10+
LCOV_CAPTURE_FLAGS: --quiet --capture --include "${PWD}/src/*" --exclude '*/src/mesh/generated/*' --directory .pio/build/coverage --base-directory "${PWD}" --ignore-errors empty
1111

1212
jobs:
1313
simulator-tests:

src/platform/portduino/PortduinoGlue.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,4 +470,14 @@ extern struct portduino_config_struct {
470470
out << YAML::EndMap; // General
471471
return out.c_str();
472472
}
473-
} portduino_config;
473+
} portduino_config;
474+
475+
// Utility function to flush coverage data before exit
476+
inline void flushCoverageAndExit(int code) {
477+
#ifdef __GNUC__
478+
// Flush coverage data when built with --coverage
479+
extern "C" void __gcov_flush(void);
480+
__gcov_flush();
481+
#endif
482+
exit(code);
483+
}

variants/native/portduino/platformio.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,4 +125,4 @@ build_src_filter = ${env:native-tft.build_src_filter}
125125

126126
[env:coverage]
127127
extends = env:native
128-
build_flags = -lgcov --coverage -fprofile-abs-path -fsanitize=address ${env:native.build_flags}
128+
build_flags = -lgcov --coverage -fprofile-abs-path ${env:native.build_flags}

0 commit comments

Comments
 (0)