From: Philippe Antoine Date: Tue, 15 Apr 2025 14:40:44 +0000 (+0200) Subject: ci: rustc wrapper to disable coverage for external crates X-Git-Tag: suricata-8.0.0-rc1~449 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7d806dc7b74ae8dc99db2c6c4368ea84fe179f7f;p=thirdparty%2Fsuricata.git ci: rustc wrapper to disable coverage for external crates To keep the disk usage good even when we use new crates --- 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)