From patchwork Thu Apr 9 20:11:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: develop--- via Libc-alpha X-Patchwork-Id: 1268810 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=libc-alpha-bounces@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=sourceware.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=MGN005Ql; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48yswq4dg5z9sQx for ; Fri, 10 Apr 2020 06:21:15 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9ED1F385DC1E; Thu, 9 Apr 2020 20:21:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9ED1F385DC1E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1586463673; bh=UovU0RViiTuV5EUUGLtBfHyGUY16DAgH4cdRpaKXjkg=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=MGN005Qlk1/IkvbJ1FtWVo+451RAKC8W45jGPsCuE2IUf6xVW5QAHU4zxiD8iGDx1 vdK4NUIxKLkrc07g1qSQ/2RCVhb+eRtk4kjMb2hijX3Xkscq030qDQv+/3iAc/NnbN ora1QKiiAMM/IHds1TwcS6iAid1yOkzgVftcJT+g= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from esa3.hgst.iphmx.com (esa3.hgst.iphmx.com [216.71.153.141]) by sourceware.org (Postfix) with ESMTPS id 8B5F4385B835 for ; Thu, 9 Apr 2020 20:21:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 8B5F4385B835 IronPort-SDR: zeXnB0cFV2l5noeOpTc7ntYLdzyhWf2GcdKh3aUoc/wxclEjvtCIy2REPEf4qk8AHKOluRzRCe C8aybmdJ6tFwhR7CYpZMYfP/pmSpv0yGkjCM8OudWm4FCtXTZrZbqdQl2ruHFJZztashFUHa56 dXB41cacV/Q5+pANM5AlXJERMvX6DzbXEGeREr9ZlGgfDEp5dx8tcU2p9QZLsP4HsNV7XMHWPf Sl2tmQbpqp49RQChlzemppg3j8CXpWS9yCrPvlFsmdQBFJvfVIcx3CPLBjEyZRj26YhwHzKRFb 0fs= X-IronPort-AV: E=Sophos;i="5.72,363,1580745600"; d="scan'208";a="139316634" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 10 Apr 2020 04:21:10 +0800 IronPort-SDR: 9Smyp0CN5uHx4AvhsKRUROj4QOilLYY1vYMsSKHKekUgOhSqPjR+DR1bq7ULgok+ApNo0sZ+U0 GtDvDcswWDWdZRk7p/kdY+8kcoYuJ93q1s8gLNVU5Nq950wraIqqSABweZlUNEf+D7BruRhoy2 RSEs/DRW6iUGqUhqftaLaAvWLjKRA/EpWNgXTcCAWOE7ocWIZU/reG1zaBJYWuDkbAQ0i1qLyv R8CV6XtkksBB8Cso90TV1tGY3zxNUi4vO7C0S1Xf84XRX/oTD7raaXgaNLwal57tWhLiv934h8 hjQldEMK//Q7TcUpwIQNq1dM Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Apr 2020 13:11:49 -0700 IronPort-SDR: rzkaUNEEbIodycwZj4G5B2S/FHplL1ym+UM2TrgKCuVERDxD0rfzGt1emvdZUWZHaonNAJdb3I PJ8SJoia9jHJ2EJZ/zqjZVoj21l1QBJ68d6Lb81rFsRP17ghu0f4ATHW2XFD3jxMo3TNGqQSQ6 NX73BqcDINVPdfyjZjPpQ8HANBENuqzbo4VupLNgq5/aizhaOm8BR5xvgqgmgjJQKDe4pxQ4XU Oanqw8Ml1ARxsFiXwIlL2am6mgHSj0KouN3fuFR4z2gjzoLWlAt3w5+tzTfwwkVfaLemdHjcrQ +iY= WDCIronportException: Internal Received: from 5zs6pc2.ad.shared (HELO risc6-mainframe.hgst.com) ([10.86.55.151]) by uls-op-cesaip02.wdc.com with ESMTP; 09 Apr 2020 13:21:09 -0700 To: libc-alpha@sourceware.org Subject: [PATCH v3 2/2] linux: Add wait4 test case Date: Thu, 9 Apr 2020 13:11:54 -0700 Message-Id: <20200409201154.3365671-2-alistair.francis@wdc.com> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200409201154.3365671-1-alistair.francis@wdc.com> References: <20200409201154.3365671-1-alistair.francis@wdc.com> MIME-Version: 1.0 X-Spam-Status: No, score=-25.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Alistair Francis via Libc-alpha From: develop--- via Libc-alpha Reply-To: Alistair Francis Cc: Alistair Francis Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" Add a simple test that checks if the wait4 syscall works without an rusage argument. This test would have caught the bugs introduced in commit 600f00b "linux: Use long time_t for wait4/getrusage". --- sysdeps/unix/sysv/linux/Makefile | 2 +- sysdeps/unix/sysv/linux/tst-wait4.c | 51 +++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 sysdeps/unix/sysv/linux/tst-wait4.c diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile index 60dc5cf9e5..d5fdb4369a 100644 --- a/sysdeps/unix/sysv/linux/Makefile +++ b/sysdeps/unix/sysv/linux/Makefile @@ -98,7 +98,7 @@ tests += tst-clone tst-clone2 tst-clone3 tst-fanotify tst-personality \ tst-quota tst-sync_file_range tst-sysconf-iov_max tst-ttyname \ test-errno-linux tst-memfd_create tst-mlock2 tst-pkey \ tst-rlimit-infinity tst-ofdlocks tst-gettid tst-gettid-kill \ - tst-tgkill + tst-tgkill tst-wait4 tests-internal += tst-ofdlocks-compat tst-sigcontext-get_pc CFLAGS-tst-sigcontext-get_pc.c = -fasynchronous-unwind-tables diff --git a/sysdeps/unix/sysv/linux/tst-wait4.c b/sysdeps/unix/sysv/linux/tst-wait4.c new file mode 100644 index 0000000000..44287797a7 --- /dev/null +++ b/sysdeps/unix/sysv/linux/tst-wait4.c @@ -0,0 +1,51 @@ +/* Smoke test for the wait4 system call. + Copyright (C) 2019-2020 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#include +#include +#include +#include +#include +#include + +/* Check that wait4 works with no rusage arg. */ +static void +test_wait4_no_usage (void) +{ + pid_t child = fork (); + + if (child == 0) + { + pause (); + exit (0); + } + + wait4 (child, &(int){0}, WNOHANG, NULL); + kill (child, SIGKILL); +} + +static int +do_test (void) +{ + test_wait4_no_usage(); + + return 0; +} + +#include