[skip ci] Update coverage.yml to work with lcov2.0

This commit is contained in:
ado 2024-02-21 19:41:06 +01:00
parent 5e32d722e8
commit b993eb8852
5 changed files with 16 additions and 1 deletions

View File

@ -46,7 +46,10 @@ jobs:
- name: Install test coverage tools - name: Install test coverage tools
run: | run: |
apt update apt update
apt install -y gcovr lcov apt install -y gcovr
- name: Install lcov2.0
run: script/ci_install_lcov.sh
- name: Configure - name: Configure
run: cmake -S test -B build -D CMAKE_BUILD_TYPE=Debug -D CMAKE_CXX_FLAGS="-Wall -fprofile-arcs -ftest-coverage --coverage -fno-elide-constructors -fno-default-inline" run: cmake -S test -B build -D CMAKE_BUILD_TYPE=Debug -D CMAKE_CXX_FLAGS="-Wall -fprofile-arcs -ftest-coverage --coverage -fno-elide-constructors -fno-default-inline"

View File

@ -31,6 +31,7 @@ inline ssize_t get_line_file(char** lineptr, size_t* n, FILE* stream) {
return getline(lineptr, n, stream); return getline(lineptr, n, stream);
} }
#else #else
// TODO set ERRNO ?
using ssize_t = int64_t; using ssize_t = int64_t;
inline ssize_t get_line_file(char** lineptr, size_t* n, FILE* stream) { inline ssize_t get_line_file(char** lineptr, size_t* n, FILE* stream) {
size_t pos; size_t pos;

View File

@ -742,6 +742,7 @@ private:
reader(const reader& other) = delete; reader(const reader& other) = delete;
reader& operator=(const reader& other) = delete; reader& operator=(const reader& other) = delete;
// TODO set error numbers on error
ssize_t get_line_buffer(char** lineptr, size_t* n, ssize_t get_line_buffer(char** lineptr, size_t* n,
const char* const buffer, size_t csv_data_size, const char* const buffer, size_t csv_data_size,
size_t& curr_char) { size_t& curr_char) {

7
script/ci_install_lcov.sh Executable file
View File

@ -0,0 +1,7 @@
#!/usr/bin/env sh
echo yes | cpan DateTime Capture::Tiny
wget -qO- https://github.com/linux-test-project/lcov/releases/download/v2.0/lcov-2.0.tar.gz | tar xvz
(cd lcov && make install)
lcov --version

View File

@ -261,11 +261,14 @@ std::vector<std::string> generate_csv_data(const std::vector<field>& data,
const std::string& file_name) { const std::string& file_name) {
std::ofstream out{file_name, std::ios_base::app}; std::ofstream out{file_name, std::ios_base::app};
std::string line; std::string line;
// TODO remove new line at eof randomly
for (size_t i = 0; i < data.size(); ++i) { for (size_t i = 0; i < data.size(); ++i) {
line += data[i]; line += data[i];
if (i != data.size() - 1) { if (i != data.size() - 1) {
line += delim; line += delim;
} }
} }
out << line << std::endl; out << line << std::endl;