From 7d806dc7b74ae8dc99db2c6c4368ea84fe179f7f Mon Sep 17 00:00:00 2001 From: Philippe Antoine Date: Tue, 15 Apr 2025 16:40:44 +0200 Subject: [PATCH] ci: rustc wrapper to disable coverage for external crates To keep the disk usage good even when we use new crates --- .github/workflows/builds.yml | 8 ++++---- scripts/rustc.py | 14 ++++++++++++++ 2 files changed, 18 insertions(+), 4 deletions(-) create mode 100755 scripts/rustc.py diff --git a/.github/workflows/builds.yml b/.github/workflows/builds.yml index 9c60be8d20..f40d2f34ce 100644 --- a/.github/workflows/builds.yml +++ b/.github/workflows/builds.yml @@ -645,15 +645,15 @@ jobs: path: prep - run: tar xf prep/suricata-update.tar.gz - run: ./autogen.sh - - run: ./configure --enable-warnings --disable-shared + - run: RUSTC_WRAPPER="$(pwd)/scripts/rustc.py" ./configure --enable-warnings --disable-shared env: CC: "clang" - RUSTFLAGS: "-C instrument-coverage" + RUSTFLAGS: "-Cinstrument-coverage" CFLAGS: "-fprofile-instr-generate -fcoverage-mapping -O0" - - run: make -j ${{ env.CPUS }} + - run: RUSTC_WRAPPER="$(pwd)/scripts/rustc.py" make -j ${{ env.CPUS }} env: CC: "clang" - RUSTFLAGS: "-C instrument-coverage" + RUSTFLAGS: "-Cinstrument-coverage" CFLAGS: "-fprofile-instr-generate -fcoverage-mapping -O0" - name: Extracting suricata-verify run: tar xf prep/suricata-verify.tar.gz diff --git a/scripts/rustc.py b/scripts/rustc.py new file mode 100755 index 0000000000..8cf8f1531c --- /dev/null +++ b/scripts/rustc.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python3 + +import sys +import subprocess + +# RUSTC_WRAPPER to disable coverage for external crates +# and so save disk space when running suricata-verify with many profraw files +if len(sys.argv) > 4 and sys.argv[2] == '--crate-name' and not sys.argv[3].startswith("suricata"): + try: + sys.argv.remove("-Cinstrument-coverage") + except: + pass +result = subprocess.run(sys.argv[1:]) +sys.exit(result.returncode)