From patchwork Mon Oct 2 17:34:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Edward Liaw X-Patchwork-Id: 1842247 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20230601 header.b=xvtyiPkk; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=patchwork.ozlabs.org) Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Rzp471TPdz20Zd for ; Tue, 3 Oct 2023 04:34:47 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id A2FDA3CE06A for ; Mon, 2 Oct 2023 19:34:44 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-2.smtp.seeweb.it (in-2.smtp.seeweb.it [217.194.8.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id E5E023CDEC1 for ; Mon, 2 Oct 2023 19:34:33 +0200 (CEST) Received: from mail-pg1-x54a.google.com (mail-pg1-x54a.google.com [IPv6:2607:f8b0:4864:20::54a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-2.smtp.seeweb.it (Postfix) with ESMTPS id 54581600A42 for ; Mon, 2 Oct 2023 19:34:33 +0200 (CEST) Received: by mail-pg1-x54a.google.com with SMTP id 41be03b00d2f7-56c2d67da6aso14793590a12.2 for ; Mon, 02 Oct 2023 10:34:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1696268072; x=1696872872; darn=lists.linux.it; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=zuPmbm9QxeLn0RTntL5g5QP6LHXkR4gDzTHhkxw3CFw=; b=xvtyiPkkXbAjHB930r8OsRkDZzTTonRomDWeT/ZT+pF6UHAkohSncNAxvUSfqSkcVh BMuyQuN/zhQMdu5UAvpDp+jKELD1bGrnl5oxN6NjKUjzhwEzvIaUjmCeFBv5v7cnH+iF e/67cNWM7YfDTuhU7bP5UH3lKI+kbe31e8BoQ5zv07jTyyZs0fTWNyrbksvMuRo/AIZn ZdETgYTRQ0C8+iG1Eq7AF37voieB97nwsci91aNuGfZseDUlFcFBFO/YLMZUbTd4k15f 5r77r+mhP/v61fg3Z+7jspyIDwj/rXRvIAh6MeqEy0ZR0H9ykCirq1c+Jz/DRFH7VEdF vXDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696268072; x=1696872872; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=zuPmbm9QxeLn0RTntL5g5QP6LHXkR4gDzTHhkxw3CFw=; b=m7LTfB680cz+iAYQOjIYoLr2NtgrkpUnGW71v7PU2EuhpSAFCbyAmPo3cbAuMWvBQt dtFZ2ISm+KLX5Ijo3qoJWrj9Dlq3Z28qIUyGFxYG9bGLxVZDPHNbr9ZiArOE2ClgFTcq zXquv5HxsTkszvRIDiPt3c/sYkFulV23A4dNq5qNRGMgrW5XqmU7NFnBjOGgpYluwTDD BkFFYfhC46zTyZsLeikARRY7D0SUiav9Rz3vo8OgjNqfbJk8T7Wh1zgNNV5u/rfLRDl8 gptQNI4/PilzAJokZ4nopvi+hbspEncaHBoleRbGtOAyjPOjZQ4Li5OtfpU7kg8qpMcd Cgnw== X-Gm-Message-State: AOJu0YzAh3jmRI0eLIhEmPl1A7tnFDFsj242WZpiByTvovvGVKpNq8jX uOQHPg+6UxSMKl2roRQaoFUvlo/qvV05CouqoitVVBqYG3FOMEpIyVolhKKCviv24xTu4rRvpOX BWT4Ng3Pq2XacrbzudApG3rLLjJ+eBMNPqZUQlOpAp63peBeAayOYBjPp X-Google-Smtp-Source: AGHT+IE/DMN12U1BQRa4QqRpxNmKb7HPU8czwK4OW5uYPxVeglkccbVdufiHdp0njGAz9BodrZZ8BZL83I0= X-Received: from edliaw.c.googlers.com ([fda3:e722:ac3:cc00:24:72f4:c0a8:305d]) (user=edliaw job=sendgmr) by 2002:a63:6dc8:0:b0:564:e80e:81c0 with SMTP id i191-20020a636dc8000000b00564e80e81c0mr185437pgc.2.1696268071412; Mon, 02 Oct 2023 10:34:31 -0700 (PDT) Date: Mon, 2 Oct 2023 17:34:15 +0000 In-Reply-To: <20231002173416.1080347-1-edliaw@google.com> Mime-Version: 1.0 References: <20231002173416.1080347-1-edliaw@google.com> X-Mailer: git-send-email 2.42.0.582.g8ccd20d70d-goog Message-ID: <20231002173416.1080347-2-edliaw@google.com> To: ltp@lists.linux.it X-Virus-Scanned: clamav-milter 1.0.1 at in-2.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=-7.4 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL shortcircuit=no autolearn=disabled version=4.0.0 X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on in-2.smtp.seeweb.it Subject: [LTP] [PATCH v2 1/2] pipe07: close /proc/self/fd after counting fds X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Edward Liaw via ltp From: Edward Liaw Reply-To: Edward Liaw Cc: kernel-team@android.com Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Leaving the directory fd open will count against the max number of fds opened, so the final expected count will be off when (max_fds - record_open_fds()) is even. Signed-off-by: Edward Liaw --- testcases/kernel/syscalls/pipe/pipe07.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/testcases/kernel/syscalls/pipe/pipe07.c b/testcases/kernel/syscalls/pipe/pipe07.c index 196485684..d9b23044d 100644 --- a/testcases/kernel/syscalls/pipe/pipe07.c +++ b/testcases/kernel/syscalls/pipe/pipe07.c @@ -45,6 +45,8 @@ static int record_open_fds(void) opened_fds[num_opened_fds++] = fd; } + SAFE_CLOSEDIR(dir); + return num_opened_fds; } From patchwork Mon Oct 2 17:34:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Edward Liaw X-Patchwork-Id: 1842249 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20230601 header.b=dU09ZyE9; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=patchwork.ozlabs.org) Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Rzp4L2cK3z20Zd for ; Tue, 3 Oct 2023 04:34:58 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 4F6F33CDE5B for ; Mon, 2 Oct 2023 19:34:55 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-6.smtp.seeweb.it (in-6.smtp.seeweb.it [IPv6:2001:4b78:1:20::6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 8256E3CE06F for ; Mon, 2 Oct 2023 19:34:36 +0200 (CEST) Received: from mail-pg1-x549.google.com (mail-pg1-x549.google.com [IPv6:2607:f8b0:4864:20::549]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-6.smtp.seeweb.it (Postfix) with ESMTPS id D11FE1400995 for ; Mon, 2 Oct 2023 19:34:35 +0200 (CEST) Received: by mail-pg1-x549.google.com with SMTP id 41be03b00d2f7-56f75e70190so15797763a12.3 for ; Mon, 02 Oct 2023 10:34:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1696268074; x=1696872874; darn=lists.linux.it; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=yfK78M3B0vAfdMsOOtW0Ch+JZ6tCMLCBSlmuQX81bhw=; b=dU09ZyE9AvqzSFOsTo/oC9KIDutR2aggRv9H/lL7Fq5LGB57teYbr+gSw5O0XJs2xH OmqpcjYCfyuuD7AVPI8KfzOQGtEX3JAJHcHki89R7XvjzuIiwRucM9xxAIcOR1Pl32Ak 1k8YzaaZ2V71kU5xLak2BJDFSAE2OXAtAS+g8Cux5zXB3zKV6LVJ1FSGKIqBOm6YjpDV y0yjE/RsgOlfre18Z8P4SFk+ndQ2h49iCn29gWeBgXM6V44DRvr4xL9wSnyBKDYBCnX5 z25sCR6GTIFGBwWqA54F/NdK14xX5ilnbY8mr2dw7xTLHtwbekgD+n1W7LQIrbFTBqu2 Y0EQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696268074; x=1696872874; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=yfK78M3B0vAfdMsOOtW0Ch+JZ6tCMLCBSlmuQX81bhw=; b=sR+b0rDFkeB6ZA1rGYVunAyIyrF81ql8cHlZtDstJuqmhKYlz+9LnDlK+hXW/nNEHp xOdUJfAtBlqHYwF56LUTtFSlbe1lszVEvxhOFOJeomszAem/+DdRh5elkG4E5PGQKAka khV6OOEPdQSTBP2ldGt7ZMqSCVx0Z619a5jnrNLAezL+Le7yDMZOgMDyg+zO/fBKH61K SZYeBxT9oFvI8i8rupkjfjMLwEouphALgrmwBHWFcnKOXGbVkMyAUQrmDZojbZx3ZEMt YoNxOA/9f+PjWQEocAY0tE1Oj6RL7WzYOqJYkpa9zZwrgHp2iO0sG1s0hLqImGPq9Tbl ij/g== X-Gm-Message-State: AOJu0YwFGdfny5cwJ0c1IvjWvfEW2wvargGk5Vgvixbykgy4PFuULzO4 HK4lb//gzSj9G7iFUNECw/jNqnPz7xFHX2D6SfzF6s+xuINrt79olU1rxwZBbpc42W9mSvdAnFd jkWFIUQjnYESbaG1qhFZAyUXNI/iT/baJkvTa0Y2CUdHtd4eNTLqDWwFI X-Google-Smtp-Source: AGHT+IEvugCUtXyRPQQvLWg0RECRD8dOXKC4AbpyjXcM0NJW1jg7QnyARHgUoikWeMLyI+wXu5atJzwSI9k= X-Received: from edliaw.c.googlers.com ([fda3:e722:ac3:cc00:24:72f4:c0a8:305d]) (user=edliaw job=sendgmr) by 2002:a63:7e5c:0:b0:57c:856a:5010 with SMTP id o28-20020a637e5c000000b0057c856a5010mr188022pgn.10.1696268074121; Mon, 02 Oct 2023 10:34:34 -0700 (PDT) Date: Mon, 2 Oct 2023 17:34:16 +0000 In-Reply-To: <20231002173416.1080347-1-edliaw@google.com> Mime-Version: 1.0 References: <20231002173416.1080347-1-edliaw@google.com> X-Mailer: git-send-email 2.42.0.582.g8ccd20d70d-goog Message-ID: <20231002173416.1080347-3-edliaw@google.com> To: ltp@lists.linux.it X-Virus-Scanned: clamav-milter 1.0.1 at in-6.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=-7.4 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL shortcircuit=no autolearn=disabled version=4.0.0 X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on in-6.smtp.seeweb.it Subject: [LTP] [PATCH v2 2/2] pipe07: refactor exp_num_pipes X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Edward Liaw via ltp From: Edward Liaw Reply-To: Edward Liaw Cc: kernel-team@android.com Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Move doubling the exp_num_pipes into the value. Signed-off-by: Edward Liaw --- testcases/kernel/syscalls/pipe/pipe07.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/testcases/kernel/syscalls/pipe/pipe07.c b/testcases/kernel/syscalls/pipe/pipe07.c index d9b23044d..8098007c2 100644 --- a/testcases/kernel/syscalls/pipe/pipe07.c +++ b/testcases/kernel/syscalls/pipe/pipe07.c @@ -58,8 +58,8 @@ static void setup(void) tst_res(TINFO, "getdtablesize() = %d", max_fds); pipe_fds = SAFE_MALLOC(max_fds * sizeof(int)); - exp_num_pipes = (max_fds - record_open_fds()) / 2; - tst_res(TINFO, "expected max fds to be opened by pipe(): %d", exp_num_pipes * 2); + exp_num_pipes = (max_fds - record_open_fds()) / 2 * 2; + tst_res(TINFO, "expected max fds to be opened by pipe(): %d", exp_num_pipes); } static void run(void) @@ -75,7 +75,7 @@ static void run(void) } while (!TST_RET); TST_EXP_EQ_LI(errno, EMFILE); - TST_EXP_EQ_LI(exp_num_pipes * 2, num_pipe_fds); + TST_EXP_EQ_LI(exp_num_pipes, num_pipe_fds); for (int i = 0; i < num_pipe_fds; i++) SAFE_CLOSE(pipe_fds[i]);