Project

General

Profile

Actions

Task #4278

closed

ci: coverage support for rust

Added by Victor Julien about 3 years ago. Updated over 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
Effort:
Difficulty:
Label:

Description

Currently the codecov support works for C code only.

Getting code coverage for the Rust to work is complex.

Actions #1

Updated by Victor Julien about 3 years ago

https://doc.rust-lang.org/beta/unstable-book/compiler-flags/source-based-code-coverage.html
https://github.com/mozilla/grcov

There are 2 ways to instrument Rust code:
  • gcc compatible gcov support
  • llvm native mode

I can't get the gcov support to work. When its compiled in (using -Zprofile) Suricata SEGVs on the simplest commands (like suricata -V). Maybe this is due to different llvm versions in use. I compiled with clang-10 while using rustc nightly which probably uses llvm 11 or a higher version.

With the native llvm instrumentation things compile, and a default.profraw is generated, but extracting actual coverage info from that has failed until now. The tools require an instrumented binary, where it rejects both the suricata binary as well as the libsuricata.a. Possibly this is another case where using different llvm versions is an issue.

So I think the next step should be to try if compiling both the C and Rust code with the same llvm backend makes things better.

Actions #2

Updated by Philippe Antoine about 3 years ago

Actions #3

Updated by Victor Julien over 1 year ago

Rust coverage support is now 'stable' since versions using llvm 13, so we should in theory be able to get it to work more easily. On Ubuntu rust 1.59 uses llvm 13, so it would be paired with clang 13 I think.

Actions #4

Updated by Victor Julien over 1 year ago

  • Status changed from New to In Review
  • Assignee set to Victor Julien
Actions #6

Updated by Victor Julien over 1 year ago

  • Status changed from In Review to Closed
Actions

Also available in: Atom PDF