From patchwork Fri Sep 2 06:33:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Avinesh Kumar X-Patchwork-Id: 1673372 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org 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=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=MMfWpYPS; dkim=fail reason="signature verification failed" header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=i+evxJIg; dkim-atps=neutral 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 (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MJp5w0VNHz1yn9 for ; Fri, 2 Sep 2022 16:33:55 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 705A93CA87F for ; Fri, 2 Sep 2022 08:33:48 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-7.smtp.seeweb.it (in-7.smtp.seeweb.it [IPv6:2001:4b78:1:20::7]) (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 C90E43CA4D7 for ; Fri, 2 Sep 2022 08:33:46 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-7.smtp.seeweb.it (Postfix) with ESMTPS id 640432003B9 for ; Fri, 2 Sep 2022 08:33:45 +0200 (CEST) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id BC9CD2033C for ; Fri, 2 Sep 2022 06:33:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1662100424; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=uaXAlxxW0l02oEsoi3TRbI188mqO94MO8B92VtoJ1nw=; b=MMfWpYPSm76FCP/Bpf4Eyfyw16+tdjNBdahKqZH47DFTU5mIPzMtq8Fo68Or4viW4u/x8j 9bipFPEaLwpJTLX4Y5C55/uJgldH/jS0/OVSt8kx0QshnYyzqQS/EGn9s3kUpCg1A7xRF4 V5eb7Tt3J0XpyaK4hTjtkYtF/ihQjEw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1662100424; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=uaXAlxxW0l02oEsoi3TRbI188mqO94MO8B92VtoJ1nw=; b=i+evxJIg6Y1ARu7nP30X6s052aL20PKBJTzUepz3khkWXqw/5t13p8f+ToGPFi1mFKljy6 xPEH7T0MGMB1GtDw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 416E91330E for ; Fri, 2 Sep 2022 06:33:44 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id ShrYAcijEWO8SAAAMHmgww (envelope-from ) for ; Fri, 02 Sep 2022 06:33:44 +0000 From: Avinesh Kumar To: ltp@lists.linux.it Date: Fri, 2 Sep 2022 12:03:41 +0530 Message-Id: <20220902063341.21705-1-akumar@suse.de> X-Mailer: git-send-email 2.37.1 MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.102.4 at in-7.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-7.smtp.seeweb.it Subject: [LTP] [PATCH v2] unlink08: use TST_EXP_FAIL(), turn comment into docparse and reword, copyright update 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" Signed-off-by: Avinesh Kumar --- testcases/kernel/syscalls/unlink/unlink08.c | 37 ++++++--------------- 1 file changed, 10 insertions(+), 27 deletions(-) diff --git a/testcases/kernel/syscalls/unlink/unlink08.c b/testcases/kernel/syscalls/unlink/unlink08.c index f3ce46ad8..f75ba06e0 100644 --- a/testcases/kernel/syscalls/unlink/unlink08.c +++ b/testcases/kernel/syscalls/unlink/unlink08.c @@ -1,22 +1,20 @@ // SPDX-License-Identifier: GPL-2.0-or-later /* + * Copyright (c) Linux Test Project, 2002-2022 * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. */ -/* - * Description: - * The testcase checks the various errnos of the unlink(2). - * 1) unlink() returns EACCES when deleting file in unwritable directory - * as an unprivileged user. - * 2) unlink() returns EACCES when deleting file in "unsearchable directory - * as an unprivileged user. - * 3) unlink() returns EISDIR when deleting directory for root - * 4) unlink() returns EISDIR when deleting directory for regular user +/*\ + * [Description] + * + * Verify that unlink(2) fails with + * - EACCES when no write access to the directory containing pathname + * - EACCES when one of the directories in pathname did not allow search + * - EISDIR when deleting directory as root user + * - EISDIR when deleting directory as non-root user */ -#include #include -#include #include #include "tst_test.h" @@ -36,21 +34,7 @@ static struct test_case_t { static void verify_unlink(struct test_case_t *tc) { - TEST(unlink(tc->name)); - if (TST_RET != -1) { - tst_res(TFAIL, "unlink(<%s>) succeeded unexpectedly", - tc->desc); - return; - } - - if (TST_ERR == tc->exp_errno) { - tst_res(TPASS | TTERRNO, "unlink(<%s>) failed as expected", - tc->desc); - } else { - tst_res(TFAIL | TTERRNO, - "unlink(<%s>) failed, expected errno: %s", - tc->desc, tst_strerrno(tc->exp_errno)); - } + TST_EXP_FAIL(unlink(tc->name), tc->exp_errno, "%s", tc->desc); } static void do_unlink(unsigned int n) @@ -65,7 +49,6 @@ static void do_unlink(unsigned int n) verify_unlink(cases); exit(0); } - SAFE_WAITPID(pid, NULL, 0); } else { verify_unlink(cases);