From patchwork Thu Aug 20 10:26:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Feiyu Zhu X-Patchwork-Id: 1348299 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=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=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=cn.fujitsu.com 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 RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BXLRV5Dbjz9sR4 for ; Thu, 20 Aug 2020 20:26:46 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id E74AD3C2F9F for ; Thu, 20 Aug 2020 12:26:42 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-5.smtp.seeweb.it (in-5.smtp.seeweb.it [IPv6:2001:4b78:1:20::5]) by picard.linux.it (Postfix) with ESMTP id 7C9123C12A1 for ; Thu, 20 Aug 2020 12:26:39 +0200 (CEST) Received: from heian.cn.fujitsu.com (mail.cn.fujitsu.com [183.91.158.132]) by in-5.smtp.seeweb.it (Postfix) with ESMTP id 29A446008EC for ; Thu, 20 Aug 2020 12:26:37 +0200 (CEST) X-IronPort-AV: E=Sophos;i="5.76,332,1592841600"; d="scan'208";a="98313490" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 20 Aug 2020 18:26:34 +0800 Received: from G08CNEXMBPEKD04.g08.fujitsu.local (unknown [10.167.33.201]) by cn.fujitsu.com (Postfix) with ESMTP id 930B448990D4 for ; Thu, 20 Aug 2020 18:26:33 +0800 (CST) Received: from RHEL74GA.g08.fujitsu.local (10.167.220.75) by G08CNEXMBPEKD04.g08.fujitsu.local (10.167.33.201) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 20 Aug 2020 18:26:34 +0800 From: Feiyu Zhu To: Date: Thu, 20 Aug 2020 06:26:05 -0400 Message-ID: <1597919168-10702-1-git-send-email-zhufy.jy@cn.fujitsu.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 X-Originating-IP: [10.167.220.75] X-ClientProxiedBy: G08CNEXCHPEKD05.g08.fujitsu.local (10.167.33.203) To G08CNEXMBPEKD04.g08.fujitsu.local (10.167.33.201) X-yoursite-MailScanner-ID: 930B448990D4.A7C21 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: zhufy.jy@cn.fujitsu.com X-Spam-Status: No, score=0.4 required=7.0 tests=KHOP_HELO_FCRDNS, SPF_HELO_NONE, SPF_NONE autolearn=disabled version=3.4.4 X-Virus-Scanned: clamav-milter 0.102.4 at in-5.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-5.smtp.seeweb.it Subject: [LTP] [PATCH 1/4] syscalls/kill01: Remove it 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: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" kill11 has covered this test, so remove it. Reviewed-by: Yang Xu Signed-off-by: Feiyu Zhu --- runtest/syscalls | 1 - testcases/kernel/syscalls/kill/.gitignore | 1 - testcases/kernel/syscalls/kill/kill01.c | 161 ------------------------------ 3 files changed, 163 deletions(-) delete mode 100644 testcases/kernel/syscalls/kill/kill01.c diff --git a/runtest/syscalls b/runtest/syscalls index 860c5c3..5e2bdb1 100644 --- a/runtest/syscalls +++ b/runtest/syscalls @@ -614,7 +614,6 @@ kcmp01 kcmp01 kcmp02 kcmp02 kcmp03 kcmp03 -kill01 kill01 kill02 kill02 kill03 kill03 kill04 kill04 diff --git a/testcases/kernel/syscalls/kill/.gitignore b/testcases/kernel/syscalls/kill/.gitignore index 490a1e2..b62662f 100644 --- a/testcases/kernel/syscalls/kill/.gitignore +++ b/testcases/kernel/syscalls/kill/.gitignore @@ -1,4 +1,3 @@ -/kill01 /kill02 /kill03 /kill04 diff --git a/testcases/kernel/syscalls/kill/kill01.c b/testcases/kernel/syscalls/kill/kill01.c deleted file mode 100644 index 0aa77b9..0000000 --- a/testcases/kernel/syscalls/kill/kill01.c +++ /dev/null @@ -1,161 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/* - * NAME - * kill01.c - * - * DESCRIPTION - * Test case to check the basic functionality of kill(). - * - * ALGORITHM - * call setup - * loop if the -i option was given - * fork a child - * execute the kill system call - * check the return value - * if return value is -1 - * issue a FAIL message, break remaining tests and cleanup - * if we are doing functional testing - * if the process was terminated with the expected signal. - * issue a PASS message - * otherwise - * issue a FAIL message - * call cleanup - * - * USAGE - * kill01 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS - * This test should be ran as a non-root user. - */ - -#include "test.h" - -#include -#include -#include - -void cleanup(void); -void setup(void); -void do_child(void); - -char *TCID = "kill01"; -int TST_TOTAL = 1; - -#define TEST_SIG SIGKILL - -int main(int ac, char **av) -{ - int lc; - pid_t pid; - int exno, status, nsig; - - tst_parse_opts(ac, av, NULL, NULL); -#ifdef UCLINUX - maybe_run_child(&do_child, ""); -#endif - - setup(); /* global setup */ - - /* The following loop checks looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - - /* reset tst_count in case we are looping */ - tst_count = 0; - status = 1; - exno = 1; - pid = FORK_OR_VFORK(); - if (pid < 0) { - tst_brkm(TBROK, cleanup, "Fork of child failed"); - } else if (pid == 0) { -#ifdef UCLINUX - if (self_exec(av[0], "") < 0) { - tst_brkm(TBROK, cleanup, - "self_exec of child failed"); - } -#else - do_child(); -#endif - } else { - TEST(kill(pid, TEST_SIG)); - waitpid(pid, &status, 0); - } - - if (TEST_RETURN == -1) { - tst_brkm(TFAIL, cleanup, "%s failed - errno = %d : %s", - TCID, TEST_ERRNO, strerror(TEST_ERRNO)); - } - - /* - * Check to see if the process was terminated with the - * expected signal. - */ - nsig = WTERMSIG(status); - if (nsig == TEST_SIG) { - tst_resm(TPASS, "received expected signal %d", - nsig); - } else { - tst_resm(TFAIL, - "expected signal %d received %d", - TEST_SIG, nsig); - } - } - - cleanup(); - tst_exit(); -} - -/* - * do_child() - */ -void do_child(void) -{ - int exno = 1; - - pause(); - exit(exno); -} - -/* - * setup() - performs all ONE TIME setup for this test - */ -void setup(void) -{ - - TEST_PAUSE; -} - -/* - * cleanup() - performs all the ONE TIME cleanup for this test at completion - * or premature exit. - */ -void cleanup(void) -{ - -} From patchwork Thu Aug 20 10:26:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Feiyu Zhu X-Patchwork-Id: 1348300 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=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=cn.fujitsu.com Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (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 4BXLRg5g5Qz9sPC for ; Thu, 20 Aug 2020 20:26:55 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 076143C580B for ; Thu, 20 Aug 2020 12:26:53 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-5.smtp.seeweb.it (in-5.smtp.seeweb.it [IPv6:2001:4b78:1:20::5]) by picard.linux.it (Postfix) with ESMTP id 97C2A3C2FAD for ; Thu, 20 Aug 2020 12:26:42 +0200 (CEST) Received: from heian.cn.fujitsu.com (mail.cn.fujitsu.com [183.91.158.132]) by in-5.smtp.seeweb.it (Postfix) with ESMTP id 302566008EC for ; Thu, 20 Aug 2020 12:26:40 +0200 (CEST) X-IronPort-AV: E=Sophos;i="5.76,332,1592841600"; d="scan'208";a="98313501" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 20 Aug 2020 18:26:40 +0800 Received: from G08CNEXMBPEKD04.g08.fujitsu.local (unknown [10.167.33.201]) by cn.fujitsu.com (Postfix) with ESMTP id CB22C48990D0 for ; Thu, 20 Aug 2020 18:26:34 +0800 (CST) Received: from RHEL74GA.g08.fujitsu.local (10.167.220.75) by G08CNEXMBPEKD04.g08.fujitsu.local (10.167.33.201) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 20 Aug 2020 18:26:35 +0800 From: Feiyu Zhu To: Date: Thu, 20 Aug 2020 06:26:06 -0400 Message-ID: <1597919168-10702-2-git-send-email-zhufy.jy@cn.fujitsu.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1597919168-10702-1-git-send-email-zhufy.jy@cn.fujitsu.com> References: <1597919168-10702-1-git-send-email-zhufy.jy@cn.fujitsu.com> MIME-Version: 1.0 X-Originating-IP: [10.167.220.75] X-ClientProxiedBy: G08CNEXCHPEKD05.g08.fujitsu.local (10.167.33.203) To G08CNEXMBPEKD04.g08.fujitsu.local (10.167.33.201) X-yoursite-MailScanner-ID: CB22C48990D0.AC82A X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: zhufy.jy@cn.fujitsu.com X-Spam-Status: No, score=0.4 required=7.0 tests=KHOP_HELO_FCRDNS, SPF_HELO_NONE, SPF_NONE autolearn=disabled version=3.4.4 X-Virus-Scanned: clamav-milter 0.102.4 at in-5.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-5.smtp.seeweb.it Subject: [LTP] [PATCH 2/4] syscalls/kill03, 04: Cleanup && Convert to new library 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: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" 1) Remove uclinux code 2) Take use of safe macro 3) Merge kill04 into kill03 4) Add error test that pid is INT_MIN Reviewed-by: Yang Xu Signed-off-by: Feiyu Zhu --- runtest/syscalls | 1 - testcases/kernel/syscalls/kill/.gitignore | 1 - testcases/kernel/syscalls/kill/kill03.c | 203 +++++++++--------------------- testcases/kernel/syscalls/kill/kill04.c | 133 -------------------- 4 files changed, 59 insertions(+), 279 deletions(-) delete mode 100644 testcases/kernel/syscalls/kill/kill04.c diff --git a/runtest/syscalls b/runtest/syscalls index 5e2bdb1..a6ab75b 100644 --- a/runtest/syscalls +++ b/runtest/syscalls @@ -616,7 +616,6 @@ kcmp03 kcmp03 kill02 kill02 kill03 kill03 -kill04 kill04 kill05 kill05 kill06 kill06 kill07 kill07 diff --git a/testcases/kernel/syscalls/kill/.gitignore b/testcases/kernel/syscalls/kill/.gitignore index b62662f..75fdaa5 100644 --- a/testcases/kernel/syscalls/kill/.gitignore +++ b/testcases/kernel/syscalls/kill/.gitignore @@ -1,6 +1,5 @@ /kill02 /kill03 -/kill04 /kill05 /kill06 /kill07 diff --git a/testcases/kernel/syscalls/kill/kill03.c b/testcases/kernel/syscalls/kill/kill03.c index 5770ae0..21be09f 100644 --- a/testcases/kernel/syscalls/kill/kill03.c +++ b/testcases/kernel/syscalls/kill/kill03.c @@ -1,165 +1,80 @@ +// SPDX-License-Identifier: GPL-2.0-or-later /* + * Copyright (c) International Business Machines Corp., 2001 * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/* - * NAME - * kill03.c - * - * DESCRIPTION - * Test case to check that kill fails when given an invalid signal. - * - * ALGORITHM - * call setup - * loop if the -i option was given - * fork a child - * execute the kill system call with an invalid signal - * check the return value - * if return value is not -1 - * issue a FAIL message, break remaining tests and cleanup - * if we are doing functional testing - * if the errno was set to 22 (invalid argument). - * issue a PASS message - * otherwise - * issue a FAIL message - * call cleanup - * - * USAGE - * kill03 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. + * 1) kill() fails with errno set to EINVAL if given an invalid signal. + * 2) kill() fails with errno set to ESRCH if given a non-existent pid. + * 3) kill() fails with errno set to ESRCH if the given pid is INT_MIN. * * HISTORY * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS - * none */ -#include "test.h" - +#include #include -#include -#include - -void cleanup(void); -void setup(void); -void do_child(void); - -char *TCID = "kill03"; -int TST_TOTAL = 1; - -#define TEST_SIG 2000 - -int main(int ac, char **av) +#include +#include "tst_test.h" + +static pid_t real_pid, fake_pid, int_min_pid; +static void cleanup(void); + +static struct tcase { + int test_sig; + int exp_errno; + int child_flag; + pid_t *pid; +} tcases[] = { + {2000, EINVAL, 1, &real_pid}, + {SIGKILL, ESRCH, 0, &fake_pid}, + {SIGKILL, ESRCH, 0, &int_min_pid} +}; + +static void verify_kill(unsigned int n) { - int lc; - pid_t pid; - int exno, status; - - tst_parse_opts(ac, av, NULL, NULL); -#ifdef UCLINUX - maybe_run_child(&do_child, ""); -#endif + struct tcase *tc = &tcases[n]; - setup(); - - /* The following loop checks looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - - /* reset tst_count in case we are looping */ - tst_count = 0; - status = 1; - exno = 1; - pid = FORK_OR_VFORK(); - if (pid < 0) { - tst_brkm(TBROK, cleanup, "Fork of child failed"); - } else if (pid == 0) { -#ifdef UCLINUX - if (self_exec(av[0], "") < 0) { - tst_brkm(TBROK, cleanup, - "self_exec of child failed"); - } -#else - do_child(); -#endif - } else { - TEST(kill(pid, TEST_SIG)); - kill(pid, SIGKILL); - waitpid(pid, &status, 0); - } + if (tc->child_flag) { + real_pid = SAFE_FORK(); + if (!real_pid) + pause(); + } + + TEST(kill(*tc->pid, tc->test_sig)); + if (TST_RET != -1) { + tst_res(TFAIL, "kill should fail but not, return %ld", TST_RET); + return; + } - if (TEST_RETURN != -1) { - tst_brkm(TFAIL, cleanup, "%s failed - errno = %d : %s " - "Expected a return value of -1 got %ld", - TCID, TEST_ERRNO, strerror(TEST_ERRNO), - TEST_RETURN); - } + if (tc->exp_errno == TST_ERR) + tst_res(TPASS | TTERRNO, "kill failed as expected"); + else + tst_res(TFAIL | TTERRNO, "kill expected %s but got", + tst_strerrno(tc->exp_errno)); - /* - * Check to see if the errno was set to the expected - * value of 22 : EINVAL. - */ - if (TEST_ERRNO == EINVAL) { - tst_resm(TPASS, "errno set to %d : %s, as " - "expected", TEST_ERRNO, - strerror(TEST_ERRNO)); - } else { - tst_resm(TFAIL, "errno set to %d : %s expected " - "%d : %s", TEST_ERRNO, - strerror(TEST_ERRNO), 22, - strerror(22)); - } + if (tc->child_flag) { + cleanup(); + real_pid = 0; } - - cleanup(); - tst_exit(); } -/* - * do_child() - */ -void do_child(void) +static void setup(void) { - int exno = 1; - - pause(); - exit(exno); + fake_pid = tst_get_unused_pid(); + int_min_pid = INT_MIN; } -/* - * setup() - performs all ONE TIME setup for this test - */ -void setup(void) +static void cleanup(void) { - - TEST_PAUSE; + if (real_pid > 0) { + SAFE_KILL(real_pid, SIGKILL); + SAFE_WAIT(NULL); + } } -/* - * cleanup() - performs all the ONE TIME cleanup for this test at completion - * or premature exit. - */ -void cleanup(void) -{ - -} +static struct tst_test test = { + .test = verify_kill, + .tcnt = ARRAY_SIZE(tcases), + .setup = setup, + .cleanup = cleanup, + .forks_child = 1, +}; diff --git a/testcases/kernel/syscalls/kill/kill04.c b/testcases/kernel/syscalls/kill/kill04.c deleted file mode 100644 index f3bec13..0000000 --- a/testcases/kernel/syscalls/kill/kill04.c +++ /dev/null @@ -1,133 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/* - * NAME - * kill04.c - * - * DESCRIPTION - * Test case to check that kill() fails when passed a non-existant pid. - * - * ALGORITHM - * call setup - * loop if the -i option was given - * fork a child - * execute the kill system call with a non-existant PID - * check the return value - * if return value is not -1 - * issue a FAIL message, break remaining tests and cleanup - * if we are doing functional testing - * if the errno was set to 3 (No such proccess) - * issue a PASS message - * otherwise - * issue a FAIL message - * call cleanup - * - * USAGE - * kill04 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS - * This test should be run by a non-root user - */ - -#include "test.h" - -#include -#include -#include - -void cleanup(void); -void setup(void); -void do_child(void); - -char *TCID = "kill04"; -int TST_TOTAL = 1; - -#define TEST_SIG SIGKILL - -int main(int ac, char **av) -{ - int lc; - pid_t fake_pid; - - tst_parse_opts(ac, av, NULL, NULL); - - setup(); - - /* The following loop checks looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - - /* reset tst_count in case we are looping */ - tst_count = 0; - - fake_pid = tst_get_unused_pid(cleanup); - TEST(kill(fake_pid, TEST_SIG)); - - if (TEST_RETURN != -1) { - tst_brkm(TFAIL, cleanup, "%s failed - errno = %d : %s " - "Expected a return value of -1 got %ld", - TCID, TEST_ERRNO, strerror(TEST_ERRNO), - TEST_RETURN); - } - - /* - * Check to see if the errno was set to the expected - * value of 3 : ESRCH - */ - if (TEST_ERRNO == ESRCH) { - tst_resm(TPASS, "errno set to %d : %s, as " - "expected", TEST_ERRNO, - strerror(TEST_ERRNO)); - } else { - tst_resm(TFAIL, "errno set to %d : %s expected " - "%d : %s", TEST_ERRNO, - strerror(TEST_ERRNO), 3, strerror(3)); - } - } - - cleanup(); - tst_exit(); -} - -/* - * setup() - performs all ONE TIME setup for this test - */ -void setup(void) -{ - - TEST_PAUSE; -} - -/* - * cleanup() - performs all the ONE TIME cleanup for this test at completion - * or premature exit. - */ -void cleanup(void) -{ - -} From patchwork Thu Aug 20 10:26:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Feiyu Zhu X-Patchwork-Id: 1348301 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=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=cn.fujitsu.com Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BXLRs0cW0z9sTN for ; Thu, 20 Aug 2020 20:27:04 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 7862E3C5807 for ; Thu, 20 Aug 2020 12:27:02 +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 [217.194.8.6]) by picard.linux.it (Postfix) with ESMTP id 6FAD53C2FC9 for ; Thu, 20 Aug 2020 12:26:43 +0200 (CEST) Received: from heian.cn.fujitsu.com (mail.cn.fujitsu.com [183.91.158.132]) by in-6.smtp.seeweb.it (Postfix) with ESMTP id 2F702140112E for ; Thu, 20 Aug 2020 12:26:41 +0200 (CEST) X-IronPort-AV: E=Sophos;i="5.76,332,1592841600"; d="scan'208";a="98313503" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 20 Aug 2020 18:26:40 +0800 Received: from G08CNEXMBPEKD04.g08.fujitsu.local (unknown [10.167.33.201]) by cn.fujitsu.com (Postfix) with ESMTP id D25BF48990CE for ; Thu, 20 Aug 2020 18:26:35 +0800 (CST) Received: from RHEL74GA.g08.fujitsu.local (10.167.220.75) by G08CNEXMBPEKD04.g08.fujitsu.local (10.167.33.201) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 20 Aug 2020 18:26:36 +0800 From: Feiyu Zhu To: Date: Thu, 20 Aug 2020 06:26:07 -0400 Message-ID: <1597919168-10702-3-git-send-email-zhufy.jy@cn.fujitsu.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1597919168-10702-1-git-send-email-zhufy.jy@cn.fujitsu.com> References: <1597919168-10702-1-git-send-email-zhufy.jy@cn.fujitsu.com> MIME-Version: 1.0 X-Originating-IP: [10.167.220.75] X-ClientProxiedBy: G08CNEXCHPEKD05.g08.fujitsu.local (10.167.33.203) To G08CNEXMBPEKD04.g08.fujitsu.local (10.167.33.201) X-yoursite-MailScanner-ID: D25BF48990CE.AD011 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: zhufy.jy@cn.fujitsu.com X-Spam-Status: No, score=0.4 required=7.0 tests=KHOP_HELO_FCRDNS, SPF_HELO_NONE, SPF_NONE autolearn=disabled version=3.4.4 X-Virus-Scanned: clamav-milter 0.102.4 at in-6.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-6.smtp.seeweb.it Subject: [LTP] [PATCH 3/4] syscalls/kill05:Cleanup && Convert to new library 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: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" 1) Take use of some safe macros Reviewed-by: Yang Xu Signed-off-by: Feiyu Zhu --- testcases/kernel/syscalls/kill/Makefile | 4 +- testcases/kernel/syscalls/kill/kill05.c | 243 ++++++++------------------------ 2 files changed, 58 insertions(+), 189 deletions(-) diff --git a/testcases/kernel/syscalls/kill/Makefile b/testcases/kernel/syscalls/kill/Makefile index 3d1b146..0cc064b 100644 --- a/testcases/kernel/syscalls/kill/Makefile +++ b/testcases/kernel/syscalls/kill/Makefile @@ -3,11 +3,11 @@ top_srcdir ?= ../../../.. -LTPLIBS = ltpipc +LTPLIBS = ltpipc ltpnewipc include $(top_srcdir)/include/mk/testcases.mk kill07: LTPLDLIBS = -lltpipc -kill05: LTPLDLIBS = -lltpipc +kill05: LTPLDLIBS = -lltpnewipc include $(top_srcdir)/include/mk/generic_leaf_target.mk diff --git a/testcases/kernel/syscalls/kill/kill05.c b/testcases/kernel/syscalls/kill/kill05.c index ccef5af..039d510 100644 --- a/testcases/kernel/syscalls/kill/kill05.c +++ b/testcases/kernel/syscalls/kill/kill05.c @@ -1,56 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0-or-later /* + * Copyright (c) International Business Machines Corp., 2001 * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/* - * NAME - * kill05.c - * - * DESCRIPTION - * Test case to check that kill() fails when passed a pid owned by another - * user. - * - * ALGORITHM - * call setup - * loop if the -i option was given - * setup a shared memory segment to for a flag which will notify - * ltpuser1's process that life is not worth living in a continuous loop. - * fork a child and set the euid to ltpuser1 - * set the parents euid to ltpuser2 - * execute the kill system call on ltpuser1's pid - * check the return value - * if return value is not -1 - * issue a FAIL message, break remaining tests and cleanup - * if we are doing functional testing - * if the errno was set to 1 (Operation not permitted) - * issue a PASS message - * otherwise - * issue a FAIL message - * call cleanup - * - * USAGE - * kill05 [-c n] [-e] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -e : Turn on errno logging. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. + * Test case to check that kill() fails when passed a pid owned by another user. * * HISTORY * 07/2001 Ported by Wayne Boyer @@ -66,67 +18,20 @@ * Looping with the -i option does not work correctly. */ -#include -#include -#include #include -#include #include -#include -#include -#include #include -#include - -#include "test.h" -#include "safe_macros.h" +#include "tst_test.h" +#include "libnewipc.h" +#include "tst_safe_sysv_ipc.h" +#include "tst_safe_macros.h" -extern void rm_shm(int); - -void cleanup(void); -void setup(void); -void do_child(void); -void do_master_child(char **av); - -char *TCID = "kill05"; -int TST_TOTAL = 1; -int shmid1 = -1; -extern key_t semkey; +static uid_t nobody_uid, bin_uid; int *flag; +static int shm_id = -1; +static key_t shm_key; -extern int getipckey(); - -#define TEST_SIG SIGKILL - -int main(int ac, char **av) -{ - pid_t pid; - int status; - - tst_parse_opts(ac, av, NULL, NULL); -#ifdef UCLINUX - maybe_run_child(&do_child, ""); -#endif - - setup(); /* global setup */ - - pid = FORK_OR_VFORK(); - if (pid == -1) - tst_brkm(TBROK, cleanup, "Fork failed"); - else if (pid == 0) - do_master_child(av); - - if (waitpid(pid, &status, 0) == -1) - tst_resm(TBROK | TERRNO, "waitpid failed"); - else if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) - tst_resm(TFAIL, "child exited abnormally"); - else - tst_resm(TPASS, "received expected errno(EPERM)"); - cleanup(); - tst_exit(); -} - -void wait_for_flag(int value) +static void wait_for_flag(int value) { while (1) { if (*flag == value) @@ -136,107 +41,71 @@ void wait_for_flag(int value) } } -/* - * do_master_child() - */ -void do_master_child(char **av) +void do_master_child(void) { pid_t pid1; - int status; - - char user1name[] = "nobody"; - char user2name[] = "bin"; - - struct passwd *ltpuser1, *ltpuser2; - - tst_count = 0; *flag = 0; - - pid1 = FORK_OR_VFORK(); - - if (pid1 == -1) - tst_brkm(TBROK | TERRNO, cleanup, "Fork failed"); - + pid1 = SAFE_FORK(); if (pid1 == 0) { - ltpuser1 = SAFE_GETPWNAM(NULL, user1name); - if (setreuid(ltpuser1->pw_uid, ltpuser1->pw_uid) == -1) { - perror("setreuid failed (in child)"); - exit(1); - } + SAFE_SETREUID(nobody_uid, nobody_uid); *flag = 1; -#ifdef UCLINUX - if (self_exec(av[0], "") < 0) { - perror("self_exec failed"); - exit(1); - } -#else - do_child(); -#endif - } - ltpuser2 = SAFE_GETPWNAM(NULL, user2name); - if (setreuid(ltpuser2->pw_uid, ltpuser2->pw_uid) == -1) { - perror("seteuid failed"); - exit(1); + wait_for_flag(2); + exit(0); } - - /* wait until child sets its euid */ + SAFE_SETREUID(bin_uid, bin_uid); wait_for_flag(1); - - TEST(kill(pid1, TEST_SIG)); - - /* signal the child that we're done */ + TEST(kill(pid1, SIGKILL)); *flag = 2; + SAFE_WAITPID(pid1, NULL, 0); - if (waitpid(pid1, &status, 0) == -1) { - perror("waitpid failed"); - exit(1); + if (TST_RET == 0) { + tst_res(TFAIL, "kill succeeded unexpectedly"); + return; } - if (TEST_RETURN != -1) { - printf("kill succeeded unexpectedly\n"); - exit(1); - } + if (TST_ERR == EPERM) + tst_res(TPASS, "kill failed with EPERM"); + else + tst_res(TFAIL | TTERRNO, "kill failed expected EPERM, but got"); +} - /* - * Check to see if the errno was set to the expected - * value of 1 : EPERM - */ - if (TEST_ERRNO == EPERM) { - printf("kill failed with EPERM\n"); +static void verify_kill(void) +{ + pid_t pid; + + pid = SAFE_FORK(); + if (pid == 0) { + do_master_child(); exit(0); } - perror("kill failed unexpectedly"); - exit(1); -} -void do_child(void) -{ - wait_for_flag(2); - exit(0); + tst_reap_children(); } -void setup(void) +static void setup(void) { - tst_require_root(); - - TEST_PAUSE; - - tst_tmpdir(); - - semkey = getipckey(); - - if ((shmid1 = shmget(semkey, getpagesize(), 0666 | IPC_CREAT)) == -1) - tst_brkm(TBROK, cleanup, "Failed to setup shared memory"); - - if ((flag = shmat(shmid1, 0, 0)) == (int *)-1) - tst_brkm(TBROK | TERRNO, cleanup, - "Failed to attach shared memory:%d", shmid1); + struct passwd *pw; + shm_key = GETIPCKEY(); + shm_id = SAFE_SHMGET(shm_key, getpagesize(), 0666 | IPC_CREAT); + flag = SAFE_SHMAT(shm_id, 0, 0); + pw = SAFE_GETPWNAM("nobody"); + nobody_uid = pw->pw_uid; + pw = SAFE_GETPWNAM("bin"); + bin_uid = pw->pw_uid; } -void cleanup(void) +static void cleanup(void) { - rm_shm(shmid1); - - tst_rmdir(); + if (shm_id != -1) + SAFE_SHMCTL(shm_id, IPC_RMID, NULL); } + +static struct tst_test test = { + .setup = setup, + .cleanup = cleanup, + .test_all = verify_kill, + .needs_tmpdir = 1, + .needs_root = 1, + .forks_child = 1, +}; From patchwork Thu Aug 20 10:26:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Feiyu Zhu X-Patchwork-Id: 1348302 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=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=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=cn.fujitsu.com 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 RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BXLS45HNWz9sPC for ; Thu, 20 Aug 2020 20:27:16 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id A3F123C580C for ; Thu, 20 Aug 2020 12:27:11 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-5.smtp.seeweb.it (in-5.smtp.seeweb.it [217.194.8.5]) by picard.linux.it (Postfix) with ESMTP id A99973C2FC9 for ; Thu, 20 Aug 2020 12:26:43 +0200 (CEST) Received: from heian.cn.fujitsu.com (mail.cn.fujitsu.com [183.91.158.132]) by in-5.smtp.seeweb.it (Postfix) with ESMTP id E4DC3600996 for ; Thu, 20 Aug 2020 12:26:42 +0200 (CEST) X-IronPort-AV: E=Sophos;i="5.76,332,1592841600"; d="scan'208";a="98313502" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 20 Aug 2020 18:26:40 +0800 Received: from G08CNEXMBPEKD04.g08.fujitsu.local (unknown [10.167.33.201]) by cn.fujitsu.com (Postfix) with ESMTP id 0484948990D3 for ; Thu, 20 Aug 2020 18:26:37 +0800 (CST) Received: from RHEL74GA.g08.fujitsu.local (10.167.220.75) by G08CNEXMBPEKD04.g08.fujitsu.local (10.167.33.201) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 20 Aug 2020 18:26:37 +0800 From: Feiyu Zhu To: Date: Thu, 20 Aug 2020 06:26:08 -0400 Message-ID: <1597919168-10702-4-git-send-email-zhufy.jy@cn.fujitsu.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1597919168-10702-1-git-send-email-zhufy.jy@cn.fujitsu.com> References: <1597919168-10702-1-git-send-email-zhufy.jy@cn.fujitsu.com> MIME-Version: 1.0 X-Originating-IP: [10.167.220.75] X-ClientProxiedBy: G08CNEXCHPEKD05.g08.fujitsu.local (10.167.33.203) To G08CNEXMBPEKD04.g08.fujitsu.local (10.167.33.201) X-yoursite-MailScanner-ID: 0484948990D3.A98F1 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: zhufy.jy@cn.fujitsu.com X-Spam-Status: No, score=0.4 required=7.0 tests=KHOP_HELO_FCRDNS, SPF_HELO_NONE, SPF_NONE autolearn=disabled version=3.4.4 X-Virus-Scanned: clamav-milter 0.102.4 at in-5.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-5.smtp.seeweb.it Subject: [LTP] [PATCH 4/4] syscalls/kill06:Cleanup && Convert to new library 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: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" 1) Take use of some safe macros Reviewed-by: Yang Xu Signed-off-by: Feiyu Zhu --- testcases/kernel/syscalls/kill/kill06.c | 208 ++++++-------------------------- 1 file changed, 37 insertions(+), 171 deletions(-) diff --git a/testcases/kernel/syscalls/kill/kill06.c b/testcases/kernel/syscalls/kill/kill06.c index 7a1e8bf..8fcc8bc 100644 --- a/testcases/kernel/syscalls/kill/kill06.c +++ b/testcases/kernel/syscalls/kill/kill06.c @@ -1,187 +1,53 @@ +// SPDX-License-Identifier: GPL-2.0-or-later /* + * Copyright (c) International Business Machines Corp., 2001 * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/* - * NAME - * kill06.c - * - * DESCRIPTION - * Test case to check the basic functionality of kill() when killing an - * entire process group with a negative pid. - * - * ALGORITHM - * call setup - * loop if the -i option was given - * fork 5 children - * execute the kill system call - * check the return value - * if return value is -1 - * issue a FAIL message, break remaining tests and cleanup - * if we are doing functional testing - * if the processes were terminated with the expected signal. - * issue a PASS message - * otherwise - * issue a FAIL message - * call cleanup - * - * USAGE - * kill06 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. + * Test case to check the basic functionality of kill() when killing an + * entire process group with a negative pid. * * HISTORY * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS - * This test should be run as a non-root user. */ -#include "test.h" - +#include #include -#include #include +#include +#include +#include "tst_test.h" -void cleanup(void); -void setup(void); -void do_child(void); - -char *TCID = "kill06"; -int TST_TOTAL = 1; - -#define TEST_SIG SIGKILL - -int main(int ac, char **av) +static void verify_kill(void) { - int lc; - pid_t pid1, pid2; - int exno, status, nsig, i; - - tst_parse_opts(ac, av, NULL, NULL); -#ifdef UCLINUX - maybe_run_child(&do_child, ""); -#endif - - setup(); /* global setup */ - - /* The following loop checks looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - - /* reset tst_count in case we are looping */ - tst_count = 0; - status = 1; - exno = 1; - - /* Fork a process and set the process group so that */ - /* it is different from this one. Fork 5 more children. */ - - pid1 = FORK_OR_VFORK(); - if (pid1 < 0) { - tst_brkm(TBROK, cleanup, "Fork of first child failed"); - } else if (pid1 == 0) { - setpgrp(); - for (i = 0; i < 5; i++) { - pid2 = FORK_OR_VFORK(); - if (pid2 < 0) { - tst_brkm(TBROK, cleanup, "Fork failed"); - } else if (pid2 == 0) { -#ifdef UCLINUX - if (self_exec(av[0], "") < 0) { - tst_brkm(TBROK, cleanup, - "self_exec of " - "child failed"); - } -#else - do_child(); -#endif - } - } - /* Kill all processes in this process group */ - TEST(kill(-getpgrp(), TEST_SIG)); - sleep(300); - - tst_resm(TINFO, "%d never received a" - " signal", getpid()); - exit(exno); - } else { - waitpid(pid1, &status, 0); - if (TEST_RETURN != 0) { - tst_brkm(TFAIL, cleanup, "%s failed - errno = " - "%d : %s", TCID, TEST_ERRNO, - strerror(TEST_ERRNO)); - } + pid_t pid, child_pid[5]; + int nsig, i, status; + + pid = SAFE_FORK(); + if (pid == 0) { + setpgrp(); + for (i = 0; i < 5; i++) { + child_pid[i] = SAFE_FORK(); + if (!child_pid[i]) + pause(); } - /* - * Check to see if the process was terminated with the - * expected signal. - */ - nsig = WTERMSIG(status); - if (!nsig) { - tst_resm(TFAIL, "Did not receive any signal"); - } else if (nsig == TEST_SIG) { - tst_resm(TPASS, "received expected signal %d", - nsig); - } else { - tst_resm(TFAIL, - "expected signal %d received %d", - TEST_SIG, nsig); - } + TEST(kill(-getpgrp(), SIGKILL)); + if (TST_RET != 0) + tst_res(TFAIL | TTERRNO, "kill failed"); + tst_res(TINFO, "%d never received a signal", getpid()); + exit(0); } - - cleanup(); - tst_exit(); -} - -/* - * do_child() - */ -void do_child(void) -{ - int exno = 1; - - sleep(299); - - tst_resm(TINFO, "%d never received a" " signal", getpid()); - exit(exno); -} - -/* - * setup() - performs all ONE TIME setup for this test - */ -void setup(void) -{ - /* Setup default signal handling */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - TEST_PAUSE; + + SAFE_WAITPID(pid, &status, 0); + nsig = WTERMSIG(status); + if (nsig != SIGKILL) { + tst_res(TFAIL, "wait: unexpected signal %d returned, " + "expected SIGKILL(9)", nsig); + return; + } + tst_res(TPASS, "receive expected signal SIGKILL(9)"); } -/* - * cleanup() - performs all the ONE TIME cleanup for this test at completion - * or premature exit. - */ -void cleanup(void) -{ - -} +static struct tst_test test = { + .forks_child = 1, + .test_all = verify_kill, +};