From patchwork Fri Oct 30 00:24:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Pfaff X-Patchwork-Id: 1390527 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.137; helo=fraxinus.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ovn.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CMjkV5MY2z9sSf for ; Fri, 30 Oct 2020 11:25:06 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 4C41E86B5B; Fri, 30 Oct 2020 00:25:05 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id R98p_dLNXc7U; Fri, 30 Oct 2020 00:25:04 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by fraxinus.osuosl.org (Postfix) with ESMTP id 852CA86A6C; Fri, 30 Oct 2020 00:25:04 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 6C875C0859; Fri, 30 Oct 2020 00:25:04 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id BA321C0051 for ; Fri, 30 Oct 2020 00:25:02 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id A469D867D1 for ; Fri, 30 Oct 2020 00:25:02 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3Jy6ETwywlPi for ; Fri, 30 Oct 2020 00:25:01 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) by whitealder.osuosl.org (Postfix) with ESMTPS id 312C686685 for ; Fri, 30 Oct 2020 00:25:01 +0000 (UTC) X-Originating-IP: 75.54.222.30 Received: from sigfpe.attlocal.net (75-54-222-30.lightspeed.rdcyca.sbcglobal.net [75.54.222.30]) (Authenticated sender: blp@ovn.org) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id E4CC940008; Fri, 30 Oct 2020 00:24:58 +0000 (UTC) From: Ben Pfaff To: dev@openvswitch.org Date: Thu, 29 Oct 2020 17:24:35 -0700 Message-Id: <20201030002447.936548-4-blp@ovn.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201030002447.936548-1-blp@ovn.org> References: <20201030002447.936548-1-blp@ovn.org> MIME-Version: 1.0 Cc: Ben Pfaff Subject: [ovs-dev] [PATCH ovn 04/16] tests: Improve logging in test framework. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Signed-off-by: Ben Pfaff --- 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])