From patchwork Tue Apr 11 20:42:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Baerts X-Patchwork-Id: 82188 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2849443vqo; Tue, 11 Apr 2023 13:57:31 -0700 (PDT) X-Google-Smtp-Source: AKy350ZMEEyOeP+A+uaQn8FKFnhw6L6wFIByoSnv/XEamkTk5I6k6nGYAm/VTtv4VDp4CjczBLVL X-Received: by 2002:a17:906:7312:b0:93d:ae74:fa9e with SMTP id di18-20020a170906731200b0093dae74fa9emr14431131ejc.7.1681246651651; Tue, 11 Apr 2023 13:57:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681246651; cv=none; d=google.com; s=arc-20160816; b=jDW3K2rUAmokD7HrSqar5XkSKd9+cWZ+pgyM3t62d+LbQMkm9MjKt9kpDcnBaD7icX Bh4D5hMyrIC8sGP5eLDYgiwF3VtxTui5nmpMV1fKKTYl1kBKd7aTOEGdwrQiPDx8AvJW O7AMW6ZemiJVWAPYqO2f2gSUFl36qDrTuX9S9QqI21bEkpfHhYn8u6ggZx8OhVU63cO2 168NSTkP8sYSxhWlOUfHObe2yuRoWdxz3ygW0u1SgnNAMNT7zZeLpO7pxh1Gt8lu5/2D 5eQiIM3pP9uPX91nOEL1rWvYM1xp1B2XAvivJtE9n815+NtMIT6YNQSVHZ0IyP1a/uBS xCjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=2Qg0UfDgtzM4SSag2U8RERLst0NUUqYRmB2P1uH49t4=; b=Qjo6X6jqEpCQo7ByST36t7gIEgq2ZXv9OG3fXi1AcMYrX7XWy505THETOUVb6k1i5W 6TIbXgQXbV41fQ1b6m2tUnWcj3CnH7bQTo3RoTI+BQTkzJsNyLHW1vr78JsshisZ+zt3 7fY5RrfTgX/VfZuOBMEbE0TYOcpR2OVKNfiWVz8TzRfGB4F/sx5GJfz4wmIJQH72VkFk ntHEg0u+G1J+RamdlAYGJsAXOIJgXbnKahCo3xRHZnfeUlXyvZGNMHjVjTh39W4YJlQo PmG7C9L6eGvtTXHOQYBzVjUmPgZRHEhC4raGpzuO2RDgLc/tagBnGEreu04czjUqKsbG E49g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tessares.net header.s=google header.b=IGWcpTfj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=tessares.net Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sy23-20020a1709076f1700b0094a82b2fb70si587909ejc.567.2023.04.11.13.56.40; Tue, 11 Apr 2023 13:57:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@tessares.net header.s=google header.b=IGWcpTfj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=tessares.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229963AbjDKUm5 (ORCPT + 99 others); Tue, 11 Apr 2023 16:42:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229969AbjDKUmj (ORCPT ); Tue, 11 Apr 2023 16:42:39 -0400 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1425C4C2E for ; Tue, 11 Apr 2023 13:42:29 -0700 (PDT) Received: by mail-wm1-x334.google.com with SMTP id d8-20020a05600c3ac800b003ee6e324b19so5006643wms.1 for ; Tue, 11 Apr 2023 13:42:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tessares.net; s=google; t=1681245747; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=2Qg0UfDgtzM4SSag2U8RERLst0NUUqYRmB2P1uH49t4=; b=IGWcpTfjatCz3Eqo5P30S165MgQ8L4VYNgUdGlU7f47eKTaqEl/N0R2Bxijvo4pFg9 uanbjdbEphIkQDQQEZvaB8ooRWJVv+h7h963uEFJa7dXYDHWqUkAkmm6bTqrjLsz277H UfMjUqNzcQZXhCGgsQ+UXxRYJqbcxdztwMq4/Kb7HKNGlv5gphgCTsS1rVR+qx7kEFxk 4jo+TQgpaCUpe07hKrVaVHQwTUPQyulQDEQVgAPyCj9SbQ6jucUN9bCwfQby51IPFwAY ZBAqhQ/EKWaGtG/XvskTPwGou2g8oRoiWi9RLipLyDVoSETAxYgTDlezEF5ORVgAIoJ5 bLkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681245747; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2Qg0UfDgtzM4SSag2U8RERLst0NUUqYRmB2P1uH49t4=; b=PWmrRkFfMhczLi42KR8DIT6kHxEbdntNIOLrRP0+6rvdy0RVfEFVP4rZwPRXqUu96w BAp1e/E3giu9NQyxij65CUiTg3wrEP9InO6rnmizxvSsy/iaDtM11rUMKcqSVBH19k5R Qu8wCmEyZD8dMZ7geo7eNFuGZMvGcWCtlfy2YvdFHNkTsb9x79tQ0hyGfUzD/J8yscvy FOHon/qRhU62fH1stDyfffyNLAFDYO8hgOLkeBc9fBgxnToj+d97p61z2hoKQkVNHN1B qBix2fHx89uW/MywQ0UZ/6RDI7H/Bg1LZRVVcOP08vC10OANsiGzz33oNYlpVHQ+9JNV G2bg== X-Gm-Message-State: AAQBX9dkO6RxxR5jBElLAhQ6h0J9esjvmuc5dBsv8Y+0vonx9Xgd5qsp v8/x+PArRC9aFcH8h6kvVqm5pw== X-Received: by 2002:a7b:cb51:0:b0:3eb:38e6:f650 with SMTP id v17-20020a7bcb51000000b003eb38e6f650mr9930062wmj.41.1681245747534; Tue, 11 Apr 2023 13:42:27 -0700 (PDT) Received: from vdi08.nix.tessares.net (static.219.156.76.144.clients.your-server.de. [144.76.156.219]) by smtp.gmail.com with ESMTPSA id p23-20020a1c7417000000b003f0824e8c92sm86887wmc.7.2023.04.11.13.42.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Apr 2023 13:42:27 -0700 (PDT) From: Matthieu Baerts Date: Tue, 11 Apr 2023 22:42:12 +0200 Subject: [PATCH net 4/4] selftests: mptcp: userspace pm: uniform verify events MIME-Version: 1.0 Message-Id: <20230411-upstream-net-20230411-mptcp-fixes-v1-4-ca540f3ef986@tessares.net> References: <20230411-upstream-net-20230411-mptcp-fixes-v1-0-ca540f3ef986@tessares.net> In-Reply-To: <20230411-upstream-net-20230411-mptcp-fixes-v1-0-ca540f3ef986@tessares.net> To: mptcp@lists.linux.dev, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Davide Caratti , Dmytro Shytyi , Shuah Khan , Mat Martineau , Geliang Tang Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Matthieu Baerts , stable@vger.kernel.org X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1921; i=matthieu.baerts@tessares.net; h=from:subject:message-id; bh=1MrCCJJ5GEMq7hx3eoZhKgDEbgVWmBJ0bqSM6h+3CbQ=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBkNcYubzn7jx0MUsvw+rle5p4XlZD7yypcKbS9P oImjRChXFKJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZDXGLgAKCRD2t4JPQmmg c0o6EAChDN8Dhftr1GID9h82qJ9Na9va86JfYFDLY2V766qElhR28T/K7pa+W3+oDlE92GSkmV5 aHUjNUjxBY4iXgRL4LSfUXTF7A1J+lGDCevgl32h+RzgO/G49ZehMU8zw7g+yHDKFNd3GtBDtpC R+LBTS015DkEdUwdzPvOebCKu8Wd6CUINI8GlN3G3Cf37UzMmRFEAaDsjszwx5cCC946OXjpLOW dEsD8yWQUc1g0zTKTYYtc+HGkLoAyYYNpyJWIf6JMubGo4Jwjjx51CNtIH6OXywmy7Pfk8Eheai UCYP7amDN0J930qgXB/SgTqj3x0xZPWu/QDgoMFQTck7lAPjwPTxp2979RJ14OopFnrY9HcI1wb rxqTrDLiIqk9j96BoFSn7KediHPoJANBsCGIxhGxRbsTi21fCINZVWV0IK5538i4G2yanRSUZmC kyOv6gRNIQLz1qvdpbVrUZkwk//osw5vnhQqY304o/hf3qAJcxr2zGWJM++ja6J1LXHNW1dFqU0 tdqxoTDaBSwQbdYJ2Hh6qakprbN1mA9OJAUB6ohe4Rpc2qpGGuxqj6yzdigrmhhGp9PVk1GRvvK MruZNp6pcMVP+TPt00b5CD+VdeE3l3UsoEOS8+FVdUSLIPFdN1BH0X2dJ/WDooyMNqIGBa2XEIa H9xLIt5le1z8XlA== X-Developer-Key: i=matthieu.baerts@tessares.net; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762914889110979262?= X-GMAIL-MSGID: =?utf-8?q?1762914889110979262?= Simply adding a "sleep" before checking something is usually not a good idea because the time that has been picked can not be enough or too much. The best is to wait for events with a timeout. In this selftest, 'sleep 0.5' is used more than 40 times. It is always used before calling a 'verify_*' function except for this verify_listener_events which has been added later. At the end, using all these 'sleep 0.5' seems to work: the slow CIs don't complain so far. Also because it doesn't take too much time, we can just add two more 'sleep 0.5' to uniform what is done before calling a 'verify_*' function. For the same reasons, we can also delay a bigger refactoring to replace all these 'sleep 0.5' by functions waiting for events instead of waiting for a fix time and hope for the best. Fixes: 6c73008aa301 ("selftests: mptcp: listener test for userspace PM") Cc: stable@vger.kernel.org Suggested-by: Paolo Abeni Signed-off-by: Matthieu Baerts --- tools/testing/selftests/net/mptcp/userspace_pm.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/testing/selftests/net/mptcp/userspace_pm.sh b/tools/testing/selftests/net/mptcp/userspace_pm.sh index 48e52f995a98..b1eb7bce599d 100755 --- a/tools/testing/selftests/net/mptcp/userspace_pm.sh +++ b/tools/testing/selftests/net/mptcp/userspace_pm.sh @@ -913,6 +913,7 @@ test_listener() $client4_port > /dev/null 2>&1 & local listener_pid=$! + sleep 0.5 verify_listener_events $client_evts $LISTENER_CREATED $AF_INET 10.0.2.2 $client4_port # ADD_ADDR from client to server machine reusing the subflow port @@ -928,6 +929,7 @@ test_listener() # Delete the listener from the client ns, if one was created kill_wait $listener_pid + sleep 0.5 verify_listener_events $client_evts $LISTENER_CLOSED $AF_INET 10.0.2.2 $client4_port }