From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8730AECAAA1 for ; Fri, 2 Sep 2022 07:16:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234970AbiIBHQE (ORCPT ); Fri, 2 Sep 2022 03:16:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233931AbiIBHQD (ORCPT ); Fri, 2 Sep 2022 03:16:03 -0400 Received: from gnuweeb.org (gnuweeb.org [51.81.211.47]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C189250725 for ; Fri, 2 Sep 2022 00:16:01 -0700 (PDT) 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) X-GW-Data: lPqxHiMPbJw1wb7CM9QUryAGzr0yq5atzVDdxTR0iA== 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 Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org 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