Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/net tests: check pool object leaks



details:   https://anonhg.NetBSD.org/src/rev/65c22ac8dbf6
branches:  trunk
changeset: 453587:65c22ac8dbf6
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Mon Aug 19 03:22:47 2019 +0000

description:
tests: check pool object leaks

Currently only llentpl leaks can be detected.

diffstat:

 tests/net/net_common.sh |  29 ++++++++++++++++++++++++++++-
 1 files changed, 28 insertions(+), 1 deletions(-)

diffs (61 lines):

diff -r 16ceb8a7f36f -r 65c22ac8dbf6 tests/net/net_common.sh
--- a/tests/net/net_common.sh   Mon Aug 19 03:22:05 2019 +0000
+++ b/tests/net/net_common.sh   Mon Aug 19 03:22:47 2019 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: net_common.sh,v 1.33 2019/08/19 03:21:13 ozaki-r Exp $
+#      $NetBSD: net_common.sh,v 1.34 2019/08/19 03:22:47 ozaki-r Exp $
 #
 # Copyright (c) 2016 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -337,10 +337,31 @@
        return 0
 }
 
+rump_server_check_poolleaks()
+{
+       local target=$1
+
+       reqs=$($HIJACKING vmstat -mv | awk "/$target/ {print \$3;}")
+       rels=$($HIJACKING vmstat -mv | awk "/$target/ {print \$5;}")
+       atf_check_equal '$target$reqs' '$target$rels'
+}
+
+
+rump_server_check_memleaks()
+{
+
+       rump_server_check_poolleaks llentrypl
+       # This doesn't work for objects allocated through pool_cache
+       #rump_server_check_poolleaks mbpl
+       #rump_server_check_poolleaks mclpl
+       #rump_server_check_poolleaks socket
+}
+
 rump_server_destroy_ifaces()
 {
        local backup=$RUMP_SERVER
        local output=ignore
+       local reqs= rels=
 
        $DEBUG && cat $_rump_server_ifaces
 
@@ -372,6 +393,11 @@
        done < __ifaces
        rm -f __ifaces
 
+       for sock in $(cat $_rump_server_socks); do
+               export RUMP_SERVER=$sock
+               rump_server_check_memleaks
+       done
+
        export RUMP_SERVER=$backup
 
        return 0
@@ -410,6 +436,7 @@
        rump.netstat -nr
        # XXX still need hijacking
        $HIJACKING rump.netstat -nai
+       $HIJACKING vmstat -m
        rump.arp -na
        rump.ndp -na
        $HIJACKING ifmcstat



Home | Main Index | Thread Index | Old Index