From patchwork Thu Nov 3 13:33:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuah Khan X-Patchwork-Id: 13029985 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 0FCABC433FE for ; Thu, 3 Nov 2022 13:34:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231313AbiKCNeE (ORCPT ); Thu, 3 Nov 2022 09:34:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230504AbiKCNeD (ORCPT ); Thu, 3 Nov 2022 09:34:03 -0400 Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 51FDE63D5 for ; Thu, 3 Nov 2022 06:34:02 -0700 (PDT) Received: by mail-pj1-x102f.google.com with SMTP id b1-20020a17090a7ac100b00213fde52d49so1799901pjl.3 for ; Thu, 03 Nov 2022 06:34:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; h=subject:from:cc:to:content-language:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=1QqFy+VNTViKLjxab+1Xd32/kKSi0wuwBQO1qBHtEF8=; b=E1fbxisBK5k0dh/6Que4DMtXFBnSiMApGw5drLTPqiCJbZ8x3aouLUNXQFMB08/7+C KSaob9KNi88j/d5tKbPd9Zek65cV0aMBUfuJ5BS9v5IBzkmRO/vs1p5IJL/8bY4FM/sp hJw5A7DMlZmI/30Vao9W2VlUE8P90vtfa+PW8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=subject:from:cc:to:content-language:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=1QqFy+VNTViKLjxab+1Xd32/kKSi0wuwBQO1qBHtEF8=; b=2nMgO5PwNSyRpfMeGNvE59ydsATAxXHCxP0Z5QOQ7shnERjERzegTREMxD5wNTmhuw Q6gF+Qoc6RqqMqbob/5ugCG/qkRlfTyhfs4FdYY+DxaJN8kShPtBf7tJgHrEzu3dE9fu 4Y3buneZBlC3ACooF1BreDX8U6I7l1+7V7QjO7zY4jk3NMBVVZK2GcvHp+kuDr44CTNK p1b47Yo43Zy4lwXLj8Y1oS0vM3wyjHyiJYNE7KSgN1wJEIX++TetN0wzG0u6FmX3evnx nZuVSx7woH0xHDnSmL7iJRkqao97yyo8j3LMgdDrcjAG5/sN1eieYsqH4qpSddHprNT8 vpng== X-Gm-Message-State: ACrzQf1YTlDbhRCZzRDVwexBXy48xfmzCG1feM30ApGYSh+wHiuN56+8 nZsi9M8fc0gmDIhIq3kKsFRsNg== X-Google-Smtp-Source: AMsMyM6NGs7b/1Pg6bySVfF69pvW23dBz3md/qv8YnBd3S2o1/lNJ9g8cj8Z3LH7A9xfkQgPt1wtdA== X-Received: by 2002:a17:90b:1b01:b0:213:ccc6:87ea with SMTP id nu1-20020a17090b1b0100b00213ccc687eamr25733268pjb.135.1667482441723; Thu, 03 Nov 2022 06:34:01 -0700 (PDT) Received: from [192.168.0.168] ([103.99.10.63]) by smtp.gmail.com with ESMTPSA id o14-20020a170902d4ce00b001784a45511asm684361plg.79.2022.11.03.06.33.59 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 03 Nov 2022 06:34:00 -0700 (PDT) Message-ID: <6eae8f0b-2050-3c0f-828d-8b87262b1cef@linuxfoundation.org> Date: Thu, 3 Nov 2022 07:33:57 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Content-Language: en-US To: Linus Torvalds Cc: Shuah Khan , linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org From: Shuah Khan Subject: [GIT PULL] Kselftest fixes update for Linux 6.1-rc4 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Hi Linus, Please pull the following Kselftest fixes update for Linux 6.1-rc4. This Kselftest fixes update for Linux 6.1-rc4 consists of fixes to pidfd test. diff is attached. thanks, -- Shuah ---------------------------------------------------------------- The following changes since commit cb05c81ada76a30a25a5f79b249375e33473af33: selftests/ftrace: fix dynamic_events dependency check (2022-10-18 14:27:23 -0600) are available in the Git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest tags/linux-kselftest-fixes-6.1-rc4 for you to fetch changes up to 89c1017aac67ca81973b7c8eac5d021315811a93: selftests/pidfd_test: Remove the erroneous ',' (2022-11-02 03:09:57 -0600) ---------------------------------------------------------------- linux-kselftest-fixes-6.1-rc4 This Kselftest fixes update for Linux 6.1-rc4 consists of fixes to pidfd test. ---------------------------------------------------------------- Li Zhijian (2): ksefltests: pidfd: Fix wait_states: Test terminated by timeout selftests: pidfd: Fix compling warnings Zhao Gongyi (1): selftests/pidfd_test: Remove the erroneous ',' tools/testing/selftests/pidfd/Makefile | 2 +- tools/testing/selftests/pidfd/pidfd_test.c | 4 +++- tools/testing/selftests/pidfd/pidfd_wait.c | 12 +++++++++++- 3 files changed, 15 insertions(+), 3 deletions(-) ---------------------------------------------------------------- diff --git a/tools/testing/selftests/pidfd/Makefile b/tools/testing/selftests/pidfd/Makefile index f4a2f28f926b..778b6cdc8aed 100644 --- a/tools/testing/selftests/pidfd/Makefile +++ b/tools/testing/selftests/pidfd/Makefile @@ -1,5 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-only -CFLAGS += -g -I../../../../usr/include/ -pthread +CFLAGS += -g -I../../../../usr/include/ -pthread -Wall TEST_GEN_PROGS := pidfd_test pidfd_fdinfo_test pidfd_open_test \ pidfd_poll_test pidfd_wait pidfd_getfd_test pidfd_setns_test diff --git a/tools/testing/selftests/pidfd/pidfd_test.c b/tools/testing/selftests/pidfd/pidfd_test.c index 9a2d64901d59..e2dd4ed84984 100644 --- a/tools/testing/selftests/pidfd/pidfd_test.c +++ b/tools/testing/selftests/pidfd/pidfd_test.c @@ -413,7 +413,7 @@ static void poll_pidfd(const char *test_name, int pidfd) c = epoll_wait(epoll_fd, events, MAX_EVENTS, 5000); if (c != 1 || !(events[0].events & EPOLLIN)) - ksft_exit_fail_msg("%s test: Unexpected epoll_wait result (c=%d, events=%x) ", + ksft_exit_fail_msg("%s test: Unexpected epoll_wait result (c=%d, events=%x) " "(errno %d)\n", test_name, c, events[0].events, errno); @@ -435,6 +435,8 @@ static int child_poll_exec_test(void *args) */ while (1) sleep(1); + + return 0; } static void test_pidfd_poll_exec(int use_waitpid) diff --git a/tools/testing/selftests/pidfd/pidfd_wait.c b/tools/testing/selftests/pidfd/pidfd_wait.c index 070c1c876df1..0dcb8365ddc3 100644 --- a/tools/testing/selftests/pidfd/pidfd_wait.c +++ b/tools/testing/selftests/pidfd/pidfd_wait.c @@ -95,20 +95,28 @@ TEST(wait_states) .flags = CLONE_PIDFD | CLONE_PARENT_SETTID, .exit_signal = SIGCHLD, }; + int pfd[2]; pid_t pid; siginfo_t info = { .si_signo = 0, }; + ASSERT_EQ(pipe(pfd), 0); pid = sys_clone3(&args); ASSERT_GE(pid, 0); if (pid == 0) { + char buf[2]; + + close(pfd[1]); kill(getpid(), SIGSTOP); + ASSERT_EQ(read(pfd[0], buf, 1), 1); + close(pfd[0]); kill(getpid(), SIGSTOP); exit(EXIT_SUCCESS); } + close(pfd[0]); ASSERT_EQ(sys_waitid(P_PIDFD, pidfd, &info, WSTOPPED, NULL), 0); ASSERT_EQ(info.si_signo, SIGCHLD); ASSERT_EQ(info.si_code, CLD_STOPPED); @@ -117,6 +125,8 @@ TEST(wait_states) ASSERT_EQ(sys_pidfd_send_signal(pidfd, SIGCONT, NULL, 0), 0); ASSERT_EQ(sys_waitid(P_PIDFD, pidfd, &info, WCONTINUED, NULL), 0); + ASSERT_EQ(write(pfd[1], "C", 1), 1); + close(pfd[1]); ASSERT_EQ(info.si_signo, SIGCHLD); ASSERT_EQ(info.si_code, CLD_CONTINUED); ASSERT_EQ(info.si_pid, parent_tid); @@ -138,7 +148,7 @@ TEST(wait_states) TEST(wait_nonblock) { - int pidfd, status = 0; + int pidfd; unsigned int flags = 0; pid_t parent_tid = -1; struct clone_args args = {