From: Ben Pfaff Date: Tue, 2 Feb 2010 22:16:06 +0000 (-0800) Subject: tests: Always make ovsdb-server exit cleanly, to better find memory leaks. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=028cbd9976590e64a7cfd324e191968dcd710003;p=openvswitch tests: Always make ovsdb-server exit cleanly, to better find memory leaks. "ovs-appctl exit" causes a cleaner shutdown than "kill" and in particular lets ovsdb-server clean up better, which makes it easier to find real memory leaks. --- diff --git a/tests/ovs-vsctl.at b/tests/ovs-vsctl.at index 2abc0773..0d35d17c 100644 --- a/tests/ovs-vsctl.at +++ b/tests/ovs-vsctl.at @@ -9,7 +9,7 @@ m4_define([OVS_VSCTL_SETUP], dnl OVS_VSCTL_CLEANUP dnl dnl Kills off the database server. -m4_define([OVS_VSCTL_CLEANUP], [test ! -e pid || kill `cat pid`]) +m4_define([OVS_VSCTL_CLEANUP], [OVSDB_SERVER_SHUTDOWN]) dnl RUN_OVS_VSCTL(COMMAND, ...) dnl diff --git a/tests/ovsdb-idl.at b/tests/ovsdb-idl.at index 1f55f5eb..dcf3efc4 100644 --- a/tests/ovsdb-idl.at +++ b/tests/ovsdb-idl.at @@ -19,14 +19,14 @@ m4_define([OVSDB_CHECK_IDL], AT_KEYWORDS([ovsdb server idl positive $5]) AT_CHECK([ovsdb-tool create db $abs_srcdir/idltest.ovsschema], [0], [stdout], [ignore]) - AT_CHECK([ovsdb-server '-vPATTERN:console:ovsdb-server|%c|%m' --detach --pidfile=$PWD/server-pid --remote=punix:socket --unixctl=$PWD/unixctl db], [0], [ignore], [ignore]) + AT_CHECK([ovsdb-server '-vPATTERN:console:ovsdb-server|%c|%m' --detach --pidfile=$PWD/pid --remote=punix:socket --unixctl=$PWD/unixctl db], [0], [ignore], [ignore]) m4_if([$2], [], [], - [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore], [kill `cat server-pid`])]) + [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore], [kill `cat pid`])]) AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 idl unix:socket $3], - [0], [stdout], [ignore], [kill `cat server-pid`]) + [0], [stdout], [ignore], [kill `cat pid`]) AT_CHECK([sort stdout | perl $srcdir/uuidfilt.pl], [0], [$4], [], - [kill `cat server-pid`]) - kill `cat server-pid` + [kill `cat pid`]) + OVSDB_SERVER_SHUTDOWN AT_CLEANUP]) OVSDB_CHECK_IDL([simple idl, initially empty, no ops], diff --git a/tests/ovsdb-server.at b/tests/ovsdb-server.at index 0d875242..0b021899 100644 --- a/tests/ovsdb-server.at +++ b/tests/ovsdb-server.at @@ -1,5 +1,10 @@ AT_BANNER([OVSDB -- ovsdb-server transactions (Unix sockets)]) +m4_define([OVSDB_SERVER_SHUTDOWN], + [cp pid savepid + AT_CHECK([ovs-appctl -t $PWD/unixctl -e exit], [0], [ignore], [ignore]) + OVS_WAIT_WHILE([kill -0 `cat savepid`], [kill `cat savepid`])]) + # OVSDB_CHECK_EXECUTION(TITLE, SCHEMA, TRANSACTIONS, OUTPUT, [KEYWORDS]) # # Creates a database with the given SCHEMA, starts an ovsdb-server on @@ -28,7 +33,7 @@ cat stdout >> output ]) AT_CHECK([perl $srcdir/uuidfilt.pl output], [0], [$4], [ignore], [test ! -e pid || kill `cat pid`]) - test ! -e pid || kill `cat pid` + OVSDB_SERVER_SHUTDOWN AT_CLEANUP]) EXECUTION_EXAMPLES @@ -63,7 +68,7 @@ AT_CHECK( ]], [ignore], [test ! -e pid || kill `cat pid`]) -test ! -e pid || kill `cat pid` +OVSDB_SERVER_SHUTDOWN AT_CLEANUP AT_BANNER([OVSDB -- ovsdb-server transactions (SSL sockets)]) @@ -100,7 +105,7 @@ cat stdout >> output ]) AT_CHECK([perl $srcdir/uuidfilt.pl output], [0], [$4], [ignore], [test ! -e pid || kill `cat pid`]) - test ! -e pid || kill `cat pid` + OVSDB_SERVER_SHUTDOWN AT_CLEANUP]) EXECUTION_EXAMPLES