git: 9262b124a26e - stable/14 - tools/test/stress2/misc/all.debug.inc: skip undefined variables

From: Stefan Eßer <se_at_FreeBSD.org>
Date: Tue, 16 Jun 2026 11:00:52 UTC
The branch stable/14 has been updated by se:

URL: https://cgit.FreeBSD.org/src/commit/?id=9262b124a26e1d4881e51da7fcbee5a571d88e49

commit 9262b124a26e1d4881e51da7fcbee5a571d88e49
Author:     Stefan Eßer <se@FreeBSD.org>
AuthorDate: 2026-06-11 11:15:12 +0000
Commit:     Stefan Eßer <se@FreeBSD.org>
CommitDate: 2026-06-16 11:00:32 +0000

    tools/test/stress2/misc/all.debug.inc: skip undefined variables
    
    On my ZFS based systems, no allocations occur with tags "newblk" or
    "freework". This leads to errors executing the tests that check for
    memory leaks. Skip the checks if the output of wmstat -m does not
    contain lines corresponding to those allocations.
    
    MFC after:      3 days
    
    (cherry picked from commit 6e5b990c509777544b790cc8e490965166d04684)
---
 tools/test/stress2/misc/all.debug.inc | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/test/stress2/misc/all.debug.inc b/tools/test/stress2/misc/all.debug.inc
index 4042ca1f7718..419945154791 100644
--- a/tools/test/stress2/misc/all.debug.inc
+++ b/tools/test/stress2/misc/all.debug.inc
@@ -49,13 +49,15 @@ post_debug() {
 		debug_statfs=$debug_new; }
 
 	debug_new=`vmstat -m | grep -w freework | awk '{print $2}'`
-	[ $((debug_new - debug_freework)) -gt 0 -a $debug_new -gt 100 ] &&
+	[ -n "$debug_new" ] &&
+        [ $((debug_new - debug_freework)) -gt 0 -a $debug_new -gt 100 ] &&
 	    { printf "stress2: freework leak: %d/%d.\r\n" \
 	        $((debug_new - debug_freework)) $debug_new > $console
 		debug_freework=$debug_new; }
 
 	debug_new=`vmstat -m | grep -w newblk | awk '{print $2}'`
-	[ $((debug_new - debug_newblk)) -gt 0 -a $debug_new -gt 100 ] &&
+	[ -n "$debug_new" ] &&
+        [ $((debug_new - debug_newblk)) -gt 0 -a $debug_new -gt 100 ] &&
 	    { printf "stress2: newblk leak: %d/%d.\r\n" \
 	        $((debug_new - debug_newblk)) $debug_new > $console
 		debug_newblk=$debug_new; }