From b993eb8852a147ffa77b274b5873bbb9decf5350 Mon Sep 17 00:00:00 2001 From: ado Date: Wed, 21 Feb 2024 19:41:06 +0100 Subject: [PATCH] [skip ci] Update coverage.yml to work with lcov2.0 --- .github/workflows/coverage.yml | 5 ++++- include/ss/common.hpp | 1 + include/ss/parser.hpp | 1 + script/ci_install_lcov.sh | 7 +++++++ test/test_parser2.hpp | 3 +++ 5 files changed, 16 insertions(+), 1 deletion(-) create mode 100755 script/ci_install_lcov.sh diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index fa59e39..19869c8 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -46,7 +46,10 @@ jobs: - name: Install test coverage tools run: | apt update - apt install -y gcovr lcov + apt install -y gcovr + + - name: Install lcov2.0 + run: script/ci_install_lcov.sh - 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" diff --git a/include/ss/common.hpp b/include/ss/common.hpp index 70c8241..095561c 100644 --- a/include/ss/common.hpp +++ b/include/ss/common.hpp @@ -31,6 +31,7 @@ inline ssize_t get_line_file(char** lineptr, size_t* n, FILE* stream) { return getline(lineptr, n, stream); } #else +// TODO set ERRNO ? using ssize_t = int64_t; inline ssize_t get_line_file(char** lineptr, size_t* n, FILE* stream) { size_t pos; diff --git a/include/ss/parser.hpp b/include/ss/parser.hpp index 72ed190..b715e75 100644 --- a/include/ss/parser.hpp +++ b/include/ss/parser.hpp @@ -742,6 +742,7 @@ private: reader(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, const char* const buffer, size_t csv_data_size, size_t& curr_char) { diff --git a/script/ci_install_lcov.sh b/script/ci_install_lcov.sh new file mode 100755 index 0000000..2dbe193 --- /dev/null +++ b/script/ci_install_lcov.sh @@ -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 diff --git a/test/test_parser2.hpp b/test/test_parser2.hpp index e3e17db..1db140d 100644 --- a/test/test_parser2.hpp +++ b/test/test_parser2.hpp @@ -261,11 +261,14 @@ std::vector generate_csv_data(const std::vector& data, const std::string& file_name) { std::ofstream out{file_name, std::ios_base::app}; std::string line; + + // TODO remove new line at eof randomly for (size_t i = 0; i < data.size(); ++i) { line += data[i]; if (i != data.size() - 1) { line += delim; } + } out << line << std::endl;