zero9178 / C-Cpp-Coverage-for-CLion

Get coverage data in CLion using gcov or llvm-cov
MIT License
38 stars 2 forks source link

No coverage data found despite the cmake folder is full of `gcov` files #1

Closed rdxernest closed 4 years ago

rdxernest commented 5 years ago

compiled and built my test project like following

TARGET_COMPILE_OPTIONS(etcdTest PUBLIC
                       **--coverage**)
TARGET_INCLUDE_DIRECTORIES(etcdTest PRIVATE
                           ${GRPC_INCLUDE_DIR}
                           ${PROTOBUF_INCLUDE_DIR}
                           ${ETCDIncludePath}
                           )

TARGET_LINK_LIBRARIES(etcdTest
                      ${PROTOBUF_LIBRARY}
                      gRPC::grpc
                      gRPC::grpc++
                      pthread
                      dl
                      **gcov**
                      )

Got the "No coverage data found. Did you compile with "--coverage"?" The cmake-build-debug/CMakeFiles/ folder is full of gcov files. Am I doing something wrong?

zero9178 commented 5 years ago

If the folder is full of gcov files then you did everything correctly. I am assuming you are using the newest version of the plugin? Do you have any other projects without dependencies where you can reproduce the problem?

rdxernest commented 5 years ago

main.cpp

#include <iostream>

struct foo
{
    std::string bar(int i)
    { return std::to_string(i); }
};

int main()
{
    foo f;
    std::cout << f.bar(42) << std::endl;
    return 0;
}

CMakeList.txt

CMAKE_MINIMUM_REQUIRED(VERSION 3.12)
PROJECT(BufferedOp)

SET(CMAKE_CXX_STANDARD 17)

ADD_EXECUTABLE(BufferedOp main.cpp)
TARGET_COMPILE_OPTIONS(BufferedOp PUBLIC
                       --coverage)
TARGET_LINK_LIBRARIES(BufferedOp
                      gcov
                      )

The result same as above.

mrlukasbos commented 5 years ago

I have this issue as well. I am running CLion 2018.2 with the latest GCoverage (1.1.1) on Ubuntu 18.04

NuckNuck commented 5 years ago

I have this issue as well. I am running CLion 2018.2 with the latest GCoverage (1.1.1) on Ubuntu 18.04

Ditto. Same behavior and same software versions.

kreuzerkrieg commented 5 years ago

Hold on guys, we will get coverage build-in in the nearest (IMHO) CLion release

Latios96 commented 5 years ago

I have the same problem on Mac OS 10.14, Clion 2018.2 and Clang 10.0.0. The GCoverage plugin is looking for .gcda files. But when my program is executed with the GCoverage Plugin, no .gcda files are written. However, when I run the program from Clion the standard way, the .gcda files are created.

stanislaw commented 5 years ago

The same problem for me (macOS 10.13.4, Clion 2018.2) 😢

The plugin seems to be pretty much what we would use.

Looking forward to see what ships with the next CLions, as promised by @kreuzerkrieg.

zero9178 commented 5 years ago

Just pushed an update that should fix this issue. Should take around a day or two till it's approved and pushed

stanislaw commented 5 years ago

Tried the latest version 1.1.2. It now switches to Gathering coverage data... and hangs. Also reported another issue: #2.

My details are the same, just updated CLion: macOS 10.13.4, CLion 2018.3.2.

P.S. I wish I had more time to look into this all myself. Sorry.

Nihlus commented 5 years ago

I'm having the same issue on 1.1.3 - it works in one of my C projects that has a flat folder structure with no subdirectories inside my src dir, but not in my C++ project where the folder structure is more complex.

GCC 9.1.0, CMake 3.14.3, CLion CL-191.7141.37, Linux.

Nihlus commented 5 years ago

Correction: The issue is with GCC 9.1.0. The intermediate coverage format has changed to a JSON format, and that causes breakage. Reverting to GCC 8.3.0 lets me gather coverage data once more.