aboutsummaryrefslogtreecommitdiff
path: root/test/html/leakfilter.awk
diff options
context:
space:
mode:
authorRodrigo Arias Mallo <rodarima@gmail.com>2025-08-25 00:12:16 +0200
committerRodrigo Arias Mallo <rodarima@gmail.com>2025-08-25 00:12:16 +0200
commit6bbab7570134379aca32722350da6690f999d6cc (patch)
tree676aba335a94415568732e48d064038a4022b412 /test/html/leakfilter.awk
parente962fd66595e363576c860ba5e4c7b90a9fa019a (diff)
Detect leaks in test suite with Asan
Leaks from libfontconfig.so are excluded for now, as it doesn't seem to be our fault. The gcc mechanism to suppress leaks doesn't seem to be working, so we fallback to awk. In the presence of leaks, that specific test will fail by returning non-zero, but this will not be what we want for those tests that are currently failing with XPASS. We will only consider the ones that are passing as those targeted for leak detection.
Diffstat (limited to 'test/html/leakfilter.awk')
-rw-r--r--test/html/leakfilter.awk14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/html/leakfilter.awk b/test/html/leakfilter.awk
new file mode 100644
index 00000000..381ed0a7
--- /dev/null
+++ b/test/html/leakfilter.awk
@@ -0,0 +1,14 @@
+# Detect beginning of leak message
+/^Direct leak/ { msg=msg "\n" $0; inleak=1; next }
+
+# Ignore anything coming from libfontconfig.so
+inleak && /libfontconfig.so/ { inleak=0; msg="" }
+
+# Store leak line
+inleak && /^ +#/ { msg=msg "\n" $0; next }
+
+# End of the leak lines, print and finish
+inleak { inleak=0; print msg; msg=""; nleaks++ }
+
+# At exit count filtered leaks and fail accordingly
+END { printf "\n==== Total leaks after filter: %d ====\n\n", nleaks; if (nleaks > 0) { exit 1 } }