summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorSean Kurtz <seankurtz75@gmail.com>2026-11-25 22:18:07 -0600
committerSean Kurtz <seankurtz75@gmail.com>2026-11-25 22:18:07 -0600
commitf561301b7ee805a223ba8eb9cc7081ec9bb5aa80 (patch)
tree8b84a025d4aed21391bcdd2fde65391898f54446
parenta1cf90eb067effe8a7c85f5d2024a0c3d22817e1 (diff)
downloadztop-f561301b7ee805a223ba8eb9cc7081ec9bb5aa80.tar.gz
leakcheck: awk wants -f, and its z/OS build wants no comments
-rw-r--r--Makefile2
-rw-r--r--tests/leak.awk18
2 files changed, 3 insertions, 17 deletions
diff --git a/Makefile b/Makefile
index 2eab22e..675aea4 100644
--- a/Makefile
+++ b/Makefile
@@ -54,7 +54,7 @@ TESTFLAGS = -std=c17 -g -O1 -Wall -Wextra -Wshadow -Wpedantic \
# allocated and never freed. HEAPCHK(ON) additionally walks the heap at
# every call, so a double free or an overlay abends instead of hiding.
LEAKDIR = $(HOME)/tmp/ztop/leak
-LEAKAWK = tests/leak.awk
+LEAKAWK = -f tests/leak.awk
all:
@(uname -s | grep OS/390 > /dev/null) || \
diff --git a/tests/leak.awk b/tests/leak.awk
index f68c05e..f1c6f31 100644
--- a/tests/leak.awk
+++ b/tests/leak.awk
@@ -1,39 +1,25 @@
-# Read the storage report Language Environment writes at termination
-# (RPTSTG(ON)) and fail when the heap was not given back: a get without
-# its free, or a created heap without its discard, is a leak.
-#
-# awk -f tests/leak.awk < storage-report
-
/^(HEAP|HEAP24|ANYHEAP|BELOWHEAP|THREADHEAP|Additional Heap) statistics:/ {
inheap = 1
}
-
/^End of Storage Report/ {
inheap = 0
}
-
inheap && /^Successful Get Heap requests:/ {
get += $NF
}
-
inheap && /^Successful Free Heap requests:/ {
fre += $NF
}
-
inheap && /^Successful Create Heap requests:/ {
cre += $NF
}
-
inheap && /^Successful Discard Heap requests:/ {
dis += $NF
}
-
END {
if (get != fre || cre != dis) {
- printf "LEAK: gets %d frees %d, create %d discard %d\n", get, fre,
- cre, dis
+ printf "LEAK: gets %d frees %d, create %d discard %d\n", get, fre, cre, dis
exit 1
}
- printf "heap gets %d frees %d, create %d discard %d\n", get, fre, cre,
- dis
+ printf "heap gets %d frees %d, create %d discard %d\n", get, fre, cre, dis
}