[ovs-dev] [PATCH ovn 04/16] tests: Improve logging in test framework.
Ben Pfaff
blp at ovn.org
Fri Oct 30 00:24:35 UTC 2020
Signed-off-by: Ben Pfaff <blp at ovn.org>
---
tests/ofproto-macros.at | 5 ++++-
tests/ovn-macros.at | 16 ++++++++++++++--
tests/ovn.at | 10 +++++-----
3 files changed, 23 insertions(+), 8 deletions(-)
diff --git a/tests/ofproto-macros.at b/tests/ofproto-macros.at
index 6c4ff60e7db5..a6e89a951347 100644
--- a/tests/ofproto-macros.at
+++ b/tests/ofproto-macros.at
@@ -54,7 +54,9 @@ m4_define([PARSE_LISTENING_PORT],
[OVS_WAIT_UNTIL([$2=`sed -n 's/.*0:.*: listening on port \([[0-9]]*\)$/\1/p' "$1"` && test X != X"[$]$2"])])
start_daemon () {
- "$@" -vconsole:off --detach --no-chdir --pidfile --log-file
+ set "$@" -vconsole:off --detach --no-chdir --pidfile --log-file
+ echo "$@"
+ "$@"
pidfile="$OVS_RUNDIR"/$1.pid
on_exit "test -e \"$pidfile\" && kill \`cat \"$pidfile\"\`"
}
@@ -99,6 +101,7 @@ sim_add () {
# Start ovs-vswitchd
as $1 start_daemon ovs-vswitchd --enable-dummy=system -vvconn -vofproto_dpif -vunixctl
+ as $1 ovs-appctl vlog/disable-rate-limit vconn
}
# "as $1" sets the OVS_*DIR environment variables to point to $ovs_base/$1.
diff --git a/tests/ovn-macros.at b/tests/ovn-macros.at
index be596caf33d0..5b9c2dee6812 100644
--- a/tests/ovn-macros.at
+++ b/tests/ovn-macros.at
@@ -3,6 +3,8 @@
# Gracefully terminate vswitch daemons in the
# specified sandbox.
m4_define([OVN_CLEANUP_VSWITCH],[
+ echo
+ echo "$1: clean up vswitch"
as $1
OVS_APP_EXIT_AND_WAIT([ovs-vswitchd])
OVS_APP_EXIT_AND_WAIT([ovsdb-server])
@@ -15,6 +17,8 @@ m4_define([OVN_CLEANUP_VSWITCH],[
# as a special case, and is assumed to have ovn-controller-vtep
# and ovs-vtep daemons running instead of ovn-controller.
m4_define([OVN_CLEANUP_SBOX],[
+ echo
+ echo "$1: clean up sandbox"
as $1
if test "$1" = "vtep"; then
OVS_APP_EXIT_AND_WAIT([ovn-controller-vtep])
@@ -33,6 +37,9 @@ m4_define([OVN_CLEANUP],[
m4_foreach([sbox], [$@], [
OVN_CLEANUP_SBOX([sbox])
])
+
+ echo
+ echo "clean up OVN"
as ovn-sb
OVS_APP_EXIT_AND_WAIT([ovsdb-server])
@@ -53,6 +60,8 @@ m4_define([OVN_CLEANUP],[
# Gracefully terminate all OVN daemons, including those in the
# specified sandbox instances.
m4_define([OVN_CLEANUP_AZ],[
+ echo
+ echo "$1: clean up availability zone"
as $1/ovn-sb
OVS_APP_EXIT_AND_WAIT([ovsdb-server])
@@ -77,6 +86,9 @@ m4_define([OVN_CLEANUP_IC],[
m4_foreach([az], [$@], [
OVN_CLEANUP_AZ([az])
])
+
+ echo
+ echo "clean up interconnection"
as ovn-ic-sb
OVS_APP_EXIT_AND_WAIT([ovsdb-server])
@@ -99,7 +111,7 @@ m4_divert_push([PREPARE_TESTS])
#
# Usually invoked from ovn_start.
ovn_init_db () {
- echo "creating $1 database"
+ echo "${AZ:+$AZ: }creating $1 database"
local as_d=$1
if test -n "$2"; then
as_d=$2/$as_d
@@ -108,7 +120,7 @@ ovn_init_db () {
mkdir "$d" || return 1
: > "$d"/.$1.db.~lock~
as $as_d ovsdb-tool create "$d"/$1.db "$abs_top_srcdir"/$1.ovsschema
- as $as_d start_daemon ovsdb-server --remote=punix:"$d"/$1.sock "$d"/$1.db
+ as $as_d start_daemon ovsdb-server -vjsonrpc --remote=punix:"$d"/$1.sock "$d"/$1.db
local var=`echo $1_db | tr a-z- A-Z_`
AS_VAR_SET([$var], [unix:"$d"/$1.sock]); export $var
}
diff --git a/tests/ovn.at b/tests/ovn.at
index 912f84c25dbb..93436de4f027 100644
--- a/tests/ovn.at
+++ b/tests/ovn.at
@@ -12,7 +12,7 @@
m4_divert_text([PREPARE_TESTS],
[ovn_check_packets__ () {
echo
- echo "checking packets in $1 against $2:"
+ echo "$3: checking packets in $1 against $2:"
rcv_pcap=$1
rcv_text=`echo "$rcv_pcap.packets" | sed 's/\.pcap//'`
exp_text=$2
@@ -25,7 +25,7 @@ m4_divert_text([PREPARE_TESTS],
sort $exp_text > expout
}
ovn_check_packets_remove_broadcast__ () {
- echo "checking packets in $1 against $2:"
+ echo "$3: checking packets in $1 against $2:"
rcv_pcap=$1
rcv_text=`echo "$rcv_pcap.packets" | sed 's/\.pcap//'`
exp_text=$2
@@ -41,15 +41,15 @@ m4_divert_text([PREPARE_TESTS],
])
m4_define([OVN_CHECK_PACKETS],
- [ovn_check_packets__ "$1" "$2"
+ [ovn_check_packets__ "$1" "$2" "__file__:__line__"
AT_CHECK([sort $rcv_text], [0], [expout])])
m4_define([OVN_CHECK_PACKETS_REMOVE_BROADCAST],
- [ovn_check_packets_remove_broadcast__ "$1" "$2"
+ [ovn_check_packets_remove_broadcast__ "$1" "$2" "__file__:__line__"
AT_CHECK([sort $rcv_text], [0], [expout])])
m4_define([OVN_CHECK_PACKETS_CONTAIN],
- [ovn_check_packets__ "$1" "$2"
+ [ovn_check_packets__ "$1" "$2" "__file__:__line__"
AT_CHECK([sort $rcv_text | comm --nocheck-order -2 -3 expout -], [0], [])])
AT_BANNER([OVN components])
--
2.26.2
More information about the dev
mailing list