]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
ci: rustc wrapper to disable coverage for external crates
authorPhilippe Antoine <pantoine@oisf.net>
Tue, 15 Apr 2025 14:40:44 +0000 (16:40 +0200)
committerVictor Julien <victor@inliniac.net>
Sat, 19 Apr 2025 16:20:01 +0000 (18:20 +0200)
To keep the disk usage good even when we use new crates

.github/workflows/builds.yml
scripts/rustc.py [new file with mode: 0755]

index 9c60be8d20c5b889edb58417303f057e87078c75..f40d2f34cef701e1d03c9a775bd0e4d6a4ccdf2e 100644 (file)
@@ -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 (executable)
index 0000000..8cf8f15
--- /dev/null
@@ -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)