From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on gnuweeb.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NO_DNS_FOR_FROM,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 Received: from localhost.localdomain (unknown [182.2.70.226]) by gnuweeb.org (Postfix) with ESMTPSA id BC97180C38; Fri, 2 Sep 2022 07:15:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1662102961; bh=fB/SGSBw+8SZhNANAbgH+HD11RWuT2SAsbQ2ZNOIGLY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cSbLiMsWBY5yKtSLcrjP2QWCPHCuaD03SbnWVZGJEDYJNpSaBz85v7U4Wytjul2bA BWj1CBt6hfBHbM3F4ATQh2svj69MkOSMmXE/FxJz2IITHkRCNkOXdKA2h6fL86pQz2 MW8ArP7BpMdVTCC1+g8eLpRctoaetDKqNcocYWkKfSZTXNfadnNsoJR52FSlq5+ptL goCbOqt2AYOgTTepoSOlFggeR9R6mRr0Yu4UX+Lfs/vHLioeJJt1qAui+PgOVg0dWf 8yAwAMvT1gfhyjv7S9Myi1qzd3J2pSh0F881YfWxUfnmUrJCq3e5O/ifbIR4uaJQ58 OrRAwrjY+D4zw== From: Ammar Faizi To: Jens Axboe Cc: Ammar Faizi , Dylan Yudaken , Facebook Kernel Team , Pavel Begunkov , io-uring Mailing List , GNU/Weeb Mailing List , Kanna Scarlet , Muhammad Rizki , Alviro Iskandar Setiawan Subject: [PATCH liburing v2 08/12] t/connect: Don't use a static port number Date: Fri, 2 Sep 2022 14:15:01 +0700 Message-Id: <20220902071153.3168814-9-ammar.faizi@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220902071153.3168814-1-ammar.faizi@intel.com> References: <20220902071153.3168814-1-ammar.faizi@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: From: Ammar Faizi Don't use a static port number. It might already be in use, resulting in a test failure. Use an ephemeral port to make this test reliable. Cc: Dylan Yudaken Cc: Facebook Kernel Team Cc: Pavel Begunkov Reviewed-by: Alviro Iskandar Setiawan Tested-by: Alviro Iskandar Setiawan Signed-off-by: Ammar Faizi --- test/accept.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/test/accept.c b/test/accept.c index b35ded4..1821faa 100644 --- a/test/accept.c +++ b/test/accept.c @@ -190,19 +190,16 @@ static int start_accept_listen(struct sockaddr_in *addr, int port_off, struct sockaddr_in laddr; if (!addr) addr = &laddr; addr->sin_family = AF_INET; - addr->sin_port = htons(0x1235 + port_off); addr->sin_addr.s_addr = inet_addr("127.0.0.1"); - - ret = bind(fd, (struct sockaddr*)addr, sizeof(*addr)); - assert(ret != -1); + assert(!t_bind_ephemeral_port(fd, addr)); ret = listen(fd, 128); assert(ret != -1); return fd; } static int set_client_fd(struct sockaddr_in *addr) -- Ammar Faizi