From patchwork Thu Apr 20 16:14:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xavier Simonart X-Patchwork-Id: 1771525 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::136; helo=smtp3.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=TD7OkhNw; dkim-atps=neutral Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q2N6K0jFpz1ybF for ; Fri, 21 Apr 2023 02:15:05 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 3F3626FE85; Thu, 20 Apr 2023 16:15:03 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 3F3626FE85 Authentication-Results: smtp3.osuosl.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=TD7OkhNw X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id xDiAzy_R9Z1b; Thu, 20 Apr 2023 16:15:01 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp3.osuosl.org (Postfix) with ESMTPS id E722560FDB; Thu, 20 Apr 2023 16:15:00 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org E722560FDB Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id BAD15C0037; Thu, 20 Apr 2023 16:15:00 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 36EFDC002A for ; Thu, 20 Apr 2023 16:15:00 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 051CC405CD for ; Thu, 20 Apr 2023 16:15:00 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 051CC405CD Authentication-Results: smtp2.osuosl.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=TD7OkhNw X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id GUaAw1542rkv for ; Thu, 20 Apr 2023 16:14:59 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 5000B40158 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by smtp2.osuosl.org (Postfix) with ESMTPS id 5000B40158 for ; Thu, 20 Apr 2023 16:14:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682007297; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4cCoXqKH3AH5rQIvw8HfMfkwx2/yZjPfNCsdHnxHYpU=; b=TD7OkhNw3fUGQjONdonbGu1LnDdXlosmhajs3y656Wcv3eU3OGFjzPtHa7Qqmjuzb27vrE Zg00pQ1YWWgVynjybohCHaJJxIoxVI9/4Nn3GItEPH/qMBBjkZjaA/jW/yxCNiWNLOa14H D4uEPOYbq7gEWwdwo0uAISPAosrNSNw= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-554-8zLdd74qPDWBVdOLVisz5g-1; Thu, 20 Apr 2023 12:14:56 -0400 X-MC-Unique: 8zLdd74qPDWBVdOLVisz5g-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4770687B2A2 for ; Thu, 20 Apr 2023 16:14:56 +0000 (UTC) Received: from wsfd-netdev90.ntdv.lab.eng.bos.redhat.com (wsfd-netdev90.ntdv.lab.eng.bos.redhat.com [10.19.188.196]) by smtp.corp.redhat.com (Postfix) with ESMTP id 304942026DFD; Thu, 20 Apr 2023 16:14:56 +0000 (UTC) From: Xavier Simonart To: xsimonar@redhat.com, dev@openvswitch.org Date: Thu, 20 Apr 2023 18:14:55 +0200 Message-Id: <20230420161455.134493-3-xsimonar@redhat.com> In-Reply-To: <20230420161455.134493-1-xsimonar@redhat.com> References: <20230420161455.134493-1-xsimonar@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH ovn 3/3] tests: check arguments count of OVS_WAIT_UNTIL 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" The macro has been used erroneously with the expectation to take the third parameter as the expected output. Fail if more than 2 arguments are used. Also fail if the second argument is an integer (second arg expected to be a command to execute in case of failure). Same checks are used in ovs. Signed-off-by: Xavier Simonart Acked-by: Ales Musil --- tests/ovs-macros.at | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/ovs-macros.at b/tests/ovs-macros.at index 36b58b5ae..cc5f6e3b1 100644 --- a/tests/ovs-macros.at +++ b/tests/ovs-macros.at @@ -256,6 +256,13 @@ ovs_wait () { ovs_wait_failed AT_FAIL_IF([:]) } + +check_ovs_wait_until_args() { + AT_FAIL_IF([test $1 -ge 3]) + dnl The second argument should not be a number (confused with AT_CHECK ?). + AT_FAIL_IF([test $1 -eq 2 && test "$2" -eq "$2" 2>/dev/null]) +} + OVS_END_SHELL_HELPERS m4_define([OVS_WAIT], [dnl ovs_wait_cond () { @@ -276,7 +283,8 @@ dnl zero code within reasonable time limit, then dnl the test fails. In that case, runs IF-FAILED dnl before aborting. m4_define([OVS_WAIT_UNTIL], - [OVS_WAIT([$1], [$2], [AT_LINE], [until $1])]) + [check_ovs_wait_until_args "$#" "$2" + OVS_WAIT([$1], [$2], [AT_LINE], [until $1])]) dnl OVS_WAIT_FOR_OUTPUT(COMMAND, EXIT-STATUS, STDOUT, STDERR) dnl OVS_WAIT_FOR_OUTPUT_UNQUOTED(COMMAND, EXIT-STATUS, STDOUT, STDERR)